Production Learning Review

The Closed-Loop Harness Workflow That Makes Prompt and Tool Iteration a Repeatable Engineering Ceremony

Four stages turn production traces into validated prompt and tool fixes.

· 9 min read
Cover illustration for “The Closed-Loop Harness Workflow That Makes Prompt and Tool Iteration a Repeatable Engineering Ceremony”
Production Signal Theory · November 19, 2026 · 9 min read · 1,923 words

A production trace-driven harness engineering workflow has four connected stages, which are capturing production signal, attributing failures to a specific harness layer, generating and reviewing concrete changes, and validating those changes against recorded incidents before shipping. This closed-loop workflow makes prompt and tool iteration repeatable. Skipping any stage breaks the chain of evidence needed to distinguish a durable improvement from a fortunate rerun.

Why agents fail in the harness, not the model

Teams often begin debugging by swapping the model or adjusting temperature, while the fault lives in the runtime surrounding it. Most agent failures are harness failures, so teams working on reliability must address that runtime rather than turn first to model replacement or retraining. The harness determines what the model sees, which tools it can call, when it retries, and what counts as an acceptable result. Token generation is only part of the system.

Guo et al.'s 2026 survey defines an LLM-based agent as a foundation model coupled with an execution harness and argues that quality emerges from their interaction. Barbaste et al.'s July 2026 source-code study of eleven production coding harnesses locates reliability decisions across roughly four million lines of code entirely in the harness layer. Those decisions include loop structure, tool sandboxing, context rationing, and safety enforcement. Model convergence does not weaken the case for harness engineering. If teams have access to models with similar capabilities, the way they build their runtimes makes the difference.

The six harness layers where failures actually originate

The harness has separable responsibilities, even though failures can cross their boundaries. Guo et al.'s survey names six, which are observation, context, control, action, state, and verification/governance. In practical debugging, these responsibilities direct attention to observations, context management, the control loop, tools, memory, and verification, with orchestration connecting execution across steps. Each is a potential failure site in its own right. A diagnosis therefore needs more precision than “the agent failed.”

The control loop runs the model, observes its result, and chooses to call a tool, continue, or terminate. Context sets what the model can still see, while memory and state persistence keep knowledge available beyond a context window. Without deliberate management, long-running agents accumulate transcripts until truncation produces plausible but disconnected output. Verification checks an outcome against the task's requirements. Seong et al.'s Harness Evolution Loop treats prompts, tools, orchestration logic, observations, and model configuration as separately addressable targets.

Three structural fault types make this map operational. Tool schema drift is a mismatch between the schema presented by the harness and the tool's actual response. Prompt ambiguity can lead to the wrong tool or malformed arguments. Workflow loops repeat tool calls after ambiguous results until a hard step limit intervenes, while context exhaustion can compound drift across later steps.

Why ad-hoc iteration fails: the missing loop structure

Editing a prompt, rerunning a few traces, and shipping cannot reliably establish that the underlying failure has been repaired. Inference is not bitwise reproducible, the state that tools read changes, and a new run rarely takes exactly the same multi-step trajectory. A successful rerun may simply avoid the faulty condition.

Observability tools can replay execution traces while providing limited support for identifying the root cause or translating it into an inspectable change. Seong et al.'s framework connects these activities through a worker that executes, an evaluator that diagnoses and scores, and an evolution agent that modifies the harness using the history of prior attempts. An open-loop workflow executes a change and ships it, while a closed-loop workflow uses observed outcomes to govern what changes and whether it ships.

Stage one: capturing production signal that is worth acting on

Diagram: The Four-Stage Closed-Loop Harness Workflow. Visualizes: Show a four-stage closed loop where each stage feeds the next and the last feeds back into the first, making iteration repeatable.

Production traces record the actual user inputs, tool responses, and conditions in which an incident happened. Synthetic benchmarks do not substitute for that record. An actionable trace includes the reasoning trace, tools considered, tools invoked, arguments passed, responses returned, tokens spent at each step, and latency at each hop. These fields serve different diagnostic purposes. Arguments and responses expose interface mismatches, while per-step token and latency measurements show where execution spends its resources.

A span represents the agent run, child spans represent its steps, and model and tool calls sit beneath those step spans with prompt, token, and latency attributes. Read from top to bottom, this hierarchy reconstructs the decision sequence. A collection of disconnected logs cannot provide the same context. The engineer needs to connect a returned value with the next decision.

Before treating this record as actionable signal, a team should be able to replay any run and reconstruct a failure from structured logs. It should also distinguish tool-call failures from run failures and alert on steps-per-run and cost-per-run. Task success requires an evaluation. Runtime tracing therefore needs eval gates, which are automated scorers that grade agent outputs. This pairing lets a production span become input to an offline evaluator, turning recorded activity into evidence for diagnosis.

Stage two: attributing a failure to the specific layer that caused it

A failed evaluation identifies an outcome. Attribution must locate the responsible agent-step pair because the step where an error surfaces may differ from the step that introduced it. “Tool failure” is too broad to direct a repair. Tool schema drift at step four of a retrieval sub-agent gives engineers a specific place to look for the cause. The trace must establish whether the fault came from an interface mismatch, an ambiguous parameter description, or a failure to terminate a loop.

A changed payload field produces a KeyError, but the retry layer classifies it with transient failures such as network timeouts. It retries three times before routing around the tool. Repetition cannot repair a permanent structural mismatch. A diagnosis that accepts the retry layer's classification would misdirect attention toward transient recovery, overlooking the incompatible schema.

