Historical Trace Validation Before Shipping Agent Fixes
Replaying fixes against real failure traces catches what tests miss.

An agent fix cannot be trusted until it has been replayed against the actual production traces where the agent broke, because the failures that matter in agentic systems do not announce themselves the way ordinary software bugs do. A single bad decision early in that loop does not stay contained. It feeds forward into the next reasoning step, which feeds a wrong tool call, which feeds a wrong observation, until the final answer is wrong for reasons that have nothing to do with the step where things actually went sideways.
A plain language model fails in ways an engineer can see: the wrong output, a hallucinated fact, a refused prompt. An agent fails without raising its hand. A user files the complaint weeks later, long after the failure occurred. Paolo Perrone's 2026 piece on LLM observability platforms opens on exactly this scenario: an agent calling the wrong tool on every single request since it launched, undetected for three weeks, with no error thrown and no alert fired anywhere in the stack.
A workflow loop can look like forward progress in the logs even as it spins without resolving the task. A prompt instruction can be silently dropped from context during compaction, so the agent appears to ignore a rule it was never shown again. None of these trip an error handler. All three let an agent's trajectory drift far from the behavior it was built to produce while the final output still slides past whatever pass/fail gate sits at the end of the pipeline. That gap between what the gate checks and where the damage actually happened is the problem the rest of this piece is built around.
Why the test suite doesn't catch it

Held-out pass/fail scores and agent-generated tests share a flaw that makes them look rigorous while catching almost nothing: a test passing is not the same thing as a test being able to tell a correct trajectory from a broken one. A test that only checks "output is a string" passes on the buggy version exactly as well as it passes on the correct one, because the test was never built to see the bug. It confirms a type, not a behavior.
This is not a hypothetical edge case. The test suite said yes. The underlying behavior was never examined closely enough to deserve a yes.
A held-out evaluation set carries a second, separate weakness on top of this one: it is frozen at the moment someone built it. A prompt change that makes an agent's answers vaguer, hedging more, committing to less, can raise scores from an automated critic and pass every metric in a fixed suite, all while teaching the agent to be less useful. Nothing in a static eval set is built to catch that kind of regression, because the eval set has no memory of what good behavior looked like before the change.
The failure compounds once trajectories enter the picture. A held-out pass can register green while three separate turns inside that same trajectory drifted off policy along the way. The final-output score is blind to the path that produced it, so a team can ship a fix, watch the dashboard stay green, and still be running an agent that gets the right answer by the wrong, fragile, and eventually-breaking route. The test suite is answering a narrower question than the one the team actually needs answered, and it answers that narrower question convincingly enough to look like proof.
What production traces contain that synthetic tests don't
Production traces are the only evidence base that records what an agent actually did, step by step, under real conditions nobody could have scripted in advance. Deep agent tracing captures every sub-agent call, every tool invocation, every retrieval step as its own structured span, logging inputs, outputs, latency, and token spend at each point along the way. That gives an engineer a reconstructable path through the whole trajectory, beyond the single number at the end of it.
Standard telemetry, even good telemetry, misses the parts of a trace that make it useful for debugging rather than just useful for an audit log. A survey of evidence tracing and execution provenance in LLM agents, from Wang et al., lays out what's missing: the claims an agent generated along the way, whether evidence actually supported those claims, where contradictions appeared, where memory got invalidated, the rationale behind a given tool call, and the messages passed between agents in a multi-agent system. These are the semantic units that turn a trace from a record someone can inspect after the fact into a record someone can actually debug from.
Production traffic exposes things a fixed offline dataset structurally cannot: drift as user behavior shifts, failure modes nobody wrote a test for because nobody thought of them, and the specific patterns that appear when real users get frustrated with an agent that isn't working. None of these failure classes appear in a synthetic test, because a synthetic test is written by someone imagining what could go wrong. These bugs appear only in traces, because they only happen under the messy conditions of real use.
One signal inside production traces deserves particular attention for how early it appears: the distribution of which tools an agent reaches for, tracked week over week. A meaningful shift in that distribution, an agent suddenly favoring one tool over another it used to call more often, is detectable in the trace data before any downstream quality metric moves. That makes tool-call distribution a leading indicator rather than a lagging one, and it points directly at the kind of replay-based monitoring the next section lays out in detail.
How replay-based validation turns a trace into a test
Replaying a candidate fix against the historical traces where a failure actually happened turns a guess about whether the fix works into a measured, reproducible result, the same standard any other code change in a production system has to clear. The mechanics are not exotic: pull a fixed evaluation set from real production failures, re-run the agent loop over those exact inputs with the candidate fix applied, score the outputs against the historical human decisions or known-good outcomes already on record, and compare the result to the baseline agent running the same inputs. That comparison is what makes a prompt edit or a tool change something a team can measure, rather than something a team merely hopes helped.
Replay tells you whether a fix works only once you know which layer the fix is supposed to be working on, so root-cause localization has to come first, not as an afterthought to the replay run.
Two systems built in 2026 show what that localization step looks like in practice. AgentTrace, presented at the ICLR 2026 Workshop on Agents in the Wild: Safety, Security, and Beyond, reconstructs a causal graph from execution logs, traces backward from where an error actually manifested, and ranks candidate root causes using structural and positional signals that a human can interpret, all without needing to run another LLM inference pass at debugging time, and it localizes root causes with sub-second latency. AgentDebugX closes a similar loop through stages: Detect identifies step-level errors, Attribute locates their root causes, Recover proposes ranked fixes, and Rerun regenerates the trajectory around the failure point; hard cases escalate to a multi-round diagnosis agent that produces an auditable root-cause report. The PRISM optimizer, submitted in September 2026, takes the next step and routes the fix itself: an analyst model examines failed trajectories, clusters them by likely root cause, and sends each cluster to the repair surface that actually matches it, middleware for tool-boundary failures that are locally observable, prompt edits for failures that live at the level of global task policy.
None of this is useful without a second gate sitting right next to the first one: a fix that repairs the failure it targeted but breaks a trace that used to pass should not ship. Matched replay in procedural-memory systems enforces exactly this, admitting only changes that repair a known failure without regressing a previously observed success. The "Evidence-in-the-Loop" system embodies the conservative version of this design: production traces feed review queues and replay sets, but nothing in the system rewrites a prompt or a knowledge-base entry directly at serving time. Every change stays auditable and reversible, which is what keeps the improvement loop closing without turning into an autonomous system quietly rewriting its own policy in the background.

