Production Learning Review

Replacing Agent Failure Intuition With a Trace-Attribution Discipline That Names the Actual Layer

It shows how to trace agent failures to the layer that caused them.

· 9 min read
Cover illustration for “Replacing Agent Failure Intuition With a Trace-Attribution Discipline That Names the Actual Layer”
Production Signal Theory · November 20, 2026 · 9 min read · 1,933 words

A production trace-driven harness engineering workflow instruments real runs, attributes failures to their originating layer, changes the responsible component, and validates the change through replay before deployment. Its central discipline is to distinguish the visible symptom from the prompt, tool, workflow, memory, or product logic that caused it. Improvement comes from closing that evidence loop.

Why engineers reading a failed trace reach the wrong conclusion

A trace ends in an error, but the engineer reading it cannot yet tell where the failure began. The final tool call looks wrong. An earlier planning or memory mistake, however, may have shaped every action that followed without producing an obvious error of its own. Editing the component nearest the terminal failure can therefore leave the actual cause untouched.

TRAJDEBUG, from Tsinghua and Tencent Hunyuan in 2026, distinguishes local errors from the critical error step responsible for the final failure. Some local errors are fixed while the agent runs, and others do no harm. The critical error is neither necessarily the first anomaly nor the mistake nearest the end. Visibility is not a reliable measure of causality.

Scale AI’s 2026 paper, Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures, identifies the same weakness in automated diagnosis. One-shot LLM judges tend to settle on plausible explanations before examining critical evidence distributed across longer traces. Automated judgment can make the same mistake as the engineer across many more runs. The resulting change addresses a symptom, and the failure recurs.

What the trace is actually showing, and how errors move through it

A multi-step trace records actions that shape what the agent decides to do later. Its order alone does not explain those dependencies. The evidence needed to judge an action may be in an instruction, observation, or memory record far from it in the trace, and the harm it causes may be visible much later in the trace. A terminal error establishes that the trajectory failed while leaving open which earlier step made failure inevitable.

The TRAJDEBUG example makes this distinction concrete. An agent modifies a forbidden file, violating a task constraint early in the run. Later attempts to fix the violation hide it locally and cause a side effect, and all tests pass. End-state verification exposes the structural failure. The critical error remains the original constraint violation, rather than the later point where the failure becomes visible.

That sequence illustrates evidence sparsity because the file modification must be judged against an earlier constraint. It also shows error lifecycle complexity because what looks like a repair changes the local evidence while leaving the original violation in place. Finally, the end state depends on the relationship between the initial action, its repair, and the repair’s side effect. Those dependencies are not merely adjacent steps. HPFA, published at COLM 2026, identifies flat-sequence analysis as a structural limitation because it obscures non-local and higher-order dependencies.

The five layers where failures actually originate

A working diagnosis needs both an error category and a location in the harness. These serve different purposes. Prompt, tool, workflow, memory, and product logic name engineering intervention points, while a taxonomy describes what went wrong within execution. Treating those vocabularies as interchangeable can turn a useful classification into another vague diagnosis.

AgentDebug’s AgentErrorTaxonomy groups failures into five modules. Memory includes hallucination, retrieval failure, and over-simplification. Reflection includes progress misjudgment, outcome misinterpretation, causal misattribution, and hallucination. Planning includes constraint ignorance, impossible action, and inefficient plan. Action includes misalignment, invalid action, format error, and parameter error, while System includes step limit, tool execution error, LLM limit, and environment error.

Three recurring categories show why that specificity is useful. Tool schema drift occurs when an external API adds a required field or deprecates an endpoint while the agent continues using the old signature. The call may look correct against the prompt’s instructions but fail at the tool boundary. This is not necessarily a reasoning defect. CI-side schema snapshot testing gives teams lead time before production exposes the mismatch.

Prompt ambiguity creates a different diagnostic trap. A routing threshold change or template drift can alter workflow behavior without an event that looks like a deployment. The symptom is behavioral, but its origin is instructional. Workflow loops lead to the reverse confusion when invalid tool arguments cause the agent to keep trying variations or make up a result. A failure at the action layer then gets blamed on reasoning.

AgentFixer, from IBM Research in 2026, identifies cross-agent failures in format compliance, information consistency across stages, and semantic reasoning-action alignment. Parsing errors account for 38% of task failures in the production deployment of IBM CUGA, making them the largest category. “Parameter error at the action layer” points to tool span data in a way that “bad output” cannot.

Why telemetry alone does not close the gap between detection and attribution

TelemetrySuffBench, from East China Normal University in 2026, separates failure detection from origin-step localization. With its OpenTelemetry-compatible views and views that work with another telemetry schema, detection stays nearly perfect, but origin-step accuracy is at most 0.5%. The finding is narrower than a verdict on every observability deployment. It shows that schema-compatible telemetry can preserve evidence of failure while losing the evidence needed to locate its origin.

Decision content is the decisive missing element. Removing records of what the agent decided and why reduces origin-step accuracy to zero across all tested models. Removing provenance also produces large losses. Status fields cannot substitute for the causal links between a decision, its inputs, and its downstream effects.

The instrumentation requirement follows from that distinction. Each tool span needs the tool name, arguments, raw output, duration, retry count, and error state. When arguments and raw output are missing, hallucinated arguments and silent retry loops can look like normal traffic. Reasoning spans need the agent’s stated rationale, while memory spans need provenance showing which retrieval returned what and when. More spans alone will not close this gap.

