Loading...
private.me xDebug
Get xDebug
FREE Developer Tool
ACI 206 — DEBUG SUITE

When your agents fail, xDebug tells you why

Developer tools for debugging AI agent interactions. Capture, trace, and analyze execution flow in AI agent systems with error explanation, performance profiling, message flow tracing, and session debugging.

Error Diagnosis Performance Profiling Message Tracing Session Replay
OVERVIEW

AI Agent Debugging Tools

xDebug reduces debugging time by up to 60% for AI agent systems built on the private.me platform. It eliminates cryptic error codes with actionable fix suggestions, simplifies performance analysis with sub-millisecond profiling, and protects session context for reproducing intermittent failures.

Designed for developers building multi-agent applications with @private.me/xbind, xDebug saves you hours of log-tracing by capturing execution context across async operations, converting framework errors into human-readable explanations, and identifying bottlenecks in real time — all with less than 1% overhead in production.

THE PROBLEM

Agent developers spend 60% of their time debugging opaque errors — a 60% reduction in debug time is possible

AI agents fail in production with cryptic errors. Multi-agent workflows hide bottlenecks. Message flows span multiple services. Execution context disappears across async operations.

Traditional debugging tools were not built for AI agent systems. Logs are scattered across services. Stack traces point to framework internals, not your code. Performance bottlenecks hide in distributed workflows. Error messages expose implementation details without explaining root causes.

COMMON SCENARIO
Production agent fails with "SIGNATURE_INVALID" at 3 AM. No context. No stack trace pointing to the actual problem. You spend hours tracing through async operations, multiple agents, and distributed message flows to find a simple timestamp drift issue.
THE SOLUTION

Error explainer. Profiler. Message tracer. CLI tools.

xDebug provides developer tools specifically designed for AI agent systems built with the Private.Me SDK. Convert cryptic errors into actionable fixes. Identify bottlenecks in multi-agent workflows. Visualize agent-to-agent communication. Capture full execution context across async operations.

5
Debug Capabilities
0.02ms
Event Capture
<1%
Profiler Overhead
CAPABILITIES

5 Debug Capabilities

DIAGNOSIS
Error Explainer
Convert cryptic errors into actionable fixes with error codes, human-readable descriptions, and suggested remediation steps.
PERFORMANCE
Performance Profiler
Identify bottlenecks in multi-agent workflows with duration tracking, event capture, and slowness detection.
TRACING
Message Flow Tracer
Visualize agent-to-agent communication with message tracking, latency measurement, and failure analysis.
SESSION
Session Debugger
Capture full execution context across async operations with session recording, event logging, and replay capability.
CALL GRAPH BUILDER
Map function call hierarchies for complex flows. Visualize nested agent operations, trace execution paths, and identify circular dependencies.
QUICK START

3-Step Integration

1. Install Package

BASH
npm install @private.me/xdebug

2. Error Explainer (Basic)

TYPESCRIPT
import { explainError, formatExplanation } from '@private.me/xdebug';

try {
  await agent.send({ to, payload });
} catch (error) {
  const explanation = explainError(error);
  console.log('Why:', explanation.why);
  console.log('Fix:', explanation.how.join('; '));
  console.log(formatExplanation(explanation));
}

3. Performance Profiler (Advanced)

TYPESCRIPT
import { Profiler } from '@private.me/xdebug';

const profiler = new Profiler();

profiler.start('agent-send');
await agent.send({ to, payload });
profiler.end('agent-send');

const report = profiler.getReport();
report.measurements.forEach(m =>
  console.log(`${m.label}: mean=${m.mean.toFixed(1)}ms p95=${m.p95.toFixed(1)}ms`)
);
SESSION DEBUGGING
Use the Debugger class to capture events across your agent workflows. Filter by level, category, or time range, and export to JSON, JSONL, CSV, or HTML.
See It In Action

Live Debug Tracing

$ xdebug trace --session abc123
Agent initialized: did:key:z6MkrP... (DID — Decentralized Identifier)
Message sent → payments-service (12ms)
ERROR: SIGNATURE_INVALID
→ Timestamp drift detected: +35 seconds
→ Fix: Sync system clock or increase tolerance window

Performance Profiling

AVG LATENCY
12ms
ERROR RATE
0.3%
TOTAL CALLS
1,247
DEVELOPER TOOLS