Where the harness breaks and where the model needs to change
Most production agent failures trace back to the harness rather than the model itself, but the same trace-based attribution that shows this also correctly flags the smaller set of failures where the model genuinely needs to change, which is what makes the method useful in both directions rather than a tool built to make one particular argument. The "Model or Harness?" paper, from Raj et al., organizes 41 distinct failure modes by assigning each one to an edge between two components in the system and a fault side: model, harness, environment, or grader. The observed behavior looks identical from outside, and an outcome-level label alone cannot tell these two apart.
A majority of the 41 failure modes catalogued in that paper turn out to be model-side. The remaining harness-side and environment-side faults still matter, because they mark bottlenecks where no amount of improvement to the model will produce a working system. A better model dropped into a harness that erases instructions during compaction is still going to ignore instructions.
Model behavior inside a long trajectory tends to run in bursts: strong, careful reasoning for a handful of steps, then a slide into premature termination, misuse of a tool, an unbounded loop, or brittle handling of an instruction that was even slightly ambiguous. The harness is what's supposed to catch that slide, the deterministic layer that enforces structure around a model that doesn't always hold its own line. That's also why harness engineering has to stay bounded: prompt edits and tool-boundary middleware work as guarded intercepts on specific points in the flow, and that narrowness is what keeps every change reviewable and reversible.
When attribution correctly points at a model-side fault, no amount of harness iteration will close the gap, but the process of getting to that conclusion doesn't change: reconstruct the causal graph, localize where the failure happened, assign it to the layer responsible. That precision is what keeps a team from retraining a model to fix something a one-line prompt edit would have solved, and it's just as valuable for stopping a team from patching a prompt over and over against a failure that will keep recurring until the model itself changes.
Making trace validation a repeatable engineering gate, not a one-off audit
Trace-based validation only pays off fully once it runs as a standing process with a fixed cadence. The loop runs in a fixed order: production traces feed a sampling process, sampling builds a replay set, replay produces a measurable diff between the candidate fix and the baseline, the diff goes through review, and an approved change ships with a rollback path sitting behind it. Every stage in that chain is something a reviewer can inspect. None of it depends on trusting a system's judgment without checking the work.
Cadence is what turns this from an audit into a gate. A weekly cron job that samples recent production traces, re-runs the agent against them in a sandbox, and compares the new outputs to the historical outputs on those same inputs catches drift while it is still small, before it compounds into a visible failure. Tool-call distribution shifts before any downstream quality score does, which makes it the signal worth watching most closely here.
Procedural memory systems show what continual improvement looks like once it's treated as an engineering discipline instead of a retraining pipeline. MACLA extracts reusable procedures directly out of trajectories, tracks how reliable each one is using Bayesian posteriors, and refines them by contrasting successful runs against failed ones. Neither system requires sending anything back through a training run to get better; both improve by working directly on the trace record.
This loop depends on the observability layer that logs structured spans beneath it. Structured spans per step, logged through OpenTelemetry-based SDKs, are the baseline requirement, and Wang et al.'s survey specifies what has to sit on top of that baseline for agent traces specifically: the claims an agent generated, whether evidence actually backed those claims, contradictions between steps, memory invalidation events, which tool arguments influenced which outcomes, and where responsibility sits in a multi-agent exchange.
Every change this loop produces needs to stay inspectable. Automated repair systems should hand a reviewer a diff to read and approve. The "Evidence-in-the-Loop" design, which routes every proposed improvement through a review queue before it touches a prompt or a knowledge-base entry, is the right shape for this in a production system.
The research base behind all of this is young and moving fast, with most of it published within the last year or so. A 2026 survey collected a large body of papers on LLM agent trajectory analysis for failure attribution, nearly all of it published between early 2025 and April 2026, marking a research direction that only started to take shape in 2025, even as related work on agent observability and provenance goes back further. A team that builds trace-based validation into its release process now is working ahead of where most of the field currently sits.
Sources
- Evidence-in-the-Loop: Trace-Driven Optimization for Customer-Service LLM Agents
- From Agent Traces to Trust: A Survey of Evidence Tracing and Execution Provenance in LLM Agents
- Published at ICLR 2026 Workshop on Agents in the Wild ZERODAYBENCH:
- Validation Evidence in LLM Repair Agents: How Much of What Passes Actually Tests the Bug?
- From Agent Traces to Trust: Evidence Tracing and Execution Provenance in LLM Agents
- When Errors Become Narratives: A Longitudinal Taxonomy of Silent Failures in a Production LLM Agent Runtime
- Chronicle: Cut-Point Replay for Regression Testing of LLM Agents
- portal.fis.tum.de


