
An agent takes a request, plans, calls a model, hands work to a second agent, which calls a tool server, which calls an API. Then the answer is wrong, slow, or expensive. Where did it go wrong?
In most stacks today, nobody can say. Each piece logs to its own place, and the request that a user experienced as one event shows up as several unrelated records. The problem is rarely a lack of telemetry. It is that the telemetry does not connect.
This article covers how to trace one request end to end across models, tools, and platforms. It focuses on the boundaries, because that is where traces break. It draws on recent practitioner research, and it flags where the evidence is thin or the standards are still moving.
Why Per-Component Logging Fails for Agents
Traditional LLM monitoring captured prompts, completions, latency, and token counts for a single call. That works for a chatbot. It does not work for an agent, where one user request fans out into plans, nested agents, retries, tool executions, memory reads, and retrieval steps.
The unit of debugging has changed
With an agent, the interesting failure is rarely in one model call. It is a wrong tool choice at step three, a retry loop at step five, or a handoff that dropped context. You cannot see that by reading the final output, and you cannot see it by reading each service’s logs in isolation.
What a useful trace answers
- Which agent, tool call, retry, or handoff caused the failure?
- Where did the time go, and where did the money go?
- Which model produced which decision?
- Which external systems did the agent touch on the user’s behalf?
The last question matters for security review and compliance as much as for debugging. A connected trace is an audit trail.
One Request, One Trace ID
The core idea is the same as in microservices: a shared trace context travels with the request across every boundary. Each unit of work becomes a span, and spans nest under a parent. Microsoft and AWS guidance on multi-agent systems both recommend carrying a shared context across agent, tool, and service boundaries so a workflow stays one correlated trace.
The span hierarchy for an agent run
- Workflow or session span: the user request.
- Agent span: one per agent invocation, nested under its caller.
- Model span: each inference call, with model name, provider, and token usage.
- Tool span: each tool or MCP call, with arguments and outcome.
- Retrieval and memory spans: reads and writes to context stores.
If every one of these shares a trace ID, a single view shows the whole run. If any boundary drops the context, the tree splits.
OpenTelemetry GenAI Conventions: A Shared Vocabulary, Still in Flux
OpenTelemetry is emerging as the interoperability layer. Its GenAI semantic conventions define common names and attributes for model calls, agent and workflow steps, tool invocations, retrieval, token usage, metrics, and optional prompt and completion events. MCP conventions are part of the same effort.
The practical benefit is lower switching cost. One instrumentation pipeline can feed several backends, so you are less tied to a single model provider, framework, or observability vendor.
The caveat you should plan around
Multiple sources report these conventions are still at “Development” stability. Attribute names and agent operations may change. Sources also describe the conventions as having moved to a dedicated repository for independent iteration, without an official release yet.
What to do about it:
- Version your instrumentation and record which convention version each service emits.
- Wrap attribute names in a thin internal layer so a rename is a one-file change.
- Treat prompt and completion content as opt-in, since it can contain sensitive data.
Real tools already emit this data. OpenTelemetry documentation points to VS Code Copilot emitting traces, metrics, and events for agent interactions, and to OpenAI Codex exporting structured events and metrics for API requests, tools, and sessions.
A note on instrumentation style: one landscape analysis of 17 platforms found decorator-based instrumentation in 7 (41%) and OpenTelemetry as the stated primary approach in 5 (29%). That analysis also claims 89% of organizations had agent observability by 2026, but this was not verified against a primary source, so treat it cautiously.
Where Traces Actually Break: Protocol Boundaries
Experts broadly agree that multi-agent traces fragment at MCP and agent-to-agent boundaries, because GenAI SDKs do not consistently propagate W3C Trace Context across service calls. Inside one process, context passing is automatic. Across a process, a queue, or a vendor, it is not.

The measured cost of missing propagation
One test used two agents and six tools, producing 48 spans. When MCP _meta propagation was omitted, only 25.0% of the spans stayed in the root trace, and a single request split into seven separate traces.
Small per-hop losses compound too. At 95% propagation per hop across 21 hops, only 39.0% of requests stayed fully connected, according to the same source. This is a single test setup rather than a universal benchmark, but the direction is clear: deep agent chains punish even a small break rate.
Propagating Context Through MCP
HTTP headers alone are not enough for MCP. Streamed and retried requests need per-message lineage, and stdio transports have no headers at all. Recent guidance therefore carries W3C traceparent, tracestate, and baggage inside the JSON-RPC params._meta field. That works across both stdio and Streamable HTTP.

How it works
- The MCP client starts a span for the tool call.
- It injects the current context into
params._meta. - The MCP server extracts it and starts its span as a child.
- Any downstream API call the server makes continues the same trace.
Langfuse has demonstrated linking MCP client, server, and downstream API operations into one trace this way.
The overhead is small
Carrying the three fields added 232 to 248 bytes per message and 54.8 to 69.5 microseconds per localhost round trip in the cited test. Compared with a model call that takes seconds, that is negligible.
Caveats
- Server authors must read
_meta. Third-party MCP servers may ignore it, in which case you get a client-side span and a gap behind it. - Baggage can leak data to downstream parties. Do not put user identifiers or secrets in it.
The Agent-to-Agent Gap
MCP at least has an emerging convention. Agent-to-agent protocols are less settled. A2A defines a contextId to group tasks, but it is not a distributed tracing field. Practitioners recommend adding W3C headers or message metadata and agreeing on span names and relationships.
Traceloop has published an open-source demonstration combining A2A messaging, MCP tools, and OpenTelemetry, with W3C Trace Context headers propagating across agents through a four-phase code-generation workflow. Proposals for common span semantics across handoffs are still active, so expect change.
A pragmatic rule
Keep your own contextId or session ID as a business-level grouping, and keep the trace ID as the technical one. Log both on every span, so you can pivot between them.
Crossing Models and Platforms
Crossing a model provider is mostly easy, because the model call is a leaf span you create yourself. Record provider, model name, token counts, and finish reason on it. Switching models then becomes a filter in your trace data rather than a new logging scheme.
Crossing platforms is harder. A hosted agent platform, a SaaS tool, or a vendor’s agent may not accept your trace context. Your options:
- Bridge span: record the outbound call and the returned vendor run ID as attributes, so you can join manually.
- Export from the vendor: if the platform emits OpenTelemetry, point it at your collector and correlate by a shared ID.
- Gateway: route calls through a layer that injects and extracts context for you.
Be honest in your dashboards about which edges are bridged and which are native. A joined-by-ID link is weaker than a true parent-child span.
What Traces Reveal: Cost and Latency

An Elastic case study instrumented a LangChain shopping assistant using OpenTelemetry GenAI conventions. The traces linked agent, model, and tool spans and showed that three model calls consumed 92% of latency. Replacing one model cut cost by 76 to 83%, though most tests became slower.
The last part is the lesson. A trace shows the tradeoff instead of hiding it. Without it, you would have saved money and never noticed the quality or speed effect.
Traces also expose redundant agents, cacheable tool calls, and expensive reasoning paths.
Sampling Without Losing the Failures
Agent traces are large. Keeping all of them is costly, and head sampling at, say, 5% discards 95% of failures along with everything else. In the cited test, at a 5% rate, tail sampling retained 22.30% of complete failing traces, versus a far lower share for head sampling.
Tail sampling decides after the trace completes, so it can keep errors, slow runs, and high-cost runs. It needs the full trace in one place, which is another reason fragmentation hurts: a broken trace cannot be judged as a whole.
Suggested policy
- Keep 100% of traces with errors, guardrail hits, or human escalation.
- Keep traces above a latency or token-cost threshold.
- Sample the healthy remainder at a low rate.
A Rollout Checklist
- Pick one trace backend and one collector. Keep instrumentation vendor-neutral.
- Instrument the entry point so every user request starts a root span.
- Inject and extract W3C context at every process, queue, MCP, and A2A boundary.
- Measure completeness: track the share of requests whose spans all land in one trace. Alert when it drops.
- Standardize attributes for model, agent, tool, and token usage.
- Control content capture: redact prompts and outputs by default.
- Adopt tail sampling once volume grows.
- Pin convention versions and plan for renames.
Conclusion
Tracing agents is mostly a context-propagation problem. The model call is the easy part. The hard parts are the hops: MCP servers, agent handoffs, queues, and vendor platforms.
Start with the metric that tells you whether you are succeeding: trace completeness. If one request becomes seven traces, no dashboard built on top will be trustworthy. Fix propagation first, then add cost analysis, tail sampling, and evaluations on top of a connected graph.
Keep expectations realistic as well. The OpenTelemetry GenAI conventions are still evolving, A2A tracing has no settled standard, and several figures cited here come from single tests or vendor summaries. Build thin, version it, and verify against your own traffic.

Leave a Reply