TL;DR: Production AI agent failures often hide in retrieval, tool calls, state updates, or model inputs, and Braintrust’s guide shows why trace-level visibility is needed to isolate the failing step rather than rerun the agent blindly. The core implication is that agent observability must span execution paths, not just final outputs, if teams want reliable regression coverage.
At a glance
What this is: This is a guide to agent tracing, showing how span-level execution data exposes the exact step where an AI agent run goes wrong.
Why it matters: It matters because teams debugging AI agents need observability across model calls, tools, retrieval, and state changes, not just the final answer.
Context
AI agent failures are hard to diagnose when production logging flattens a multi-step run into one response. The problem is not just visibility, but attribution: a wrong answer can come from retrieval, tool execution, state handling, or the model call itself, and the final output usually hides which step introduced the error.
Agent tracing is the discipline of recording each run as a connected execution path so the model, tools, memory, and state changes can be inspected together. For IAM and security practitioners, the relevance is governance as much as debugging: once AI systems take actions through tools and state, the control point moves from the final output to the execution trail.
The article’s starting point is typical for production agent teams. As agent workflows become more stateful and tool-driven, flat logs stop being enough for root-cause analysis.
Key questions
Q: What breaks when production AI agents are not instrumented well enough to debug?
A: When traces are incomplete, teams lose the ability to see routing, tool use, state changes, and retry patterns, so failures get reduced to guesswork. That makes it hard to separate a one-off bad answer from a repeatable control failure. Good instrumentation turns agent behaviour into evidence that can support investigation, remediation, and regression testing.
Q: Why do production AI agent failures need trace-level analysis?
A: Because the error often occurs before the final response is generated. A retrieval step can pass stale context, a tool can return the wrong payload, or state can drift without any obvious signal in the output. Trace-level analysis lets teams attribute the failure to the exact step instead of guessing from the last message alone.
Q: How can security teams tell whether agent intent tracking is working?
A: Look for reduced false negatives on gradual escalation, fewer irreversible actions taken after boundary testing, and stronger correlation between risk scores and enforced control changes. If the system only blocks obviously malicious prompts, but misses slow-burn drift, the control is not effective.
Q: What is the difference between agent tracing and LLM tracing?
A: LLM tracing focuses on a single model call, including the prompt, response, token usage, and timing. Agent tracing covers the whole run, including retrieval, tools, memory, state updates, and handoffs. Teams need agent tracing when the failure may be caused by workflow steps outside the model boundary.
Technical breakdown
Why flat logs fail for AI agents
A flat log records that an agent returned an answer, but it does not preserve the causal chain behind that answer. In a production agent, the failure may arise in retrieval, a tool argument, a missing state update, or the model call that consumed the wrong context. Logging captures events; it rarely reconstructs decision flow. Trace data changes that by preserving order, nesting, and intermediate outputs. That lets teams compare the intended workflow with the actual one, which is essential when the wrong result is produced by an earlier span rather than the final response.
Practical implication: instrument the full agent path, not just the response layer, if you want usable root-cause evidence.
What a connected trace captures in practice
A trace is a tree of spans, with each span representing one unit of work such as a model call, retrieval request, tool invocation, memory read, or state update. Each span records inputs, outputs, timing, and errors, so the run can be reviewed step by step. That structure matters because many agent failures are compositional: a retrieval span returns stale context, the model reasons correctly from bad context, and the final answer appears plausible but wrong. The trace makes the hidden dependency visible.
Practical implication: capture retrieval results, tool payloads, and state transitions as first-class spans so failures can be isolated quickly.
How tracing differs from LLM tracing and observability
LLM tracing is useful for prompt and response inspection, but it ends at the model boundary. Agent tracing extends beyond that boundary into the workflow around the model, which is where many production failures actually occur. Observability tools then build on the traces to spot patterns across runs, releases, and issue classes. In other words, tracing gives you the evidence for one failure, while observability lets you see whether that failure is systemic. For AI governance, that distinction is important because controls need to evaluate the whole execution path, not only the model invocation.
Practical implication: treat agent tracing as the source of evidence and observability as the layer that turns evidence into operational control.
NHI Mgmt Group analysis
Trace-level visibility is now a governance requirement for AI agents, not a debugging luxury. When agents can call tools, read memory, and change state, the failure boundary moves away from the model output and into the execution path. That means teams cannot rely on final-answer logging to prove what happened or why it happened. Practitioners should treat the trace as the system record for agent action and review.
Stateful agent workflows create a new kind of accountability gap that looks familiar to IAM teams. A model call may be correct while an upstream retrieval step or tool decision injects the real error. That is similar to access governance problems where the visible outcome masks the control failure upstream. Execution-path observability: the practical control problem is being able to attribute each agent decision to a recorded input, tool action, and state transition. Teams should use trace data as the audit surface for agent behaviour.
Regression coverage becomes materially stronger when production failures are converted into test cases. The article’s workflow is important because it turns one-off trace review into reusable quality control. That reduces the chance that a stale retrieval result, malformed tool call, or bad context update recurs after a release. Practitioners should formalise trace-to-eval pipelines so the same failure mode is blocked before deployment.
Agent observability is converging with the identity and control problem around autonomous software. Once an agent can act through tools and state, the question is not only whether the model responded correctly, but whether the execution path stayed within its intended boundary. That makes trace data relevant to agent identity governance, especially where tool privileges and runtime delegation are involved. Practitioners should align tracing with control design, not just post-incident debugging.
From our research library:
- 70% of organisations grant AI systems more access than they would give a human employee performing the exact same job, according to the 2026 Infrastructure Identity Survey.
- 19% of organisations give AI systems dramatically more access than human employees, nearly one in five granting unrestricted privilege, according to the 2026 Infrastructure Identity Survey.
- Read next: AI Agent Observability, Audit and Incident Response Guide
What this signals
Execution-path observability: AI agent programmes now need to prove not just what a model said, but how each step of the workflow got there. That changes the operational control surface from prompt review to span review, which is a materially stronger basis for debugging and governance.
Trace data becomes most valuable when it feeds release gates. If a production failure can be labelled, replayed, and scored before deployment, the team has moved from reactive debugging to enforceable regression control.
The identity angle is real even in a debugging article: once an agent can call tools and update state, its authority is expressed through the execution path. Practitioners should treat traced tool calls and state transitions as part of the agent’s control boundary, not just its observability layer.
For practitioners
- Instrument the full agent execution path Capture model calls, retrievals, tool invocations, memory reads, and state updates as connected spans so a failed run can be reconstructed end to end.
- Separate model failures from workflow failures Review traces to determine whether the wrong output came from the model, the retrieved context, the tool response, or a downstream state change before changing prompts or code.
- Convert confirmed failures into regression cases Turn each root-caused trace into a labeled eval row with expected output and a scorer that checks the original failure pattern before release.
- Use nested spans for custom logic Wrap business rules, data transformations, and other non-framework functions in traced spans so hidden steps do not disappear between the agent and the final answer.
- Apply sampling to production tracing Use trace sampling and payload discipline so observability stays useful without turning every request into a high-overhead debugging event.
Key takeaways
- AI agent failures often originate in retrieval, tool calls, or state updates rather than in the final model output.
- Trace-level evidence gives teams a defensible way to isolate the failing step and avoid blind reruns.
- Turning failed traces into regression tests is the practical control that stops the same defect from reappearing.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP Agentic AI Top 10 and MITRE ATLAS address the attack and risk surface, while NIST AI RMF and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Agentic AI Top 10 | ASI03 — Identity & Privilege Abuse | Agent tracing is about understanding how agent authority is exercised across tools and state. |
| Recommendation — Trace agent tool use and state changes so you can detect privilege misuse in runtime execution. | ||
| NIST AI RMF | GOVERN — AI Governance and Accountability | The article centres on governance evidence for production AI systems and their behaviour. |
| Recommendation — Establish trace-based accountability for AI agent decisions and failure review. | ||
| MITRE ATLAS | TA0007 — Discovery | Tracing supports discovery of where an AI workflow failed and which step produced the bad result. |
| Recommendation — Use trace evidence to map agent failure paths and isolate the stage that introduced bad context. | ||
| NIST CSF 2.0 | DE.CM-01 — Monitoring for Anomalies and Events | Agent tracing is a monitoring control for production workflow anomalies. |
| Recommendation — Instrument agent runs so anomalous behavior is observable at the step level. | ||
Key terms
- Agent Tracing: Agent tracing records the steps an AI agent takes while reasoning, calling tools, retrying actions, and producing outputs. It helps teams reconstruct why an agent behaved a certain way, where latency was introduced, and whether the workflow stayed within approved boundaries.
- Span: A span is one discrete operation inside a trace, such as a retrieval query, prompt assembly step, or model call. Spans make it possible to pinpoint which part of an AI workflow consumed time, introduced error, or passed bad context to the next stage.
- Regression Eval: A regression eval is a repeatable test case built from prior failures. It uses captured inputs, expected outputs, and a scorer to verify that a previously observed problem does not reappear after a change to prompts, models, tools, or retrieval logic.
- Execution Path: An execution path is the chain of systems, roles, functions, and permissions that an identity uses to reach a target service. For AI agents, this matters more than the label on the agent itself because effective authority often comes from the path, not the object.
Deepen your knowledge
NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance and agentic AI identity for practitioners who need to connect control design to runtime behaviour. It is useful for security and identity teams that need a structured way to govern non-human access and delegation.
Published by the NHIMG editorial team on August 19, 2026.
Updated on October 12, 2026.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org