Attribution Matrices That Route Blame to Prompt or Tool Before You Touch the Logs
A symptom-to-layer matrix tells you who owns the fix first.

AI agent failure attribution by harness layer starts with an attribution matrix that maps observable symptoms to candidate prompt, tool, workflow, and memory faults before logs are opened. The matrix routes suspicion and identifies who may own the repair, while targeted trace inspection establishes the cause. Replay against the production traces that failed then tests whether the proposed fix works.
Why agent debugging defaults to log-diving and why that is the wrong starting point
A completed pipeline can conceal a failed task. LLM pipelines often give wrong output without throwing an exception, so engineers have a final response but no useful stack trace. Opening raw logs is therefore an understandable default, but it starts the investigation without a question. Because agent behavior emerges from interactions among the model, harness, tools, memory, users, and environment, the visible error may be far from its cause.
That distance creates a problem of searching for the cause and assigning the repair. A wrong refund amount, for example, can originate in either a mid-trajectory tool-selection decision or the final calculation. An outcome label cannot distinguish those causes. Teams that treat the result as evidence that “the model is broken” risk pursuing retraining or a model swap when the repair belongs in the harness.
What the interaction-centric view of failure reveals about where to point the blame first
Raj et al.’s Model or Harness? An Interaction-Centric Taxonomy for Localizing Agent Failures makes the interaction between components the unit of analysis. The taxonomy assigns failures to an edge between components and a fault side indicating where the repair belongs. The edge locates the break in an interaction. The fault side assigns responsibility for correcting it, turning a description of what failed into a decision about who owns the fix.
An agent ignoring an earlier instruction illustrates the distinction. If context compaction removed the instruction, the harness is responsible for the missing information. If the instruction remained available but the model did not follow it, model-side attribution becomes a candidate. The final response alone cannot settle that distinction. Both failures look like disobedience, but only one calls for repairing how the harness preserves context.
The same logic separates harness engineering from environment or grader repair. Model-side failures call for post-training, while harness-side failures call for changes to scaffolding and tool-integration. Environment or grader faults instead reveal conditions that need redesign. Pre-log attribution uses observable patterns to nominate an interaction edge for investigation.
The three harness-layer failure patterns that account for most pre-log-diagnosable breaks
Tool schema drift, or argument rot, has an early tell. The output has values that were not in the user input even though a tool call finished without an error code. Suspicion falls on the tool contract. Missing required keys, wrong field types, invalid JSON, or truncated payloads can leave the agent without data it can use while execution goes on. Raj et al. and the AgentCheck workbench identify schema mismatch when the returned payload does not match the promised contract. Fabrication after a silent tool failure can consequently resemble a model-capability problem while originating in a broken tool interaction.
Prompt ambiguity and specification drift produce a different signal. The agent selects the wrong tool or action despite having the correct tool available. Here, routing fails before engineers need to ask how execution went. The cause could be ambiguous instructions, missing specifications, overlapping tool descriptions, or missing context. Prompt orchestration can also fail by passing variables incorrectly or supplying a plain string where JSON-formatted input is required.
Workflow loops are visible through stalled progress. The same or similar tool calls recur three or more times, the agent repeatedly edits the same artifact, or reasoning continues without advancing the task. Completion never fires even as the trajectory grows longer. These signals point to termination conditions, exit instructions, and tool statuses that do not make clear when the task is complete. Tool misuse is especially useful diagnostically because wrong-tool and wrong-argument symptoms can often narrow suspicion to prompt or schema faults before model debugging begins.
How do you pinpoint the failing layer before opening the logs?
To construct the matrix, engineers translate those signals into rows and candidate layers into columns. The rows include wrong-tool selection, unsupported output values, stalled tasks, broken output format, incorrect completed results, and refusal or empty output. The columns cover prompt/context, tool schema/contract, workflow/orchestration, memory/retrieval, and model. Each cell records a candidate mechanism and repair owner, or explicitly says “needs trace to distinguish.” These are provisional assignments.
For wrong-tool selection, the prompt/context cell lists ambiguous or overlapping tool descriptions as the first things to check. The workflow cell records an incorrect routing condition as a secondary candidate, while model suspicion remains low until trace evidence elevates it. For unsupported values, the tool-contract cell names an empty or malformed response after apparent success. The prompt cell asks whether the instructions called for grounding in tool output. Model attribution remains possible only after those contract questions are cleared.
For stalls, the workflow cell names a missing or incorrect termination condition. The prompt cell lists missing exit criteria, and the tool cell lists an unclear completion status. Broken output format instead points first toward absent, unclear, or unenforced format instructions, with an unexpected tool-payload structure as another candidate. Each entry specifies something an engineer can inspect. A label such as “tool issues” does not provide that direction.
A completed but incorrect result requires more caution. If correct tool use is already established, suspicion shifts toward memory or model behavior and the matrix hands off to trace-based root-cause analysis. Refusal or empty output also calls for a trace exit when the evidence at hand cannot tell the layers apart. Raj et al.’s taxonomy supplies 41 failure modes for building these distinctions, but the matrix need not force every symptom into a confident assignment.
Prompt versions, tool schema versions, and memory configurations need separate identities so the failing run can be compared with the last-known-good harness state. Otherwise, even accurate routing leaves engineers reconstructing what changed. The matrix identifies the candidate repair owner, while the version diff identifies the relevant change. Neither substitutes for evidence from the failing interaction.
Applying the matrix to a real failure without reading a full log
Step 1 is symptom classification before opening logs. A tool call can finish even if the agent chose the wrong tool. The matrix therefore routes the first inquiry toward planner routing in the prompt/context layer, with tool schema as a secondary candidate. The working hypothesis attributes the failure to the planner’s choice of the wrong tool.
Step 2 is targeted span inspection with that question. The engineer filters the trace to tool-selection spans and applies ToolSelectionAccuracy as a per-step evaluator. Span 3 contains the relevant prompt. A customer note, “urgent please,” overlapped with an unrelated tool’s signature and caused the planner to select that tool. The targeted query establishes the prompt-side cause without requiring a free-form reading of eight spans.
Step 3 is repair followed by validation against the affected cohort. The repair refines the planner prompt’s tool descriptions while leaving the model unchanged. Replay then runs the affected cohort against the revised prompt, and regression evaluation tests whether the failure class is resolved. The repair follows the evidence at the interaction edge. A wrong final amount has led to a planner-prompt change because the trace located the faulty decision there.
An engineer reruns the prompt, receives a correct output, and closes the incident as flaky. Because outputs are non-deterministic, that passing run does not explain the original failure or remove its cause. The same failure can resurface days later for another user. Matrix-first diagnosis avoids treating a different outcome as an explanation.
Why pre-log attribution gets harder as trajectory length grows, and what that demands of the matrix
Raj et al.’s Root-Cause Attribution Is a Search Problem describes relevant evidence as sparse and distributed across distant actions, making one-shot review unreliable. Automated LLM judges can also settle on an explanation that sounds right before looking at key evidence. A layer hypothesis remains useful under these conditions, but it cannot stand as the final diagnosis. A tool-schema suspicion should narrow inspection toward tool-call spans while leaving responsibility unresolved.
Continual Search addresses this problem by encouraging iterative searches for missing diagnostic evidence. The matrix can support that behavior through a ranked suspicion list with explicit “unresolved” tags. HPFA identifies a related difficulty in non-linear dependencies, where several earlier parallel actions can jointly contribute to a later failure. One suspicious span may therefore be insufficient. As trajectories grow more complex, the matrix must guide engineers through further checks and leave room for more than one layer to be at fault.
Replay validation as the gate that separates a confirmed fix from a guess
A proposed harness repair remains a hypothesis until it is tested against the production traces where the failure occurred. One successful rerun is not that test. Non-deterministic output can hide an unchanged failure mechanism, so validation must address the affected cohort. Validation must test whether the revised harness resolves the observed failure class.
Replay has two modes with different purposes. Live execution uses real tools and the real network for canaries, while replay mode uses tool responses that were recorded and a deterministic environment for CI gates. Both modes are needed because they test different conditions. The trace diff compares the revised harness against the failed cohort. Per-step evaluators, including ToolSelectionAccuracy, Groundedness, and ReasoningQuality, attach to the spans originally flagged by the matrix so evaluation stays aligned with the diagnosis.
Coverage alone does not make the gate dependable. Flakiness control is equally important because a replay suite that fails inconsistently trains engineers to ignore its results. A passing check must show that the repair works beyond one more run that happens to go well. The diagnostic hypothesis determines what the replay needs to test, and the trace diff shows whether the proposed change addresses it.
Making attribution a repeatable engineering discipline rather than a per-incident ritual
Failure patterns that keep coming back belong in a dataset that supports regular regression evaluations and shows when the symptom-to-layer mappings in use no longer fit. The matrix should evolve with those findings and be versioned with the harness components it describes. Review then connects a new incident to both prior failure classes and the last-known-good configuration. This prevents a matrix built from first principles from drifting away from the system engineers actually operate.
The interaction-centric taxonomy offers evidence that such categories can be reused. Raj et al. evaluated operational reproducibility with independent reasoning agents across four frontier models, with the strongest judge reaching Cohen’s κ = 0.76 against human category labels. That result supports codifying the category structure for reuse across incidents. It does not establish every individual attribution as correct. Trace evidence and replay remain necessary even when the classification framework is reproducible.
The strongest objection concerns the revision process itself. Self-generated feedback is noisy, and sequential harness changes can compound early mistakes. Production trace evidence, separate component versions, and regression evaluation answer that risk by constraining what counts as an improvement. Prompts, tools, workflows, memory, and evaluations consequently need the same review and testing rigor as other engineering work. The matrix becomes a record of testable repair assignments.
Sources
- Model or Harness? An Interaction-Centric Taxonomy for Localizing Agent Failures
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
- TRAJDEBUG: Tracing Error Lifecycle to Identify Critical Failures in Long-Horizon Agent Trajectories
- HPFA: Hypergraph-Based Paired Failure Attribution for LLM Reasoning


