Est.

Sentry Sourcemaps the Stack, Not the Decision Stack Your Agent Climbed to Reach the Wrong Answer

Agents can fail silently while code succeeds, so trace decisions.

· 8 min read · Updated
Cover illustration for “Sentry Sourcemaps the Stack, Not the Decision Stack Your Agent Climbed to Reach the Wrong Answer”
Agent Debugging · November 3, 2026 · 8 min read · 1,865 words

Traditional error monitoring fails for AI agents because successful code execution does not establish that an agent made the right decision. Sentry sourcemaps the code stack, leaving the decision stack your agent climbed to reach the wrong answer unexplained. Explaining that answer requires tracing model calls, tool invocations, and reasoning steps in context, then evaluating them against the task and its constraints.

Why stack traces cannot explain what an agent decided

Code broke, or the agent decided wrong. These are different failures, and only the first necessarily leaves an exception. Traditional error monitoring looks for thrown errors, unexpected status codes, and processes that have crashed. A stack trace locates the code involved in that failure. An agent, however, can execute every operation successfully while selecting the wrong evidence, trusting incomplete context, or producing an answer that violates an instruction.

The distinction is between execution and judgment. A success status and clean logs are compatible with fabricated identifiers, a refund promise outside policy, or a shipment routed on missing context. The runtime has no execution failure to report in those examples. Sentry’s sourcemapping remains useful for locating faults in executed code, but that instrument does not reconstruct why an agent chose one action over another.

What the agent's decision path actually looks like, and where failures hide in it

An agent run is a graph of spans. It can include a plan step, tool invocations, retrieval calls, reasoning over retrieved content, and response generation. Each step can fail on its own and still pass its result downstream as input that other steps can use. A retrieval failure can therefore poison the context that a later reasoning step trusts. The visible error appears in the answer, while its cause sits earlier in the path.

In a single-agent sequence, reading model calls in order can expose that progression. Multi-agent failures are harder to localize because their dependencies form a graph. A tool call in one agent can degrade the input to a different agent two steps later, even when no individual span looks wrong in isolation. The relationship between spans becomes part of the evidence. Reading an answer without its upstream context can make the generator look responsible for a failure it inherited.

Liu et al.’s entropy study records such a handoff failure on day 47 in a multi-agent system that had otherwise been stable. Agent A failed to pass critical context to Agent B without an error message, timeout, or resource bottleneck. The task completed with subtly degraded output, which the operator noticed three cycles later. The study examined this propagation dynamic across 40,000 controlled trials. Finding the cause requires the full decision path as structured spans in sequence and context, making that path (not the exception) the unit of debugging.

How researchers and practitioners have classified agent failures — and what the classification reveals about where monitoring must look

One practitioner framework separates planning errors, tool errors, retrieval errors, reasoning errors, and safety or policy violations. These categories name different places where a run can depart from its task. A planner can choose the wrong tool sequence or loop, while an executor can diverge from the plan. A tool can get wrong arguments or return bad output that the agent accepts without error-handling. Retrieval can bring in faulty context before generation starts.

Correct retrieval does not guarantee correct reasoning. Factual errors, math errors, and ignored instructions can arise even when the retrieved material is sound. Those failures call for a look at the generator rather than an assumption that the upstream context was wrong. PII leaks, jailbreak compliance, and inappropriate refusals instead require evaluation against safety or policy constraints. An output scanner addresses a different surface from a plan trace, so neither can substitute for the other.

The research literature does not use one universal taxonomy. Microsoft’s AI Red Team v2.0 taxonomy, updated in April 2026 and announced on June 4, 2026, adds seven failure mode categories after twelve months of red team engagements. They include Goal Hijacking, Inter-Agent Trust Escalation, Session Context Contamination, and MCP/Plugin Abuse. These categories extend the diagnostic focus to goals, agent relationships, session context, and tool interfaces. They do not establish that every such failure occurs without an exception.

Monitoring must reach the surface where the failure originates. A planning-layer defect does not belong in an output scanner, and a retrieval defect does not belong in the generator prompt. Conflating them encourages symptom-focused patches that leave the causes unresolved. The taxonomy becomes operationally useful when its categories map to evidence in the trace and to the component that needs correction.

What silent failure looks like in production — three cases where the system reported success

The available examples show three patterns of how operations can fail, though they are not records of three production incidents. The first is an agent that fabricates identifiers while its run returns success. Code execution alone cannot show whether those identifiers are valid. The defect lies in the output’s relationship to the task.

The second pattern is a refund promise outside policy. The response can be generated successfully while committing to an outcome the agent was not authorized to offer. Nothing has to crash for this to happen. Diagnosis requires the applicable policy and the decision path that led to the promise. Checking only whether response generation completed leaves the relevant constraint outside the monitor’s view.

The third pattern is a shipment routed on missing context. Here, the final action can look like the failure even though the decisive omission occurred upstream. The distinction changes where a correction belongs. Monitoring must connect the routing decision to the context available when it was made, rather than treating completion as proof of correctness. Across these patterns, exception-only monitoring lacks the evidence needed to distinguish successful execution from a wrong decision.

