The Diagnostic Habit That Separates Prompt Failures From Tool Failures From Workflow Failures in Production Agent Runs
Trace each failed agent run to its earliest unrepaired error first.

AI agent failure attribution by harness layer requires tracing a failed outcome back to the earliest decisive, unrepaired error, then assigning it to the prompt, tool, or workflow layer. The diagnostic habit is a structured process of elimination before any fix is attempted. A visible symptom identifies where investigation begins.
Why production agent failures resist the instrumentation engineers already have
Standard LLM observability follows a prompt into a model and a completion out. An agent run has a different structure. It is a nested tree of plans, tool calls, and subagent handoffs, with state changing between actions. A run can loop, select the wrong tool, or drift off-task while returning a 200 with normal latency and token counts.
That mismatch also separates the evidence from the symptom. An early mistake may become visible in the run only after several agents have acted on its faulty premise, so clues to it can lie many steps apart. Scale AI's root-cause attribution research characterizes this as a search problem, because diagnosis requires testing plausible explanations against contradictory evidence. Outcome-level success or failure cannot supply that causal account. The tooling most teams already have was not built to explain agentic trajectories.
The three distinct layers where agent failures originate
Prompt and specification failures originate in what the agent is instructed or given to work from. When rules conflict, an action can follow one instruction and break another, and stale retrieved context can leave otherwise sound reasoning based on an outdated premise. Another failure mode is to repeat a step that is already done without making progress. MAST, the Multi-Agent System Failure Taxonomy, finds that specification and design issues are its most common failure category. These are failures of task definition and assembly that can occur even when execution works.
Tool failures concern invocation, capability, and interpretation of results. A call may omit a required argument, encounter an unreachable endpoint, or return data that the agent misreads. Sometimes none of the available tools can do what was asked. These failures can be silent at the task level. A tool response that is accepted without being understood correctly can contaminate later steps without producing an explicit error.
Workflow failures arise in orchestration and inter-agent coordination. An architect can introduce a specification error, an engineer can faithfully implement it, and a tester can verify the wrong behavior. ErrorProbe's multi-agent systems research identifies inter-agent dependencies as creating long, sometimes branching causal chains. Other workflow failures include loops without iteration caps and context growth without summarization until the window limit aborts execution. A prompt edit cannot repair an orchestration loop, just as a tool schema update cannot repair a coordination breakdown.
Why attribution accuracy is low even for automated tools, and what that demands of the diagnostic process
Recognizing these categories is easier than assigning responsibility within a long run. The last incorrect action may merely propagate an earlier mistake, while an apparent correction may leave the decisive error untouched. Finding an anomaly is therefore not enough. Diagnosis must establish which earlier decision made the run unsuccessful and why its effect remained unrepaired.
LongRCA Bench evaluated five baselines on over a thousand human-annotated failed trajectories. The strongest achieved only 13.2% exact root-step accuracy with DeepSeek-V4-Flash on the full benchmark, while reference roots preceded completion by a median of 48 recorded steps. That distance makes local inspection a weak substitute for causal investigation. LLM-as-a-judge methods can have moderate agent-level attribution accuracy but do much worse at finding the step responsible.
One-shot judgments also tend to stop searching too soon. Scale AI's Continual Search improves attribution across multiple benchmarks by repeatedly directing the judge toward unresolved diagnostic evidence. AgentDebugX's DeepDebug likewise achieves higher exact agent-and-step accuracy than single-pass baselines through multi-turn investigation, but it does not make automated attribution conclusive. The practical consequence is a structured diagnostic process that treats a proposed root cause as a hypothesis to test.
The diagnostic habit requires structured, trace-driven elimination before any fix
For practitioners, the first step is to add instrumentation across the trajectory. Capture the user request, prompt assembly, retrieval queries and evidence, tool inputs and outputs, model calls, and post-processing and safety checks. The record also needs any available reasoning traces from before actions, changes to external state, and retry or fallback paths that can hide repeated failures. Call-level metrics alone leave those transitions unexplained. Without the tool arguments or retrieved content, someone reviewing the run later cannot tell whether the request was malformed or was sound but based on a faulty premise.
Make the trajectory attributable to its operating context. The structured event log should include request ID, tenant and risk class, agent and workflow versions, model and prompt versions, retrieved sources, tool outcomes, policy decisions, retries, evaluator results, and final status. Latency, token usage, cache hits, and cost fill out the picture of how the run went. An action cannot be judged against an instruction that was not actually present during the run.
Next, identify the observable failure and give it a typed description. A wrong answer, unmet constraint, exception, or loop is a starting symptom whose responsible layer remains to be established. ErrorProbe operationalizes this distinction by detecting local anomalies against a taxonomy before tracing backward and validating hypotheses through tool-grounded execution. Without it, one engineer may investigate repeated calls while another investigates the final answer, even though both are reviewing the same trajectory.
Then work backward to the earliest recorded step that introduced a decisive error which remained unrepaired at completion. Test competing explanations against the intervening evidence. DeepDebug helps with this work through global trajectory understanding, structure-guided inquiry, and cross-examination. HPFA takes a complementary approach by comparing the failed trajectory with a reference successful path through a dependency hypergraph.
Only then assign the responsible layer and propose an intervention. Ask whether the decisive error came from instructions or assembled context, a tool interaction, or orchestration and coordination. The distinction constrains the possible repair. If a successful call returned an unexpected schema, rewriting the task instruction does not repair that schema drift. If retrieval supplied outdated context, changing routing does not fix the evidence that went into the run.
How do you pinpoint the responsible layer in an agent trace?
For prompt and specification failures, compare the logged instruction and context with the action taken. Duplicate tool calls or repeated retrievals with identical or near-identical inputs can expose step repetition without progress. A specification conflict appears when an action follows one instruction but violates another in the recorded prompt version. Stale context requires a different comparison. Retrieval document IDs and scores identify what was selected, but captured retrieval inputs and outputs are needed to establish that the content was outdated relative to the task.
For tool failures, look at the invocation and response separately. A missing required field or malformed argument may appear as a schema validation error, provided the input was captured verbatim. Schema drift is less obvious because the call can return HTTP 200 and still deliver a structure the downstream step does not expect. Correct output can also be misinterpreted. In that case, the evidence lies in the contrast between the returned data and the recorded reasoning before the next action.
For workflow failures, look across spans. An iteration count that keeps growing without state change or convergence can reveal an uncapped loop. Rising token usage followed by an abort or truncation can expose context exhaustion. Coordination failures require following handoff records backward. Agent B may act correctly on agent A's output even though that output embeds a specification error introduced many turns earlier.
LongRCA Bench illustrates why propagation must be separated from introduction. In one example, repeated checks retained a nightly lodging price as a two-night total despite correction of a separate arithmetic error. A correction therefore did not establish that the trajectory had recovered. Harness-Bench similarly found that errors and task success are not mutually exclusive, with harness configuration determining outcomes more than the model or error rate alone. Buildrix had 12 failed tool calls across five failure categories in a live engineering workflow, but its harness treated those failures as intermediate observations and allowed the run to recover.
The available diagnostic tools support different parts of this investigation. AgentDebugX provides a portable, framework-agnostic trajectory representation with an OpenTelemetry GenAI export path, as well as attribution and recovery stages. ErrorProbe combines typed anomaly detection, backward tracing, and executable hypothesis validation, while Continual Search targets premature closure in automated judgment. These are distinct capabilities. A trace export provides the evidence, but an attribution method must still show which parts of it support the proposed cause.
Why fixing the right layer still requires replay validation before the change ships
Correct attribution narrows the intervention but does not validate it. A prompt change can fix the conflict that was found but break another run that worked before, and a routing change can affect behavior beyond the original failure. Diagnosis and acceptance are separate decisions. For engineers, the familiar comparison is code review and regression testing, because understanding a defect does not prove that its repair preserves other behavior.
The validation discipline is to replay the change against the trace that exposed the failure and a regression suite of production runs that must still work. Recorded tool outputs and sandboxed side effects make that testing more stable and less costly than uncontrolled execution. Prompts, tools, and routing should be versioned as code, with each change tied to its motivating trace. Run the full suite before deployment. Testing only the original failure establishes too little about the rest of the harness.
AgentDebugX makes that separation explicit through its Recover and Rerun stages after attribution. ReHarness also shows the value of changing the textual harness rather than model weights, outperforming raw-context, memory- and reflection-based, and prompt optimization baselines across three continual learning benchmarks and three language model backbones. Its results support harness iteration as a useful lever. Distribution shifts are still a reason to test more than the original failure. Replay narrows release risk without eliminating it.
Making the diagnostic habit repeatable through first-class harness engineering
A diagnostic process used only when incidents become visible is still reactive maintenance. Applied systematically to accumulating production traces, it becomes reliability engineering, with recurring failure patterns as a central signal. One occurrence may be noise. The same mode across multiple runs indicates a systematic harness problem that an isolated patch can leave unresolved. Consistent review makes those repetitions available as evidence before their effects compound.
ErrorProbe builds diagnostic knowledge through verified episodic memory that updates only when executable evidence confirms an error pattern. That is a concrete model for institutional learning. The team equivalent is to retain the failure, the attributed cause, the versioned intervention, and its regression evidence together. Prompts, tool schemas, routing, and memory then become reviewable engineering artifacts. Their changes have an evidentiary basis instead of depending on whichever explanation sounded most plausible during an incident.
Harness iteration is fast and reversible, making it a natural first intervention when attribution points there. That does not mean every failure belongs in the harness. Evidence must show whether a harness change is enough before a model weight-update path is considered. The responsibility is the same as in code review, because the practice works through consistent application. On Monday morning, having the habit means reviewing production traces, locating the decisive error, assigning its layer, and requiring replay evidence before the resulting change ships.
Sources
- AgentDebugX: An Open-Source Toolkit for Failure Observability, Attribution, and Recovery in LLM Agents
- Towards Self-Improving Error Diagnosis in Multi-Agent Systems
- Published as a conference paper at COLM 2026
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
- LongRCA Bench: Root-Cause Localization in Long-Horizon Agent Trajectories
- TRAJDEBUG: Tracing Error Lifecycle to Identify Critical Failures in Long-Horizon Agent Trajectories


