From Trace Analysis to Shipped Fix Without Regressing Passing Evals
Attribution, harness changes, and replay together keep fixes from breaking passing evals.

To get from trace analysis to a shipped fix without regressing passing evals, root-cause attribution, a harness change that can be reviewed, and replay validation must be part of the same process. Production failures then become regression cases, so each repair strengthens the evidence available for the next release. This is a compounding improvement loop from production agent observability.
Why the gap between detecting a failure and fixing it safely is widening
An engineer can read a failed trace, identify the last unsuccessful tool call, and still not know what to change. The visible error may be several causal stages downstream from the decision that caused it. TelemetrySuffBench separates failure detection from fault-origin localization and finds a robust gap even when telemetry is rich.
AgentDebugX frames the missing work as determining which earlier decision made the run unsuccessful, explaining why it was decisive, and translating that diagnosis into a testable correction. Replaying the execution alone does not do that work. Shipping when the symptom disappears leaves two risks unresolved, namely changing the wrong layer and repairing the failing case while breaking a passing one.
Why root-cause attribution is harder than reading a trace
A trace records execution order, but execution order alone does not establish causation. A model can select the wrong symbolic reference, a registry can bind it to a concrete object, and a later component can activate that object correctly. The intermediate steps all appear to work. The fault lies in the selection. Attribution must follow that dependency backward from the first visible error.
With multi-agent execution, that dependency is harder to follow. CoLFA names two structural obstacles, Interleaved Steps and Cluttered Content. Steps from different agents appear together chronologically, while diagnostic evidence is mixed with reasoning, actions, and environment feedback. Relevant content may also be repeated, paraphrased, or modified as it moves between agents. TelemetrySuffBench finds that when decision content is removed, origin-step accuracy falls to zero for every model tested, while removing provenance causes large losses that vary by model.
A stronger model alone does not solve this. Scale AI's RCA research describes attribution as a search through competing explanations, with contradictory evidence used to eliminate candidates. Models given long traces can settle too early on a plausible explanation and leave decisive evidence unexamined. Its Continual Search work shows that lower-tier models using iterative search can surpass higher-tier models within the same family.
The three failure categories engineers actually encounter in production
Tool schema drift occurs when an external API adds a required field or deprecates an endpoint while the agent continues using the old signature. A call that looked correct in testing then fails in production. The mismatch is in the tool contract. CI-side schema snapshot testing addresses this exposure by recording tool schemas, diffing them on each run, and failing on breaking changes before production encounters them.
Prompt ambiguity can also lead to failure. A template update can replace a structured instruction with a free-form variant, allowing degradation to propagate through downstream steps before an end-to-end failure becomes visible. The altered instruction is the relevant fix surface. AgentEval flagged this degradation in a CS-Agent case, allowing the team to revert within hours before it propagated further.
Workflow loops arise when invalid tool arguments produce an error, after which the agent repeats the call or silently fabricates a result. Plausible output can conceal an unsuccessful execution. Runaway loops are a distinct sub-case, with the agent calling itself or a tool using minor variations without converging. These runs can exhaust budgets without an obvious error signal. Across all three categories, the shared repair surface is the harness, including prompts, tool definitions, and workflow logic.
What harness engineering actually means as a fix discipline
Correcting one failed output leaves the mechanism available to fail again. Harness engineering changes the system around the model so that the mistake cannot recur quietly. Mitchell Hashimoto described this practice in a 2026 post on adopting AI coding agents. His framing was to turn an agent mistake into a lasting fix in an instruction file or programmed tool. The unit of repair is the operating system around the agent's decisions.
Prompt engineering crafts instructions, while context engineering controls what enters the context window and when. Harness engineering includes both within the full application and infrastructure, covering tools, the planning loop, memory, orchestration, and serving. Guides such as agent instruction files, system prompts, and tool definitions act as feedforward controls before an action. Sensors such as linters, tests, hooks, and evals provide feedback afterward.
A durable change can therefore take several concrete forms. It might add an instruction, block a class of tool call through a hook, deny a command, or introduce a test or eval criterion. The choice follows the attributed failure mechanism. Structured logging of model invocations, tool calls, memory reads and writes, and decision branches makes those mechanisms inspectable. That observability makes the harness learnable, but only validation can establish whether a proposed change holds.
How replay validation closes the loop between a fix and a safe ship decision
Replay tests a harness change against the recorded execution that exposed the failure. User messages, tool calls, and tool responses become fixtures, and the replay engine supplies the same recorded responses without making new live API calls. The fixed environment isolates the agent's changed behavior from environmental variation.
ReplayRCA evaluates diagnoses by restoring the environment to the state before a chosen step, substituting a proposed action, and letting the original agent continue. It then subtracts a paired placebo's continuation success rate from the intervention's success rate. The placebo replays the original action through the same mechanism. Without that control, a repair receives credit for recoveries the agent would have made anyway, making naive rerun success an unreliable ship gate.
Concrete implementations make different parts of this comparison inspectable. pytest-agentreplay provides record-and-replay deterministic testing with step-by-step trajectory diffs, stopping execution at a divergence caused by changed agent behavior. AgentDebugX applies a correction from an appropriate checkpoint and retains both original and repaired branches for comparison. The before-and-after evidence remains available for review. Even with a changed trajectory or a successful repaired branch, the cases that passed before still need to be tested.
Golden task tiers named smoke, core, and torture establish that broader baseline around real failure modes, including wrong tool choices, unsafe actions, and retry loops. A stable artifact schema supports comparison with a last-known-good baseline through pass-rate deltas and newly failing assertions. The CI gate runs the full replay regression suite on every pull request. Production failures are then added to the dataset as regression cases, so the gate protects more of the agent's behavior.
Why the full loop — attribution, fix generation, and replay validation — must be treated as a single connected process
The handoffs between stages are themselves a source of risk. Attribution can identify the correct origin, yet an opaque correction can prevent an engineer from auditing how the proposed change addresses it. A plausible correction can pass the broken case while introducing an untested regression elsewhere. Conversely, rigorous validation of a symptom-level patch can leave the original failure mechanism intact. Each stage needs evidence from the preceding stage.
AgentDebugX makes that dependency explicit through Detect, Attribute, Recover, and Rerun. When a rerun fails, its new trajectory returns to the same loop. AgentEval demonstrates the complementary role of regression evaluation. It distinguishes benign prompt rephrasing from degradation caused by single-step tool deprecation, but that protection exists only when the evaluation runs. Checking by hand cannot make up for skipping the regression gate.
Costs must be compared at the same level of confidence. End-to-end evaluation without trace-grounded golden cases needs 4 times more test cases to reach the same statistical power. Informal validation is therefore not necessarily the cheaper route. A broken loop also adds costs after the current release, as teams diagnose the same mechanism again, lose track of what changes did, and lose passing behaviors without warning.
How do teams use production agent traces to keep improving behavior?
Production traffic supplies the next iteration's evidence after the first fix ships. Evaluators score traces against criteria defined by the team, and new failure patterns become new criteria and golden cases. The regression suite accumulates operational knowledge over time. Each proposed change is tested against failures seen before as well as the narrow case that led to the latest edit. In this sense, continual learning means improving the harness without necessarily changing model weights.
A failed tool call can trigger a memory write recording its context, while repeated failures can flag a skill for revision. A latency spike can cause the harness to switch protocol paths. These responses depend on signals the system actually records.
The same iterative principle applies to diagnosis itself. Continual Search improves attribution by prompting an agentic LLM judge over successive turns to examine unresolved or previously overlooked evidence. It does better across benchmark suites and model families, including on long-horizon traces where single-pass approaches stall. The loop improves both the agent's behavior and the investigation that guides changes to it.
Retraining remains a separate lever. For tool drift, prompt ambiguity, and workflow loops, harness iteration is the first intervention because it directly changes the responsible interface, instruction, or control logic. The TaoLive harness-based agent approach keeps a policy model that is updated slowly separate from harness state that changes quickly. A new skill or tool can consequently be deployed as a harness change. The governing discipline is repeatable engineering, with each adaptation subject to evidence and regression testing.
What a rigorous trace-to-fix workflow looks like in practice