How causal graph tracing attributes failure to a specific layer

Backward causal tracing starts with the known failure and follows the dependencies that produced it. Instead of asking which step first looks suspicious, the process asks which upstream error is causally connected to the failed outcome. Anomalies that were repaired or did no harm need not be treated as root causes just because they came early.

AgentTrace, presented at the ICLR 2026 Workshop on Agents in the Wild, reconstructs causal graphs from execution logs. It traces backward from error manifestations and ranks candidate causes using structural and positional signals. The method requires no LLM inference at debugging time. Its reported results combine high accuracy with sub-second latency and significantly outperform heuristic and LLM-based baselines.

HPFA adds to this by comparing a failed trajectory with a successful trajectory that has a similar structure. Their dependency hypergraphs make divergence points searchable even when a conclusion depends jointly on distant earlier actions. The method makes attribution more accurate and efficient than flat-sequence approaches. For longer traces with sparse evidence, Scale AI’s Continual Search instead keeps the diagnostic process searching for unresolved evidence rather than accepting its first plausible explanation.

Candidate rankings are intermediate results for the team changing the harness. The useful output identifies both the responsible layer and the evidence location. It takes the form “this failure originated at the tool action layer, parameter error, in span X.”

How do teams use production traces to improve prompts and tools in the harness?

LangChain improved its coding agent’s Terminal-Bench 2.0 score by modifying the harness while keeping the underlying model unchanged. That example locates an important source of engineering leverage. A failed run does not automatically imply that the model needs replacement or retraining. The environment governing its actions is itself a modifiable system.

The harness includes the system prompt, tool registry, sandbox, permission model, memory, context management, sub-agents, hooks, observability, and evals. Prompt engineering addresses only part of that environment. Layer-specific attribution connects the failure to the component that needs attention, rather than making the prompt the default destination for every fix. It also distinguishes missing guidance from missing validation.

Harness controls fall into guides and sensors. Guides act before execution through system prompts, constraint documents, and tool definitions. Sensors act afterward through linters, type checkers, test suites, evals, and output parsers. For a team applying the attribution, tool schema drift calls for schema snapshot testing in CI, while prompt ambiguity calls for a guide change. A workflow loop may need both kinds of control.

Memory requires the same separation of symptom and origin. A harness can provide working, episodic, semantic, and procedural memory simultaneously. A retrieval failure in episodic memory can produce an answer that looks like faulty reasoning. Attribution points to the retrieval failure and keeps the team from editing a prompt unrelated to it.

Validating a harness change before it ships, using the traces that exposed the failure

A targeted change is still an untested hypothesis. The trace that exposed the failure supplies the execution context needed to test it. Replay reconstructs the rendered prompt, tool outputs, and retrieval payload from preserved bodies, then reruns the agent in a sandbox and compares the outputs.

Synthetic evals answer a different question. They establish whether a change handles a constructed scenario, which may resemble production without reproducing its tool arguments, memory state, or retrieval payload. Replay preserves that distinction rather than treating realistic examples as equivalent to recorded execution. It tests the production scenario behind the diagnosis. That makes it the direct validation step for a trace-derived fix.

Chronicle, described in 2026, formalizes cut-point replay for regression testing by preserving prompts, agent state, and tool arguments. Redaction occurs at record time, before any record is written, so sensitive values are removed while the structure used by test assertions is retained. Scheduled replay of a golden trace set against current production provides early warning of silent drift from model updates, prompt edits, or tool schema changes. Validation therefore extends beyond the initial repair.

The evaluation target must be the full trajectory. A corrected final answer does not establish that the agent chose the right tool or avoided the original invalid action. A fix that leaves the wrong call in place may only hide the defect. The typed tool-call, reasoning, state, and memory spans used for attribution also provide the recorded bodies needed for replay. Instrumentation supports testability as well as observability.

Turning trace-attribution into a repeating engineering practice, not a one-off investigation

A production workflow begins by instrumenting traces with decision content and provenance, then evaluating full trajectories, including final answers. Failed runs can be grouped by recurring error category and originating layer. A repeated pattern deserves a different response from an isolated anomaly. The next steps are causal diagnosis, a change to the responsible component, replay validation, deployment, and monitoring for recurrence.

A prompt edit, tool definition, memory configuration, or workflow update can interact with changes made elsewhere, so a local improvement does not establish full-harness stability. Harness Continual Learning, formalized in 2026, treats the mutable harness as a unified continual learning state. Its retention evaluation spans committed updates. That framing makes regression testing part of adaptation.

The practical standard is a repeating engineering loop. Production failures give teams evidence, the named layers set the scope of the repair, and saved traces become regression fixtures. Code review can then examine the change against its diagnosis, while testing evaluates the trajectory it is meant to repair. Scheduled replay checks whether later updates keep that behavior in place. This is trace-attribution discipline, applied to the harness with the same expectations of evidence, testing, and regression control that govern mature software engineering.

Sources

  1. TelemetrySuffBench: Is Agent Telemetry Sufficient for Failure-Origin Diagnosis?
  2. Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
  3. TRAJDEBUG: Tracing Error Lifecycle to Identify Critical Failures
  4. Published as a conference paper at COLM 2026
  5. HPFA: Hypergraph-Based Paired Failure Attribution for LLM Reasoning
  6. [2603.14688] AgentTrace: Causal Graph Tracing for Root Cause Analysis in Deployed Multi-Agent Systems

More in Production Signal Theory