CLI Tools

Live watch mode with real-time metrics for your codebase. Track agent.send() patterns, error rates, latency, and recent errors automatically.

Dev Command - Live Watch Mode

BASH
# Watch current directory
xdebug dev

# Watch specific directory
xdebug dev --path ./src

# Enable verbose logging
xdebug dev --verbose

# Custom polling interval
xdebug dev --interval 500

Metrics Displayed

  • Total agent.send() count across all files
  • Error count (calls within try/catch blocks)
  • Error rate percentage
  • Average latency (extracted from timing patterns)
  • Recent errors with timestamps and file locations
AUTOMATIC RELOAD
File watching with automatic reload. Changes to your codebase update the dashboard in real-time without restarting the dev server.
ARCHITECTURE

How xDebug Works

xDebug uses a lightweight event-capture architecture that hooks into the private.me SDK at the transport, envelope, and agent layers without modifying application code.

The architecture consists of three layers: (1) Event Capture Layer — hooks into xBind transport, envelope creation, and agent lifecycle events with 0.02ms per-event overhead; (2) Analysis Engine — processes captured events through the Error Explainer, Profiler, and Session Debugger modules to produce structured diagnostics; (3) Output Layer — renders results to CLI, JSON exports, or session files for team collaboration.

All captured data stays local by default. No telemetry is sent externally. Session files can be shared with teammates for collaborative debugging, and all exports are stripped of sensitive cryptographic material before serialization.

USE CASES

Real-World Scenarios

Production Error Diagnosis

Production agent fails with cryptic error. Use explainError() to convert the error into actionable debug information with error codes, human-readable descriptions, and suggested remediation steps.

TYPESCRIPT
import { explainError, formatExplanation } from '@private.me/xdebug';

try {
  await agent.send({ to: 'did:key:z6Mk...', payload: sensitiveData });
} catch (error) {
  const explanation = explainError(error);

  // Log for ops team
  logger.error({
    why: explanation.why,
    fix: explanation.how,
    docs: explanation.docs
  });

  // Pretty-print for developer
  console.log(formatExplanation(explanation));
}

Performance Optimization

Multi-agent workflow running slowly. Use the Profiler to capture performance metrics, identify bottlenecks, and analyze slow operations.

TYPESCRIPT
const profiler = new Profiler();

profiler.start('dataset-processing');
await processLargeDataset(agent, dataset);
profiler.end('dataset-processing');

const report = profiler.getReport();

// Identify slow operations by percentile
report.measurements.forEach(m => {
  if (m.p95 > 1000) console.warn(`Bottleneck: ${m.label} p95=${m.p95}ms`);
});

Multi-Agent Communication Debugging

Distributed workflow with multiple agents. Use the Debugger to trace agent-to-agent communication, capture message flows, and identify failures.

TYPESCRIPT
import { Debugger } from '@private.me/xdebug';

const dbg = new Debugger({ enabled: true, minLevel: 'debug' });
dbg.startSession({ sessionId: 'multi-agent-001', agentId: 'coordinator' });

// Trace distributed workflow — log each dispatch as a debug event
dbg.info('send', 'Dispatching to worker-1', { target: 'worker-1', task: 'task1' });
await dispatch('worker-1', task1);

dbg.info('send', 'Dispatching to worker-2', { target: 'worker-2', task: 'task2' });
await dispatch('worker-2', task2);

// Analyze captured events
const errors = dbg.getEvents({ level: 'error' });
console.log(`Errors: ${errors.length}`);
dbg.endSession();

Session Replay

Agent execution fails intermittently. Use the Debugger to capture full execution context and export sessions for later analysis.

TYPESCRIPT
import { Debugger } from '@private.me/xdebug';
import { writeFileSync } from 'node:fs';

const dbg = new Debugger({ enabled: true, minLevel: 'debug' });
dbg.startSession({ sessionId: 'incident-20260427', agentId: 'main' });

try {
  await runComplexWorkflow(agent);
} catch (error) {
  dbg.error('workflow', error.message, error);

  // Export for later analysis
  const json = dbg.export({ format: 'json' });
  writeFileSync('./debug-sessions/incident-20260427.json', json);
}
dbg.endSession();
API REFERENCE

Core APIs

