Cross-agent tracing is the practice of linking the actions of multiple AI agents that collaborate on a task into a single, end-to-end trace. When Agent A delegates work to Agent B, which triggers Agent C, the trace connects all three agents' receipt chains into one coherent timeline.
In a multi-agent system, a single user request may be handled by several agents:
Without tracing, each agent has its own isolated receipt chain. You can see what each agent did individually, but you cannot see the full path of the request across agents. When something goes wrong, you cannot answer "what sequence of events across all agents led to this outcome?"
Cross-agent tracing uses two identifiers:
Trace ID: A unique identifier for the entire request, shared by all agents involved. This links all receipts across all agents into one trace.
Span ID: A unique identifier for each agent's portion of the work. This identifies which receipts belong to which agent within the trace.
// Agent A creates the trace
const guard = createGuard({
policy,
context: {
traceId: generateTraceId(),
spanId: 'agent-a',
}
});
// When delegating to Agent B, pass the trace ID
delegateToAgentB({
task: 'process this data',
traceId: guard.context.traceId,
});
// Agent B continues the trace
const guardB = createGuard({
policy: agentBPolicy,
context: {
traceId: incomingTraceId,
spanId: 'agent-b',
parentSpan: 'agent-a',
}
});
With cross-agent tracing, you can query the full trace:
# Get all receipts across all agents for a single request
curl https://control-plane/api/traces/trace_abc123
# Returns receipts from agent-a, agent-b, and agent-c in chronological order
When an incident occurs, cross-agent tracing answers critical questions:
Cross-agent tracing is conceptually identical to distributed tracing in microservices (OpenTelemetry, Jaeger, Zipkin). The trace ID propagates across service boundaries just like it propagates across agent boundaries. If your infrastructure already uses distributed tracing, you can correlate agent traces with infrastructure traces for complete observability.
Explore more guides on AI agent safety, prompt injection, and building secure systems.
View All Guides