Seong et al.'s Evaluator Agent separates diagnosis from execution by verifying outcomes, diagnosing failure modes, and scoring performance as a distinct role. That separation helps keep the worker's assumptions from governing the assessment of its own failure. Some incidents still require more than a single trace reading. Global trajectory analysis and cross-examination across steps make attribution a multi-turn diagnostic process when the causal chain is unclear.

Stage three: generating concrete, reviewable harness changes

Once attribution identifies the responsible layer, the proposed change must make the repair inspectable. For prompt ambiguity, the highest-leverage target is the tool description or parameter schema. For schema drift, the target is the connector and the retry policy's distinction between permanent and transient failures. Workflow loops call for changes to hard step caps and soft penalty signals in the system prompt. These are different repairs for different mechanisms.

The smallest suitable change is generally preferable to an unnecessary rewrite of orchestration code. Prompt and tool-description changes are usually the highest-leverage, lowest-risk starting points when they address the diagnosed cause. Seong et al.'s Evolution Agent uses the full history of prior attempts to modify specific harness components rather than merely rerun execution at a different temperature. That history constrains the next candidate. A repair to step four may already have produced a regression at step seven in an earlier attempt.

Reviewability remains necessary when generation is automated. Barbaste et al.'s study observes behavioral policy migrating from prompt prose into configuration, making policy explicit and auditable. A generated tool description, updated schema, or changed retry policy must also be clear and open to review. An engineer must be able to read the diff and understand its connection to the diagnosis. The change remains a candidate until a human reviews and approves it.

Stage four: validating changes against real traces before shipping

Approval establishes that a change is understandable and justified. Validation must return to the recorded incident. A fresh synthetic run can pass while the original trace still exposes the defect, and a targeted repair can introduce a regression elsewhere. The test must keep the conditions that led to the failure.

Chronicle, by Tisha Chawla and Susheem Koul at REALM @ EMNLP 2026, records agent runs at their non-deterministic boundaries as immutable envelopes. It replays execution from those records, turning an incident into a regression test that runs in continuous integration. Its central operation is cut-point replay. A chosen subset of boundaries uses recorded responses, while the complementary subset executes live with new code. For example, a test can run a tool gate live while stubbing the model call.

Full replay uses real recorded inputs to test the deterministic glue code between boundaries. Cut-point replay instead tests a change together with its consequences, reproducing the stubbed lead-up without executing that lead-up again. This distinction makes the replay boundary consequential. Chronicle's recording overhead adds microseconds each time execution crosses a boundary, a small share of the time a typical model call takes.

Runtime tracing and eval gates make this validation continuous. Automated scorers can block regressions before release or flag quality drops in production. The loop closes when a captured span can be evaluated offline, its regression debugged against the record, and the reviewed fix promoted with a guardrail derived from that evaluation.

What breaks when any stage of the loop is skipped

Without structured production capture, attribution starts from recollection. Teams debug the last run they remember, leaving the recurring failure category unaddressed. The historical test input is also missing. Even a plausible repair then lacks the recorded conditions needed to establish that it addresses the incident.

Without attribution, changes become undirected experiments on the harness. Rewriting a prompt cannot resolve an incompatible tool payload, while reducing a step cap can conceal repeated calls without resolving the ambiguity that caused them. A shorter failed run is not necessarily progress. The history supplied to the evolution process is also less useful when it records outcomes without identifying their causes.

Without review of generated changes, automation becomes a black box. A candidate can address the diagnosed failure at step four while introducing a regression at step seven, with no engineer having examined the full diff. Generation alone cannot authorize a production change. Without the approval gate, no one explicitly judges whether the proposed mechanism would produce the intended behavior.

Unless a change is tested against the incident, a new run that succeeds cannot prove that the change fixes the original failure condition. Non-reproducible inference may steer execution away from the defect by chance. Each omission also weakens the history available to subsequent iterations, so the damage extends beyond the current release.

Treating harness iteration as an engineering discipline, not a one-time fix

A harness workflow that runs once is a postmortem. A workflow that repeatedly addresses recurring failure patterns is an engineering discipline. The same schema drift or prompt ambiguity can reappear under different inputs unless a durable repair is paired with a regression gate. The ceremony therefore belongs on every significant harness change. Its standing should match code review and testing, both of which constrain ongoing work.

Seong et al.'s two-level framework makes that distinction explicit. The Harness Evolution Loop makes a harness better at a single task, while the Meta-Evolution Loop makes the process of improving it better across a range of tasks. Repetition creates the history that makes this second level possible. Automated generation, replay validators, and eval gates make the ceremony practical to run continuously, but they do not replace engineering judgment.

The record that links failures, diagnoses, reviewed repairs, and regression tests keeps its value over time. Teams that observe, attribute, fix, and validate accumulate reliability gains because each incident strengthens the next iteration. Ad-hoc debugging repeatedly starts over without that foundation. The ceremony is a product of engineering culture.

Sources

  1. The Last Harness You’ll Ever Build
  2. Harness Engineering:Anatomy, Architecture, and Evolution of Coding AgentsA Source-Code Study of Eleven Systems
  3. From Question Answering to Task Completion: A Survey on Agent System and Harness Design[v1]
  4. TRAJDEBUG: Tracing Error Lifecycle to Identify Critical Failures in Long-Horizon Agent Trajectories
  5. Root-Cause Attribution Is a Search Problem: Continual Search for Long-Horizon Agent Failures

More in Production Signal Theory