For an engineering team, the preceding evidence translates into five ordered steps. The first is to instrument the harness with decision content and provenance alongside terminal errors. Structured records should cover every model invocation, tool call, memory read and write, and decision branch, linking actions to their causal antecedents. Aggregate step counts, token consumption, error rates, and latency distributions show how the system is running overall. The record must support diagnosis.
The second step is to attribute the failure to its origin step and responsible layer. The diagnostic pass should test competing explanations iteratively, following evidence across distant actions. Contradictions should change the diagnosis before the harness changes. This is especially important in long traces, where the decisive evidence may be sparse and far removed from the visible failure.
The third step is to generate a reviewable harness diff specific to that layer. A prompt defect calls for a prompt change, while a tool schema or workflow defect requires a correction at that surface. Memory and skills are also valid repair targets when attribution points to them. The diff exposes exactly what will behave differently. That reviewable connection between diagnosis and change is what a black-box edit removes.
The fourth step is to run the full replay regression suite against the candidate, including the new failure trace. AgentEval reports 94% recall for regression detection, which supports using trace-grounded evaluation to tell changes that do no harm from those that cause degradation. Coverage still depends on the golden cases behind the gate. Every production failure added to the suite expands the behaviors that future changes must preserve.
The fifth step is promotion only when the broken case passes and no previously passing case regresses. If the rerun remains unsuccessful, its trajectory returns to attribution within the same investigation. After deployment, production traces continue supplying new cases. This is code review and regression testing applied to the harness layer, replacing one-off agent patches with versioned changes whose behavior is tested before release.
Sources
- TelemetrySuffBench: Is Agent Telemetry Sufficient for Failure-Origin Diagnosis?
- AgentDebugX: An Open-Source Toolkit for Failure Observability, Attribution, and Recovery in LLM Agents
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
- ReplayRCA: Measuring Post-hoc Diagnosis and Live Oversight of Agent Failures by Counterfactual Replay
- CoLFA: Collaboration-Guided Lightweight Failure Attribution for LLM-Based Multi-Agent Systems