Why entropy makes silent failure the default outcome at scale, not an edge case

Silent failure is not limited to an isolated wrong answer. Liu et al. formalize the accumulation of disorder across interactions as the Entropy Principle, drawing on tens of thousands of controlled trials and more than 100,000 production agent interactions. The study describes monotonic degradation in output consistency, task accuracy, and cross-session coherence when enough of the intrinsic agent properties are present together. Under those conditions, this can happen without an external trigger.

The study locates its origins across six lifecycle layers. Those layers are foundation semantics, inter-agent transmission, memory persistence, task execution, feedback correction, and systemic evolution. With failures spread across these layers, fixing one bad span leaves the wider reliability problem in place. A local fix deals with one failure surface. It does not show that context, memory, and coordination will stay sound as interactions continue.

The condition attached to the finding is important. It does not mean that every agent fails on a fixed schedule or that every additional interaction produces an observable error. It means that, where the relevant properties coexist, accumulated interaction can degrade behavior without a new deployment, attack, or resource failure. Passing a deployment evaluation therefore cannot establish ongoing reliability. The operating system of agents must be evaluated as its context and interactions develop.

A one-time evaluation describes performance under the conditions it tested. It cannot show whether a later handoff left out context or whether cross-session coherence has weakened. Runtime traces show how those conditions change, while ongoing evaluations check how the changes affect outcomes. Without both, silent divergence remains outside the deployment gate’s field of view.

What monitoring the decision path requires technically, and where the MCP layer creates a specific blind spot

To address these failures, instrumentation must capture every model call, tool invocation, and reasoning step as a structured span inside the same trace. Shared trace context connects a downstream symptom to the inputs and decisions that preceded it. Presence alone is not enough. A record showing that retrieval ran cannot establish whether its result supported the answer, just as a completed tool call cannot establish that its output was appropriate.

Adequate monitoring covers five complementary pillars. Decision-path traces show what happened, while metrics track cost, latency, and token usage. Evaluations grade output quality, and guardrails address safety and prompt injection. Business context ties behavior to user tier and feature attribution. These signals answer different questions, so operational health cannot tell how good an output is, and a quality score alone cannot show which step went wrong.

An agent approaching its context limit can silently drop earlier context and degrade its reasoning without a visible execution failure. Absolute token counts do not express saturation by themselves. Teams should alert on high context utilization as well as track token volume. This connects a resource measurement to the specific decision-path risk it can reveal.

MCP tool calls need the same continuity of evidence. Each call must appear as a span inside the trace containing the agent run and the model calls that triggered it, so a tool-layer failure can be examined in context. Otherwise, the visible symptom may be only an unexplained downstream agent error. OpenTelemetry’s GenAI semantic conventions are emerging as a vendor-neutral standard for this instrumentation. They cover LLM client spans, agent invocation spans, tool executions including MCP, token usage, content capture events, and model attributes, but remain at Development status with no stable release as of 2026.

Microsoft’s v2.0 taxonomy treats MCP/Plugin Abuse as a dedicated failure mode following 95 CVEs published for MCP-related software in 2025 alone. Tool poisoning makes the tool interface a prompt-injection surface as well as a boundary where execution can fail. A span showing that a call occurred does not establish whether its content influenced the agent improperly. Detecting that distinction requires spans that capture tool call content.

How decision-path monitoring connects to fixing failures without leaving the development workflow

Detection becomes operationally useful when its evidence reaches the remediation workflow. A monitoring console can expose a failure, but moving out of the development environment to reconstruct its context interrupts the feedback cycle. The developer needs the relevant path and failure surface to connect the observed deviation to a correction. An unexplained alert leaves that diagnostic work undone.

Scorers grade agent outputs continuously, flag live quality drops, and can block regressions from shipping. Traces then supply the context needed to investigate why a score changed. This creates a closed loop between production behavior and development rather than leaving evaluations at deployment and monitoring after it. The two functions remain distinct, but each makes the other more useful.

Automatic grouping of deviations into actionable failure categories strengthens that loop. Requiring teams to predefine every possible failure mode limits what the monitor can organize as behavior changes. Grouping repeated deviations by the surface that needs attention helps teams use them to find what went wrong. Otherwise, more traces and scores can produce alert fatigue without improving correction. The operational test is whether the evidence identifies what departed from the task and where a fix belongs.

Stack traces remain the instrument for faults in code execution. Agent reliability additionally requires a continuous, workflow-integrated, instruction-aware layer that evaluates decisions against what the agent was supposed to do. Its value is making the wrong decision diagnosable before the same failure reaches another user.

Sources

  1. Microsoft Updates Taxonomy of AI System Failure Modes
  2. Updating the taxonomy of failure modes in agentic AI systems: What a year of red teaming taught us
  3. Silent Failure in LLM Agent Systems: The Entropy Principle and the Inevitable Disorder of Autonomous Agents
  4. Diagnosing with Insights: Structured Analysis of Agent Failures via Behavioral Abstractions
Filed underAgent Debugging

More in Agent Debugging