Validating Multi-Step Workflow Changes Across Full Production Trace Trajectories
Replay real production traces to catch regressions early.

Validating multi-step workflow changes requires replaying the modified agent against full production trace trajectories. The method is to capture real execution paths, curate a versioned dataset, replay the proposed change, score each evaluation dimension, and block regressions before deployment. A fix is ready to ship only when it holds across affected trace classes, rather than merely repairing the example that exposed it.
Why per-step accuracy misleads teams running multi-step agents in production
An agent can look healthy on a dashboard while most runs contain at least one failed step. Latency and token counts describe execution cost, but neither establishes whether the task was completed. Step accuracy leaves another gap. Each output becomes context for later decisions, so an error can alter the execution path rather than remain confined to the step where it began.
Doughty’s production analysis states, “The effect is measurable at three or four steps and operationally significant by five, and most production agent workflows involve more than five steps”. A high per-step success rate therefore does not establish dependable workflow completion. An agent may produce a correct answer through a defective path, passing the evaluation without demonstrating that the path will work reliably on another run.
Cursor’s customer support agent fabricated a device login policy in April 2025 because it lacked grounding in an authoritative policy source. Staging tests used a complete knowledge base, so they never exercised the empty-retrieval case. The fabricated explanation then propagated through downstream steps unchanged. The missing evidence was upstream of the answer. Inspecting retrieval and its consequences would have exposed a defect that a coherent final response could conceal.
Three failure patterns that pass a final-output check and how they propagate
Empty retrieval is the first pattern. When retrieval returns nothing useful, the model fills the gap from prior knowledge, and later steps inherit an unsupported premise. The final answer can remain coherent because those steps preserve the fabrication. Output scoring misses the failure when it rewards plausibility without examining whether retrieval supplied the evidence.
Tool schema drift creates a different break. A tool that previously returned a plain integer now returns a formatted string, corrupting downstream outputs without necessarily raising an exception. Doughty’s analysis also identifies tool-selection drift and malformed arguments as a major failure pattern. An output-only check can miss the interface defect when the model partially compensates for it later in the chain.
Workflow loops are the third pattern. An agent encounters an obstacle, fails to resolve it, and executes the same step again, increasing token cost while response quality falls. Customer support and voice agents are especially at risk because the conversation context grows with each retry. A final-response check does not reveal the repeated attempts that preceded the answer, even when those attempts made the interaction costly or ineffective.
Why the full execution trajectory is the right unit of evaluation
A trajectory preserves the ordered sequence of system prompt, user input, agent reasoning, tool calls and returns, retrieval results, intermediate LLM calls, final response, and outcome metadata. Order is essential to diagnosis. A misclassification at step two can shape the retrieval query at step three, the tool call at step four, and the answer at step five.
That changes the evaluation dataset from input-output pairs into a JSONL of trajectories. Each row contains the user goal, system prompt version, expected tool sequence, realised calls with arguments and returns, intermediate reasoning, final response, and outcome label. The record preserves both intent and execution. It allows evaluation to distinguish a successful task from a plausible answer reached through an invalid sequence.
Scoring must preserve distinctions within that record as well. A high tool-selection score must not hide weak argument extraction, because the chosen tool can still carry out the wrong request. Per-dimension thresholds prevent that compensation within an aggregate score. Zhang’s May 2026 orchestration-traces paper extends the same principle to multi-agent systems, using a temporal interaction graph of spawning, delegation, communication, tool use, return, aggregation, and stopping decisions as the evaluation unit.
How do you test agent changes against real production traffic before deploying?
Replay evaluates a modified harness against execution paths that real users already triggered. It is not simply another agent run. Replay begins with a versioned dataset of production trajectories, stratified by tool, argument-edge-case bucket, and error code. Those distinctions give the replay suite a structure tied to actual execution failures.
The dataset also needs deliberate sampling. Scoring every production trace is wasteful, while a sample dominated by simple requests can underexpose the workflows most likely to break. Complex multi-step interactions should therefore be over-represented even when they account for a minority of traffic. Failing production traces need regular promotion into the dataset so that replay tests more than the problems known when the suite was first assembled.
Execution coverage is the next requirement. Replay must retain the upstream context that shaped the first affected step and cover the path from that step through terminal output. Checking only the operation directly edited cannot establish what later decisions do with its changed result. A prompt edit, for example, needs to be tested against the historical trajectories it affects as well as scored on the prompt’s immediate response.
Finally, replay needs explicit scoring and enforcement. Per-dimension thresholds make failure detection mechanical, while a scheduled replay of the golden set on every deploy and score tracking over time expose drift. Together, versioning, sampling, path coverage, and scoring turn production traces into a repeatable validation method.
Root cause attribution during replay — finding which layer caused the trajectory to break
A failed replay identifies a broken execution path whose cause still requires investigation. The failing step and the causal step can differ. Evidence may be sparse, distributed across distant actions, or disconnected from the visible error. Attribution therefore works backward through the trace, from the incorrect result or failed tool call to the earlier decision that made it possible.
The relevant distinction is between a model defect and a defect in the harness around it. The harness includes prompts, tool definitions, control flow, memory and retrieval systems, and context management. An apparently defective tool call may originate in retrieval or planning. Likewise, an unclear prompt can cause silent errors that look like an interface problem, so a model upgrade or a broad harness rewrite would be the wrong fix.
Motorway, working with AWS, built a production evaluation pipeline in July 2026 that tracked tool selection accuracy, task completion rate, and query correctness separately. That separation supports attribution. Correct tool selection with an incorrect query points to a different defect from failure to select the right tool at all. An aggregate score would blur the distinction that makes a targeted fix possible.
Multi-agent replay extends this problem across delegated work. Credit assigned only to an individual agent can attach the failure signal to the wrong unit of interaction. Zhang’s paper identifies explicit counterfactual message-level credit as especially sparse in current practice. The orchestration trace provides the structure for examining those interactions, although preserving the graph does not by itself resolve attribution.
Validating that a proposed fix holds across the full trajectory before shipping
Repairing the broken trace is necessary but insufficient. The same change may resolve the original error while disrupting another step or a different class of execution. Validation must thus follow the full path of every trace class in the dataset that the change affects.
A golden set can itself become an overfitting target. Prompt rewrites can fix one failure mode and introduce another, while tool additions can improve an evaluation score yet degrade the conversation. Repeated optimization against a held-out set can also weaken its value as independent evidence. Testing more trajectories shows whether a local improvement depends on the examples that led to the fix.
Motorway’s dealer stock search agent gave wrong results roughly one query in eight before trajectory-level evaluation. Its separate metrics made the fix verifiable rather than allowing success on one axis to obscure failure on another. That is the distinction between improvement and evidence of improvement. The relevant comparison preserves each scoring dimension across the before-and-after execution paths.
The shipping gate should enforce that comparison. Per-dimension assertions should exit non-zero on the failing axis and block deployment when a trajectory score regresses on any dimension. The proposed change must also remain reviewable by the engineer responsible for shipping it. A defensible release decision connects an inspectable edit to the historical traces that support it.
Building the trajectory dataset that makes ongoing replay tractable
A replay dataset loses relevance when production moves beyond the failures it contains. A golden set that stays the same has too many examples of known defects and too few of new ones. Maintaining it is routine engineering work. The practical discipline is to begin with golden traces from production and expand them through a weekly review that promotes new failures into the suite.
The dataset should be stratified by tool, argument-edge-case bucket, and error code alongside user intent. Intent describes what a user wanted, but it does not reliably identify the interface or argument condition that broke execution. Those technical distinctions keep the dataset useful for diagnosis. They also give new failures a place in the suite without collapsing different causes into one broad task category.
Live sampling finds new cases to consider for the dataset. Automated scoring should keep running on sampled interactions, and every escalation, retry storm, and negative-feedback interaction should be scored whatever the sampling rate. Complex multi-step traffic should keep a larger share of the golden set than it has in production. Its lower volume does not reduce its value as evidence about propagation across an execution path.
The scoring vocabulary must remain consistent from offline rubric to live failure cluster, dataset entry, and optimization objective. Otherwise, a CI pass and a production failure may describe the same behavior under incompatible definitions. A stable schema matters just as much for multi-agent and protocol-based tool ecosystems. Zhang’s paper includes a minimal JSON schema for replayable orchestration traces, treating a stable representation as a prerequisite for systematic replay.
Harness iteration as the engineering discipline that trajectory replay enables
A recurring failure is not automatically a reason to rewrite a prompt or replace a model. Prompts, tools, control flow, retrieval, memory, and context management are all available intervention points without changing the model itself. Attribution determines which of those surfaces deserves attention, while replay tests the consequences of changing it.
The evaluator and handoff design belong in that engineering loop as well. If the rubric rewards a plausible response but ignores task completion, prompt iteration optimizes toward an incomplete target. If evaluation stops before a delegated result is aggregated, it cannot judge the full workflow. Systematic replay makes those boundaries explicit and exposes where the validation method itself needs revision.
The SyntheticAgentTraceQA paper provides a related execution-first principle at training time. Building valid traces before synthesizing tasks improves how tools run and how closely the results match the reference traces. Deployment validation applies the same priority to a different decision. The evidence comes from execution paths, rather than from an answer that merely resembles success.
New production failures bring the dataset up to date, each deploy triggers golden-set replay, and scores tracked over time show whether behavior is drifting. Engineers can then connect a proposed edit to its diagnosed cause and inspect its effects across affected trajectories. That connection makes the release decision auditable before users encounter the change.
Sources
- Execution-First Synthetic Tool-Use Trace Generation for LLM Agents
- Reinforcement Learning for LLM-based Multi-Agent Systems through Orchestration Traces
- Skill-Guided Mining and Compilation of LLM Agent Traces ...
- Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures


