Side-by-Side Behavioral Diffing of Agent Runs Against Frozen Production Baselines
Replaying frozen production traces catches agent regressions before release.

To validate agent changes before deployment, replay historical production conversations through the candidate pipeline and compare their full execution traces against a frozen, known-good baseline. Side-by-side behavioral diffing measures tool use, schema conformance, cost and latency, and output structure. Behavioral consistency is the stronger correctness signal, but release validation also requires known-correct outcomes because agents can be consistently wrong.
Why behavioral consistency is a stronger correctness signal than output inspection
Identical inputs do not reliably produce identical agent behavior. Mehta et al. (2026) measured 2.3–4.2 distinct action sequences per run set across agents that interleave reasoning and action. Tasks with consistent behavior had much higher accuracy than those with inconsistent behavior, even after accounting for how hard the tasks were. A successful individual run therefore leaves an important question unanswered. It does not establish whether the agent will follow a reliable path when the same request returns.
The same study found that behavioral agreement outperformed verbalized self-confidence as a failure detector across Claude, GPT-5, and Llama. Behavioral agreement achieved AUROC 0.65–0.74, compared with 0.48–0.55 for self-confidence, and combining the signals did not improve on agreement alone. Confidence added no useful discrimination in that comparison. The stronger signal came from running the tasks again, without prompt engineering, log-probs, or model modification.
Yagubyan (2026) found a more specific pattern in structured tool-calling agents, described as “structural consistency, parametric variance”. Agents reliably chose the same tools in the same order, but the arguments they used varied widely. Tool Sequence Similarity, or TSS, predicted whether a task would succeed, while argument-level variance did not. Not all differences deserve the same weight. Most divergence originated in the first two pipeline steps, making early behavior more informative than inspection of the final answer alone.
What a frozen production baseline actually captures and why "production" is the right source
A frozen production baseline gives that consistency signal a reference that lasts. It is a structured file or datastore containing real agent behavior from a period of known-good operation. Its schema keeps a record of every model invocation, tool call, memory read and write, and decision branch. The sequence alone is insufficient for causal diagnosis. The record also needs the links between reasoning steps, tool calls, returned results, and subsequent actions, including captured reasoning traces.
The real input distribution, tool schemas, and failure modes come from production. An evaluation stack can assemble a different context at request time from the serving stack, allowing its results to diverge silently from live behavior. Staging also cannot reproduce the input drift that accumulates in live traffic. Mehta et al. found that single-run evaluations misranked models 29.3% of the time, reinforcing the need for a reference grounded in repeated behavior.
The freeze decision consequently needs a quality gate. A period with high error rates would preserve the wrong behavior, however complete its traces. A period with high tool-sequence agreement and acceptable correctness rates is a sound choice. The artifact then preserves tool-call sequences, argument schemas, step counts, routing paths, memory access patterns, and output structure. Exact natural-language wording is not the reference target because Yagubyan found that outputs almost never matched exactly even when tool sequences were identical.
The five harness surfaces that must be versioned alongside the baseline
The harness is the dominant source of drift, encompassing prompts, tool schemas, memory and skills, workflow routing, and evaluation configuration. Without versions of these five surfaces, a trace difference can look like a model-side change even when the surrounding system caused it. Attribution needs both the behavior and its operating context. Freezing one without the other leaves the comparison incomplete.
A silent edit through a prompt-management UI can bypass an evaluation harness pinned to the main branch’s prompt file. Three weeks later, a regression may be investigated against a prompt that no longer exists in production. Tool schemas create a similar gap outside the application. An external API can add a required field or deprecate an endpoint while evaluation continues against its old schema snapshot. CI-side schema snapshot testing records schemas, diffs each run, and fails on breaking changes.
Memory and routing can change behavior even when the prompt stays the same. A memory population policy changes the task-relevant content supplied to the agent core, including information derived from skills and protocols. Routing changes determine which sub-agent or tool path handles a request, so an unrecorded routing change makes a structural difference hard to interpret. Evaluation configuration is itself another moving part. Its loaded resources, context assembly, and graders need versions that are as precise as those for application code.
Versioning all five surfaces creates operational work, but omitting it transfers that work into diagnosis. Prompt versioning and schema snapshot testing are lightweight compared with investigating divergence without knowing what changed. The requirement is enough historical state to distinguish a changed instruction from a changed interface, memory policy, route, or evaluator.
Behavioral drift as a compounding process, not a one-time event
Harness changes accumulate across deployments, while agent behavior can also degrade over extended interactions. Rath (2026) introduced an Agent Stability Index and demonstrated measurable degradation in multi-agent LLM systems. The progression can be subtle before it becomes harmful. A customer support agent may begin with appropriate responses, then become more casual, hallucinate product features, or volunteer withheld information. A deployment-time result does not describe that later trajectory.
Bhardwaj (2026) showed that agents enforced against formal behavioral specifications detected soft violations that uncontracted baselines missed. The Drift Bounds Theorem states that contracts with recovery rate exceeding natural drift rate, γ > α, bound drift to D* = α/γ in expectation. The reference makes the deviation measurable and recovery meaningful. A frozen trace baseline supplies a behavioral reference against which change can be detected.
That distinction explains why freezing is only the beginning. Tool schema changes, input distribution shifts, and harness edits continue to create divergence after a pre-deployment comparison has passed. Their effects can accumulate between releases or within extended sessions. The practical consequence is scheduled replay against the frozen reference. Continuous maintenance preserves the reference’s usefulness without treating every new production behavior as automatically acceptable.
How to run a behavioral diff: dimensions, replay mechanics, and what to measure
For practitioners, the workflow begins with capture and curation. A useful replay set contains roughly 50–500 production traces with expected outputs or rubric scores, selected from known-good operation. Scheduled replay runs those inputs through the current production pipeline in a sandbox and compares the resulting traces with their frozen counterparts. A cron-based process can sample recent production traces for this workflow. Comparisons must use the same inputs on both sides, so input differences do not masquerade as behavioral changes.
The first dimension is tool-call distribution, including tool selection, order, and frequency. An engineer sees whether the current trajectory follows the reference sequence or selects a different path. Yagubyan’s analysis found task correctness of 90.2% under high-TSS conditions, supporting TSS as a useful structural measure. Schema conformance asks a separate question. It compares tool arguments with the schema recorded at baseline, revealing cases where tool selection remains stable but argument construction or the external interface has changed.
Cost and latency expose differences that a successful answer can conceal. Step count, token usage, and wall-clock time show whether the current run repeats work or follows a deeper route. Repeated calls with elevated step counts suggest a loop. Output-content comparison then checks the format, which fields are present, and the length. It does not demand exact wording, because natural-language exact matches would obscure the structural signal with harmless variation.
Replay mechanics must also distinguish model variance from integration behavior. For integration tests, a fixed LLM response sequence from a known-good trace can drive the real tool chain. This isolates tool integration behavior from fresh model choices. Breakpoint-style inspection and deterministic re-execution of failed trajectories support investigation of the exact failing case. Without that replay capability, a detected difference may be difficult to reproduce closely enough to diagnose.
Production-side canaries cover a different blind spot. They issue synthetic requests continuously to the production endpoint and score responses with the same graders used by the evaluation harness. If evaluation passes while the production canary fails, the discrepancy identifies eval-prod drift. For example, evaluation may still use a frozen schema after an external API changes and production tool-call success drops.
Reading divergence as a layered diagnostic, not a pass/fail verdict
A diff identifies a discrepancy. Root-cause attribution is a search through the full trajectory, testing explanations and rejecting them as contradictory evidence appears. Tool-call divergence may implicate a prompt or routing rule, but it does not establish either explanation alone. The responsible layer must be supported by the trace. Four common types of failure give that search a place to start.
Tool schema drift often leaves tool selection intact. The agent calls the expected tools in the expected order, but schema-conformance checks fail because its arguments no longer match the interface. Workflow loops produce a different combination of signals. Step counts and latency rise while the tool-call distribution shows repeated calls to the same tool. Ambiguous tool return schemas can cause this pattern when the agent cannot interpret a result as a termination signal.
Prompt ambiguity can likewise preserve tool order while disrupting arguments. A drop in argument consistency, measured by AC, with stable TSS points toward instruction interpretation. Yagubyan’s finding that argument variance alone did not predict task success makes schema evidence and task outcomes necessary context. Otherwise, harmless parameter variation could be mistaken for a regression.
Early diagnosis collapse occurs when attribution settles on a plausible explanation before examining the trace’s remaining evidence. A failure visible at the end may originate much earlier. Mehta et al. found divergence concentrated at step 2 in 50.5% of Llama tasks, illustrating why step-level agreement is useful for locating the initial split. Longer traces make premature conclusions especially costly. Full-session capture is needed because failures grow through causal chains that span calls.
Structural and multi-turn methods support this discipline. Hypergraph-based Paired Failure Attribution, presented at COLM 2026, compares hyperedges in targeted trajectories. AgentDebugX (2026) centers on DeepDebug, a multi-turn diagnostic agent for failures that resist a single trace reading. Its typed diagnoses spell out the root cause, evidence, confidence, and fix. These approaches reinforce the same requirement to name the responsible layer before changing the most visible symptom.
How to validate agent changes against production traces before shipping
Once attribution supports a candidate fix, validation returns to the same curated trace set. The candidate runs against the frozen baseline across all four dimensions, with improvement required on the failing dimension and no regression on the passing ones. A prompt edit may fix the reported failure while changing tool selection elsewhere, and a routing fix may add needless steps to trajectories that worked well before.
Past conversations have the edge cases and input distribution needed for these checks. Synthetic inputs alone cannot reproduce the production conditions that generated a failure, even when they describe a similar task. Mehta et al. identified consistently wrong tasks that behavioral agreement could not detect. A baseline with known-correct outputs is needed to check that the behavior being kept is correct as well as stable.
Validated changes also need to be reviewable before release. A prompt, tool schema, or routing rule should have an inspectable diff, a reviewer, and a trace-backed rationale. After a validated fix ships, its corrected behavior can become the new baseline. That promotion repeats the quality gate rather than accepting current behavior merely because it is current.
Continual improvement follows from repeating this loop. A-Evolve by Lin et al. (2026) and Continual Harness by Karten et al. (2026) demonstrate harness mutation from batch trajectory reading, while SkillOS by Ouyang et al. (2026) extends improvement to reusable skill curation from live traffic. Capture, freeze, diff, attribute, fix, validate, and freeze again form the feedback mechanism that makes harness engineering rigorous and repeatable.
Sources
- When Agents Disagree With Themselves: Behavioral Consistency as an Uncertainty Signal for LLM Agents
- How Consistent Are LLM Agents? Measuring Behavioral Reproducibility in Multi-Step Tool-Calling Pipelines
- Agent Behavioral Contracts: Formal Specification and ...
- Agent Behavioral Contracts: Formal Specification andRuntime Enforcement for Reliable Autonomous AI Agents
- When Agents Disagree With Themselves: Behavioral Consistency as an Uncertainty Signal for LLM Agents
- Quantifying Behavioral Degradation in Multi-Agent LLM ...
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
- AgentDebugX: An Open-Source Toolkit for Failure Observability, Attribution, and Recovery in LLM Agents


