Production Learning Review

Routing Production Failures Into Regression Test Suites

Production traces expose where agents really break, so each failure becomes a test.

· 9 min read · Updated
Cover illustration for “Routing Production Failures Into Regression Test Suites”
Feedback Loop Architecture · September 30, 2026 · 9 min read · 1,948 words

Production agents fail in ways that controlled evaluation never surfaces: ambiguous user requests, flaky third-party APIs, rate limits, unexpected data formats, and adversarial inputs that no benchmark anticipates. The AI Agent Evaluation Guide 2026 names this gap between lab benchmark scores and real-world deployment performance as the central problem in agent evaluation today, and it quantifies the gap at 37%, driven by benchmarks that rely on clean inputs, predictable tool responses, and controlled environments. An agent can also reach the right final answer through a broken process, hallucinating a tool call that happened to return something useful, retrying a failed step many times over, or calling an expensive API when it didn't need to, and a single-turn score will still mark that run a pass. Confident AI's agent evaluation guide describes the deeper issue: errors compound across steps, runs stretch out over long autonomous sequences, trajectories are non-deterministic, and failures scatter across many components, so an end-to-end score reveals that something broke without revealing which component broke it. Platforms that ingest production traces directly, Moda among them, can surface these real-world failure patterns, the ambiguous requests, the flaky APIs, the rate limits, the unexpected data formats, and treat them as the ground truth for building regression cases, closing a gap that benchmarks alone cannot close. Production failures, captured as they actually occurred, are the raw material the rest of this discipline is built from.

The five failure categories production agents encounter

Agent failures in production do not form an endless, shifting catalogue. They collapse into five tractable categories: planning errors, tool errors, retrieval errors, reasoning errors, and safety or policy violations, and each category carries its own fix workflow. FutureAGI's 2026 failure modes analysis establishes this five-category taxonomy and notes that every longer, more granular catalogue a team might build ultimately reduces to one of these five. Three sub-categories within that taxonomy deserve particular attention, because they turn out to be the most common sources of regression cases in practice. Tool schema drift is one: the tool returns data that doesn't conform to the contract the agent was promised, wrong field types, missing required keys, invalid JSON, payloads cut short. Workflow loops are another, and they show a recognizable signature: the same tool firing with similar arguments more than three times in a single trace. A longitudinal study of a personal-assistant agent runtime documented this kind of repetition directly, recording multiple incidents over an eight-week window in which a single meta-pattern, a failure whose error signal never reached a human in any actionable form, manifested at least 28 times across scheduled jobs, LLM providers, and unit tests. Each category points to a different layer of the harness where the eventual fix will live, which is the question the next two sections take up directly.

Attributing a Failure to Its Layer

Detecting that an agent run failed is far simpler than finding which component caused the failure, and without that layer-level attribution, you can't turn a captured failure into a targeted test or fix it with a targeted fix. Recent research on failure attribution from logs alone puts a number on how hard this problem actually is: state-of-the-art models achieve only 14.2% step-level accuracy when asked to attribute failure causes from logs with no other context. An outcome-level signal tells a team that an execution failed, but it offers little insight into the mechanism behind the failure or where in the system to intervene. Root-cause attribution is better understood as a search problem: it means finding the first point where execution diverges from a correct run, then assigning the fault to the responsible component, whether that's the model, the harness, the environment, or the grader. That assignment matters because it determines what happens next. A model failure informs post-training objectives. A harness failure guides harness design, covering prompts, tool schemas, workflows, and memory. An environment or grader issue triggers a repair to the benchmark itself, not the agent.

AgentDebugX, released in July 2026, demonstrates a closed debugging loop built around two top-level stages, Diagnose and Rerun, that operationalizes this distinction in practice. Within Diagnose, a Detect step identifies step-level errors, an Attribute step locates their root causes, and a Recover step proposes ranked fixes, after which Rerun regenerates the trajectory around the point of failure. Harder cases escalate to DeepDebug, a multi-round diagnosis agent that produces an auditable root-cause report complete with evidence and a recommended fix, and it outperforms single-pass baselines on the Who&When benchmark. When production-trace-driven platforms build in automated attribution, they can cut down the manual labor of pinpointing which layer caused a given failure, so teams can write layer-specific assertions into a regression suite instead of leaving failures as opaque, uncategorized events. Trajectory-based failure attribution is a young field by any measure: serious research on the problem only began in 2025, and in the short span since then, 55 relevant papers had already been collected, a pace that signals how quickly practitioners have recognized attribution as the missing link between observability and action.

Harness Layers as the Origin of Most Production Failures

Most production agent failures trace back not to the model's weights but to the execution environment surrounding it, the prompts, tool schemas, workflow controllers, and memory interfaces that make up the harness. Harness engineering is the primary surface for turning observed failure patterns into durable fixes. Atlan's analysis of harness failures and anti-patterns shows that data-layer failures, including stale context, schema drift the system fails to catch, and selection of uncertified tables, cause 55% of harness failures, and they're the most dangerous of the group because they fail silently, producing no exception even as output quality degrades. Execution failures, tool bloat and schema drift in tool calls among them, account for roughly a quarter of the remainder. A persistent runtime harness carries out four distinct functions, and each one is its own failure surface: an interface that converts raw inputs, a memory layer that stores interaction records and reusable guidance, a capability registry that describes available tools, APIs, and skills, and a router or workflow controller that assembles the execution context for each step.

Research on harness engineering treats these layers as explicit, addressable targets, not an undifferentiated black box. HarnessFix, a 2026 piece of work on harness repair, positions that repair as operating on the execution layer, meaning prompt templates, tool invocation policy, retry behavior, and state management, placing it downstream of prompt engineering and upstream of full model retraining. Because of that position in the stack, harness repair is the highest-leverage point for fixing a failure without touching model weights at all. Harness changes don't need a weight update, and you can test and release them on a far shorter cycle than a new base or specialist model revision, so regression tests aimed at the harness close the feedback loop faster than any retraining path can. Because most failures originate in the harness and fixes there are the cheapest to deploy, the harness is also where a regression test suite earns the highest return on the effort of building it. That return is what the next section's workflow is built to capture.

The specific workflow for converting a production failure into a regression test case

Diagram: Four Steps: Production Failure to Regression Test. Visualizes: Visualize the four-step sequential workflow for converting a production agent failure into a regression test case: Step 1 — Capture the exact trace (every sub-agent call, tool…

Turning a production failure into a regression test follows four discrete steps, taken in sequence: capture the exact trace, attribute the failure to its responsible layer, encode the correct behavior as a layer-specific assertion, and validate future changes against that case before anything ships.

Step 1 is capturing the exact trace. Every sub-agent call, tool invocation, and retrieval step needs to be captured as a structured span, because without span-level completeness, the trace cannot reproduce the sequence that produced the failure. The 2026 LLM observability guide treats span-based trace replay as a baseline requirement, not an optional extra. The OpenTelemetry standard, with its GenAI semantic conventions, serves as the vendor-neutral instrumentation baseline here, and span completeness is the metric that actually matters: below a high threshold, dashboards built on that data misrepresent what the agent actually did. Traditional logs cannot reproduce a non-deterministic LLM failure on demand. Span-based replay is what lets you use a captured trace as a test fixture in the first place.

Step 2 is attributing the failure to its layer. The taxonomy from planning, tool, retrieval, reasoning, and safety categories gives a first pass, and from there the failure narrows to a specific harness layer: prompt template, tool schema, workflow controller, memory interface, or the model call itself. That attribution has to be specific enough that the resulting test checks the right thing. A test written against a schema drift failure should check tool call arguments and return types directly, not the quality of the final output, since the final output may look fine even when the underlying call was malformed.

Step 3 is encoding the correct behavior as an assertion. The AI Agent Evaluation Guide 2026 states the governing principle: every production regression should become a test case, capturing the exact input, the actual trajectory the agent took, and what the correct behavior should have been, then adding that case to the suite. A workflow loop failure encodes as a deterministic, run-in-CI check: the same tool with similar arguments must not fire more than a defined number of times in a single trace. A schema drift failure encodes just as deterministically: given a specific tool call input, the returned payload must include certain required keys with certain types, and the test fails the moment it doesn't.

Step 4 is validating future changes against the case before shipping. The regression test has to run against any candidate harness change, whether that's a prompt edit, a tool schema update, or a workflow revision, before that change is promoted anywhere near production. This is replay-based validation: the captured trace becomes the fixture, and new code runs against it the same way a unit test runs against a fixed input. Chronicle's evaluation covers small, self-constructed incidents with deterministic simulated model boundaries and contains no loops, retries, or multi-agent routing, so teams building more complex agents should treat it as a proof of concept for the underlying mechanism rather than a drop-in solution for every failure type they'll encounter.

Production Sampling and Online Evaluation

A regression suite built only from past failures has a fixed horizon: it knows what has already gone wrong and nothing about what hasn't yet, and continuous online evaluation closes that gap by systematically surfacing new failure patterns from live traffic before they accumulate into full incidents. In practice, online evaluation runs at a sampling rate across live traffic, with an LLM-as-judge process running asynchronously over the sampled traces. Alerts fire when the rolling quality score drops below a set threshold, and traces that fail are added automatically to the offline dataset that feeds the next regression suite update. The recommended starting point for this pipeline is a set of golden traces drawn from production traffic, with the dataset growing weekly through a structured review process. Once failures are sorted into categories, tool schema drift, workflow loops, planning errors, and the rest, each one maps to a specific harness layer, prompt, tool definition, workflow orchestration, or memory, where the actual fix will land, and attribution systems need to tell these categories apart before a regression test can be written with any precision. A static harness cannot absorb newly observed failure patterns into its own future behavior on its own. Research on continual learning in agent harnesses treats this as the underlying reason online evaluation has to run continuously rather than as a one-time audit: the suite stays useful only as long as it keeps growing alongside the traffic it's meant to protect.

Sources

  1. AgentDebugX: An Open-Source Toolkit for Failure Observability, Attribution, and Recovery in LLM Agents
  2. Top LLM Observability Tools in 2026: A Pro Guide | MLflow
  3. Chronicle: Cut-Point Replay for Regression Testing of LLM Agents Tisha Chawla*
  4. When Errors Become Narratives: A Longitudinal Taxonomy of Silent Failures in a Production LLM Agent Runtime
  5. Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures
  6. A Survey for LLM Agent Trajectory Analysis: From Failure Attribution to Enhancement - Technical University of Munich
  7. Model or Harness? An Interaction-Centric Taxonomy forLocalizing Agent Failures
  8. From Failed Trajectories to Reliable LLM Agents: Diagnosing and Repairing Harness Flaws

More in Feedback Loop Architecture