AI agents
Observability, Tracing, and Systematic Agent Debugging
Instrument agent systems so teams can separate model, context, tool, policy, state, and environment failures.
By the end you can
- Define agent observability and debugging as an operational contract rather than a capability label
- Contrast Raw transcript with Structured distributed trace in “A support agent was blamed for hallucinating an order status it had actually retrieved”
- Trace “Observability data can become a second sensitive system with broad access” through a concrete execution path
- Produce “Debug one failed trajectory” with evidence for “A failed run can be replayed from versioned evidence”
Example
A support agent was blamed for hallucinating an order status it had actually retrieved
The model repeated a value returned by a stale cache. The trace recorded neither cache age nor source version. So the incident was filed as a generation error, and the wrong component was changed.
Nothing in the transcript could have separated the two readings. The words on screen are identical whether the model invented the status or faithfully reported what a stale tool handed it. The difference lives entirely in fields the run never recorded.
That misclassification is not exotic, and it is not a failure of attention. Agent failures have been catalogued: 14 distinct modes in 3 categories — system design issues, inter-agent misalignment, and task verification. Mert Cemri and 12 co-authors built that taxonomy, MAST, the first Multi-Agent System Failure Taxonomy, by annotating agent traces. The model saying something untrue is one family among many. The practice section takes the taxonomy apart. The point here is narrower. A trace that could not tell the categories apart is what assigned this incident to one.
- Decision at stake: Instrument agent systems so teams can separate model, context, tool, policy, state, and environment failures — the six things a transcript renders as one undifferentiated sentence.
- Hidden assumption: Saving the conversation transcript is sufficient observability for an agent.
- Primary control question: Observability data can become a second sensitive system with broad access, so what is recorded is a privacy decision as well as a debugging one.
- Evidence to collect: Cache age and source version alongside the propagated trace identifier, so the run can be replayed from versioned evidence rather than re-argued from memory.
Visual
Four of the five lanes already have published span names
One run leaves a Task trace, a Model span, a Tool span, a State span and an Outcome span. A failure can be localized only where the five line up. Four of those lanes no longer have to be invented locally. The names are already published.
OpenTelemetry's GenAI agent-span conventions define create_agent, invoke_agent — in a client and an internal variant — invoke_workflow and plan. gen_ai.operation.name is a Required attribute on all of them. gen_ai.provider.name is Required on create_agent and on the invoke_agent client span. The conventions are still at Development status. Their definition of invoke_workflow reads: “Represents an operation that executes a coordinated process composed of multiple agents or other operations involving generative AI.”
A second table lies on top of that one. Microsoft Foundry's 2026 agent tracing documentation publishes multi-agent semantic conventions developed with Cisco Outshift, built on the OpenTelemetry conventions plus W3C Trace Context. They add an execute_task span; the invoke_agent child spans agent_to_agent_interaction, agent.state.management, agent_planning and agent_orchestration; and the execute_tool attributes tool.call.arguments and tool.call.results.
Line the lanes up against those two tables and the mapping is direct. The Task lane is execute_task: goal, tenant, user, authority, run and environment identifiers hang off it. The Model lane is invoke_agent, carrying gen_ai.operation.name and gen_ai.provider.name along with input context metadata, model configuration, output, latency and usage. The Tool lane is execute_tool, and tool.call.arguments and tool.call.results are the two fields the case above was missing. The State lane is agent.state.management: memory writes, checkpoints, approvals, external mutations.
The fifth lane is the one neither table names — postconditions, grader results, business impact, incident labels. That is precisely why the State span and the Outcome span should be owned apart, and tested apart. A published span name costs nothing and makes a trace legible to a tool nobody on the team wrote. A private one costs nothing today and everything at the first cross-vendor incident.
- 1
Task trace
Goal, tenant, user, authority, run, and environment identifiers.
- 2
Model span
Input context metadata, model configuration, output, latency, and usage.
- 3
Tool span
Schema, arguments, source, result, error, retry, and idempotency key.
- 4
State span
Memory writes, checkpoints, approvals, and external mutations.
- 5
Outcome span
Postconditions, grader results, business impact, and incident labels.
More logs do not add up to observability
Agent observability captures the causal surface of a run: task contract, context assembly, model requests, tool calls, state transitions, approvals, latency, cost, and terminal outcome. Debugging uses that evidence to localize the earliest material divergence — not the loudest symptom, the earliest one.
More logs do not guarantee observability. Events need stable identifiers, privacy controls, semantic fields, and links across model, tool, and business state. A stale cache read and a fabricated order status produce the same sentence in a log file and different values in a tool span. The distinction is a property of the schema, not of the volume.
Debugging asks where a run first went wrong, and a pile of events with no shared identifiers cannot answer that question at any volume.
Case
Trace Context became a W3C Recommendation on 23 November 2021
The plumbing is standardised, which removes one excuse. W3C published Trace Context as a Recommendation on 23 November 2021. Its abstract states that “This specification defines standard HTTP headers and a value format to propagate context information that enables distributed tracing scenarios.”
The value format is not an abstraction. A real header reads traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01 — version, then a 32-hex trace-id, then a 16-hex parent-id, then trace-flags. Beside it, tracestate carries vendor-specific name/value pairs. Those 32 hex characters do one job. They make a model call in one service, a tool call in another and a database write in a third provably the same run, rather than three plausible neighbours in a time window.
Nor is adoption left to taste. OpenTelemetry's Propagators API specification requires a W3C Trace Context propagator that parses and validates those two headers. It names W3C TraceContext, W3C Baggage and B3 among the propagators that must be maintained and distributed as OpenTelemetry Core packages. A run that cannot be reconstructed is not a run that hit the limits of the state of the art. It is a run nobody instrumented.
Key idea
A EUR 91 million fine for passwords stored in plaintext
Prompts, tool results, memory, and user data may contain secrets or regulated information. Indiscriminate logging can increase exposure and retention risk. The trace store quietly becomes a second copy of the sensitive material, held longer and read by more people than the original.
That risk has a documented price. On 27 September 2024 Ireland's Data Protection Commission fined Meta Platforms Ireland Limited EUR 91 million and issued a reprimand. The inquiry had been open since April 2019, into passwords stored in plaintext on internal systems, and it found infringements of GDPR Articles 5(1)(f), 32(1), 33(1) and 33(5). Deputy Commissioner Graham Doyle said in the press release: “It is widely accepted that user passwords should not be stored in plaintext, considering the risks of abuse that arise from persons accessing such data.”
No attacker features in that story. Meta found the readable passwords itself. “As part of a routine security review in January, we found that some user passwords were being stored in a readable format within our internal data storage systems”, Pedro Canahuati wrote in the Meta newsroom in March 2019. The same disclosure put the scale at hundreds of millions of Facebook Lite users, tens of millions of other Facebook users and tens of thousands of Instagram users. The systems built to handle those values wrote them into internal storage. That is the exact shape of an over-instrumented agent, logging every prompt, every tool result and every memory write because logging was easier to justify than choosing.
So log the minimum evidence needed, redact or tokenize sensitive fields, separate access, and test deletion and retention controls. Microsoft Foundry's agent tracing documentation states the same rule in one line: “Treat trace data as production telemetry and apply the same access controls and retention policies you use for logs and metrics.”
A trace store nobody governs becomes a second copy of every secret the agent handled, kept longer and read by more people than the original.
Analogy
A distributed systems trace with a business ending, priced in nanoseconds and terabytes
A request trace follows one operation across services, queues, and databases, then connects it to the customer outcome. Agent observability adds model context and decisions to that chain. A call graph names the service that answered. An agent trace still has to name the context, the tool result, and the policy the model was acting on when it diverged.
The analogy has an origin, and that origin came with measurements rather than assurances. Google's Dapper report priced always-on tracing in 2010. Creating and destroying a root span took 204 nanoseconds on average, a non-root span 176. Each stored span averaged 426 bytes. Tracing every request raised average web-search latency by 16.3%, while a 1/1024 sampling rate moved it by -0.20%. Sampled that hard, the volume was still enormous: “Our production clusters presently generate more than 1 terabyte of sampled trace data per day.”
Read those five numbers together and the design question stops being whether to trace. Per-span overhead is negligible. The sampling rate decides between a 16.3% latency tax and a rounding error. Storage decides how long a run stays replayable. For agent systems the same arithmetic decides which lanes are captured on every run and which are captured only when a run fails. That choice is made once, and it determines what can be debugged later.
Useful traces connect model behavior, tool evidence, state transitions, and real outcomes.
Steps
Debug one failed trajectory against a taxonomy someone else validated
Debug one failed trajectory end to end, from the contract at run start to the component you would change.
Start by reconstructing the contract: the requested outcome, the constraints, and the authority the run held when it began. Then find the first divergence, comparing expected and observed state step by step rather than reasoning backwards from the visible symptom at the end. Then classify the source. Classify it against a taxonomy that has been validated outside your team.
One exists. In 2025 Mert Cemri and 12 co-authors analysed 150 annotated traces, agreed with each other at kappa = 0.88, and built MAST, the first Multi-Agent System Failure Taxonomy. The paper is Why Do Multi-Agent LLM Systems Fail? Its abstract reports: “This process identifies 14 unique modes, clustered into 3 categories: (i) system design issues, (ii) inter-agent misalignment, and (iii) task verification.” The same authors released MAST-Data: 1,600+ annotated traces across 7 popular multi-agent frameworks.
The kappa = 0.88 is the part worth pausing on. It means two people looking at the same failed trace mostly agreed on what had gone wrong. That is the property an incident label needs, and the property ad-hoc labels never have. A team that files its incidents under those 14 modes can compare its failure profile against 1,600+ annotated traces from 7 frameworks. A team that invents fresh labels each quarter cannot compare its profile even with its own from last quarter.
Then test the hypothesis by replaying with one controlled change rather than many simultaneous edits. A replay with three edits confirms nothing about any of them. Finish with a regression artifact: a task, an assertion, a monitor, or a contract test that makes the same failure fail loudly next time. The exercise is complete when the run can be replayed from versioned evidence and the classification survives someone else reading the same trace.
- 1
Reconstruct the contract
Confirm the requested outcome, constraints, and authority at run start.
- 2
Find the first divergence
Compare expected and observed state step by step.
- 3
Classify the source
Assign the failure to context, model, tool, policy, memory, environment, or grader.
- 4
Test the hypothesis
Replay with one controlled change rather than many simultaneous edits.
- 5
Add a regression artifact
Create a task, assertion, monitor, or contract test that prevents recurrence.
Count closed causes, not the traces you collected
The best debugging metric is not trace volume. It is the percentage of material failures that can be localized to a testable cause and converted into a durable regression check.
The distance between those two metrics has been measured. TRAIL — Trace Reasoning and Agentic Issue Localization — is a 2025 release of 148 human-annotated agent execution traces drawn from GAIA and SWE-Bench tasks. Its README describes the dataset as “a benchmark dataset of 148 annotated AI agent execution traces containing 841 errors across reasoning, execution, and planning categories”. The traces existed. The errors were inside them, already annotated. Localization was still hard. Deshpande and five co-authors report in the abstract that “Our evaluations reveal that modern long context LLMs perform poorly at trace debugging, with the best Gemini-2.5-pro model scoring a mere 11% on TRAIL.”
Hold that 11% next to any dashboard whose headline number is traces collected. Collecting the evidence and closing the cause are different achievements. Only the second one removes a failure from the backlog. The team that runs agent observability and debugging owns the trace store's exposure as well as its coverage. What it should be able to demonstrate is one failed run, replayed from versioned evidence, localized to one component, and closed by a regression check that would catch it again.
Teams that count traces instead of closed causes keep rediscovering the same failure with better instrumentation.
Key takeaways
- Agent observability captures the causal surface of a run: task contract, context assembly, model requests, tool calls, state transitions, approvals, latency, cost, and terminal outcome.
- More logs do not guarantee observability, and more logs are not free. Dapper measured 426 bytes per stored span. Tracing every request raised average web-search latency by 16.3%, against -0.20% at a 1/1024 sampling rate, and the sampled data still ran to more than 1 terabyte per day.
- One run is stitched together by a propagated identifier. W3C Trace Context has been a Recommendation since 23 November 2021. It defines traceparent as version, a 32-hex trace-id, a 16-hex parent-id and trace-flags, and OpenTelemetry's Propagators API requires a propagator that parses and validates it.
- The span vocabulary is published rather than improvised: create_agent, invoke_agent, invoke_workflow and plan, with gen_ai.operation.name Required on all of them. Microsoft Foundry adds execute_task, agent.state.management, and the execute_tool attributes tool.call.arguments and tool.call.results.
- Log the minimum evidence needed, redact or tokenize sensitive fields, separate access, and test deletion and retention controls. On 27 September 2024 Ireland's Data Protection Commission fined Meta Platforms Ireland Limited EUR 91 million over passwords stored in plaintext on internal systems, under GDPR Articles 5(1)(f), 32(1), 33(1) and 33(5).
- The best debugging metric is not trace volume but the share of material failures localized to a testable cause and converted into a regression check. On TRAIL's 148 annotated traces the best model evaluated, Gemini-2.5-pro, scored 11%. Classification is only comparable against a validated taxonomy such as MAST's 14 modes in 3 categories, at kappa = 0.88.