explainError(error: AgentCallError): ErrorExplanation
Convert AgentCallError instances into actionable debug information. Returns root cause analysis (why), fix steps (how), code examples, and documentation links. Synchronous — no await needed.
formatExplanation(explanation): string
Format an ErrorExplanation into a human-readable markdown string. Sections: What Happened, Why, How to Fix, and Documentation links.
class Debugger
Session-based event capture and export. Methods: startSession(context), endSession(), info/warn/error/fatal(category, message), getEvents(filter?), export({ format }), clear(), destroy().
class Profiler
Performance measurement with percentile statistics. Methods: start(label), end(label), measure(label, fn), getReport(), getMeasurements(), isActive(label), getCount(label), reset().
class DevWatcher
File watching with live metrics for development. Methods: start(options?), stop(), getMetrics(), isActive(). Tracks agent.call() patterns, error rates, and latency in your codebase.

Types

TYPESCRIPT
interface ErrorExplanation {
  what: string;             // What happened (plain English)
  why: string;              // Root cause analysis
  how: string[];            // Actionable fix steps
  examples: CodeExample[];  // Code examples showing the fix
  docs: string[];           // Documentation links
  code: string;             // Error code for reference
}

interface DebugEvent {
  id: string;
  timestamp: string;
  level: DebugLevel;
  category: string;
  message: string;
  data?: Record<string, unknown>;
  stack?: string;
  agentId?: string;
  sessionId?: string;
}

interface DebugSession {
  id: string;
  context: DebugContext;
  startedAt: string;
  endedAt?: string;
  events: DebugEvent[];
  status: 'active' | 'completed' | 'failed' | 'timeout';
  duration?: number;
}
INTEGRATION

Framework Integration

xDebug integrates with popular AI agent frameworks. Works with LangChain, AutoGPT, CrewAI, and any system built with the Private.Me SDK.

LangChain Integration

Wrap LangChain agents with xDebug profiling and error explanation. Automatically capture execution events and convert errors.

AutoGPT Integration

Use the Debugger to trace AutoGPT agent communication. Capture events across autonomous agent workflows and export session logs.

CrewAI Integration

Use the Profiler to identify bottlenecks in CrewAI multi-agent workflows. Export sessions for team debugging.

private.me SDK
Built specifically for agents created with @private.me/xbind. Error codes, message formats, and tracing hooks are SDK-native for zero-friction integration.
TROUBLESHOOTING

Common Issues

Issue: "Timer already running"

Cause: Calling profiler.start(label) when a timer with that label is already active.

FIX
// Check before starting
if (!profiler.isActive('my-timer')) {
  profiler.start('my-timer');
}

Issue: "Session export too large"

Cause: Too many events accumulated in the debugger.

FIX
// Filter events before export
const errors = dbg.getEvents({ level: 'error' });
console.log('Error count:', errors.length);

// Export then clear to free memory
const json = dbg.export({ format: 'json' });
dbg.clear();

Issue: "High memory usage during profiling"

Cause: Long-running sessions accumulating events.

FIX
// Periodically export and clear
setInterval(() => {
  const json = dbg.export({ format: 'jsonl' });
  appendFileSync('./debug.jsonl', json);
  dbg.clear(); // Free memory
}, 60000); // Every 60 seconds
PRODUCTION GUIDELINES
Enable only for specific sessions. Set includePayloads: false for exports. Implement log retention policies (auto-delete after 7 days). Restrict access to debug endpoints.
SECURITY

Secure by Design

xDebug is built with the same security principles as the private.me platform. Debug data never leaves your machine unless you explicitly export it.

All session captures are stored locally and encrypted at rest. Exported session files automatically redact private keys, HMAC secrets, and XorIDA share data before serialization. The profiler operates in a read-only mode — it observes execution without modifying agent state or intercepting live messages. In production environments, xDebug can be configured to capture only error events, minimizing the attack surface while maintaining diagnostic capability.

GET STARTED

Free for All Developers

xDebug is a free developer tool. No credit card required, no trial period, no subscription. Install and start debugging immediately.

OPEN TO ALL
xDebug is part of the Private.Me platform's commitment to developer tools. Use it in personal projects, commercial applications, or enterprise environments without cost.
pnpm add @private.me/xdebug

Pricing

FREE DEVELOPER TOOL
Free Tier
100 million operations per month free. No credit card required. Pro Tier available for unlimited operations with priority support.
Questions about this ACI? Contact us