Harness Engineering: The New Dataset for AI Agent Evolution
As base models converge in capability, the gap between agent products from different teams has widened to several multiples. This article explains why that gap comes from the harness around the model rather than the model weights, traces the shift from prompt engineering to context engineering to harness engineering, breaks down the six layers of a complete harness, and argues that execution trajectories captured by the harness are becoming the real dataset. It also covers how to build the data flywheel, common anti-patterns, the infrastructure categories needed to support it, and a three-step adoption path.
1. The Bottleneck Moves Outward: Why Using a Model Well Now Matters More Than Improving It
For the past two years, most of the industry’s effort went into making base models stronger. Over the last year, a different fact has become hard to ignore: with comparable base capability, the agents delivered by different teams can differ in effectiveness by several multiples. The difference does not come from model weights. It comes from the system around the model, which determines what the model can see, what it can call, and how it recovers from failure.
Underneath is a simple engineering rule: once a capability crosses a threshold, the bottleneck moves outward to the system layer. In late 2025, a major release from a leading model vendor was widely treated as a marker: the model’s autonomous planning, long-horizon execution, and tool use crossed a critical point, and for the first time the marginal return on “how to drive the model” systematically exceeded the return on “waiting for the next model.”
2. Three Paradigm Shifts: From Stating Requirements to Building Systems
Laid out on a timeline, the migration of focus in AI engineering is clear:
- Prompt engineering (2022–2024): the core question was how to state a requirement clearly. By supplying role, context, goal, constraints, and examples, teams got stable output in single-turn or short-horizon conversations. The optimization target was a single request.
- Context engineering (2025): the core question became how to supply exactly the right information. As tasks grew longer, the model had to understand the full background inside a limited context window, so retrieval, compression, layered organization, and on-demand loading became the new practices. The optimization target was the information structure of a single session.
- Harness engineering (2026): the core question is how to build a reliable system. Here “system” means everything around the model that makes it genuinely useful: runtime environment, tools and interfaces, memory, evaluation and rollback, permissions and audit. The optimization target is a repeatable, observable, measurable execution process.
All three layers follow the same logic: the optimization target moves from text to information, then to process. The relationship fits in one line:
Agent = LLM + Harness
The model decides what to do; the harness decides what the model can see, what it can use, and what happens when it fails.
3. The Boundary of the Harness: What It Actually Contains
“Harness” originally refers to horse tack, and the analogy is accurate: the model is a strong but unstable force, and the harness does not weaken that force. It constrains direction, transmits intent, and provides braking when things go out of control. In engineering terms, a complete harness has at least six layers:
- Runtime environment layer: a sandboxed filesystem, process and network boundaries, reproducible dependencies and images, resource quotas and timeout control. It ensures the same task produces comparable results at different times.
- Tool and interface layer: semantic tool descriptions, parameter validation, idempotent design, error code conventions. The quality of tool design usually affects success rate more than the number of tools.
- Context and memory layer: short-term working memory, long-term fact storage, externalization of task state (writing progress to files instead of keeping it in context), plus retrieval and compression strategies.
- Control flow layer: task decomposition, plan–execute–verify loops, retry and backoff, termination conditions, human intervention points.
- Evaluation and rollback layer: validators that run automatically, regression test sets, versioned artifacts, and snapshot rollback.
- Observability and governance layer: full-chain logging, metrics and alerting, least-privilege permissions, sensitive data handling, and audit trails.
A minimal viable control loop usually looks like this:
def harness_loop(task, model, tools, verifier, memory, budget):state = memory.load(task.id)while not state.done and budget.remaining() > 0:action = model.plan(task, state, tools.schema())try:result = tools.invoke(action, sandbox=state.sandbox) # idempotent + timeoutexcept ToolError as e:state.record_failure(e) # failures become state, not discardedbudget.penalize(e.retryable)continuestate.append(action, result) # key: persist the trajectoryif verifier.check(state):state.done = Truebudget.charge(result.tokens, result.wall_time)return state
Note the state.append line: it is a runtime necessity and also the entry point for the data flywheel discussed below.
4. The Core Claim: The Harness Is Itself the Dataset
A leading industry researcher put forward a sharp judgment: the competitive advantage no longer lies in the model itself, but in what kind of execution trajectories your harness can capture.
The claim is worth arguing through, because it is not obvious.
Traditional datasets are static, human-labeled input–output pairs. The real difficulty in agent tasks lies in the intermediate process: how to decompose a goal, when to call a tool, how to fill in arguments, how to correct after an error, when to give up. These intermediate steps cannot be exhaustively labeled by hand, but they can be recorded in full by the harness during real runs. That produces a structural change:
- Datasets are no longer collected; they are produced by running.
- Labeling cost shifts from human labor to validators and rules.
- The data distribution naturally aligns with real business, not with a benchmark.
A high-quality trajectory typically has this structure:
{"task_id": "t-20260826-001","task_spec": {"goal": "...", "constraints": ["..."], "acceptance": ["..."]},"steps": [{"i": 0, "thought": "...", "tool": "search", "args": {"q": "..."},"observation": "...", "latency_ms": 820, "tokens": 1200},{"i": 1, "tool": "write_file", "args": {"path": "..."},"error": "permission_denied", "retryable": true}],"outcome": {"verified": true, "verifier": "unit_tests", "score": 0.93},"meta": {"harness_version": "1.4.0", "model_ref": "opaque", "cost": 0.021}}
The harness_version and verifier fields are often overlooked, yet they decide whether the data can be reused: without version information you cannot tell whether a trajectory is still valid; without a verification signal you cannot distinguish success from something that merely looks successful.
5. Engineering the Data Flywheel
Capturing trajectories is only the starting point. Closing the flywheel requires five stages:
- Collection: record actions, observations, errors, and latency in full. Design sampling rates and redaction policies up front rather than backfilling data later.
- Filtering: filter with three signals — validator results, human spot checks, and failure mode clustering — and prioritize two sample types: “hard and successful” and “typical failures.”
- Attribution: separate failures caused by model reasoning, tool defects, missing context, and environment limits. Wrong attribution leads teams to train on what is actually an engineering problem.
- Feedback: use successful trajectories for behavior-cloning-style supervised fine-tuning, failure–correction pairs for preference optimization, and turn tool defects directly into harness code fixes and regression cases.
- Regression: turn real production tasks into an offline evaluation set and run it on every harness or model change, preventing “fix one, break three.”
Flywheel speed depends on two metrics: the trajectory pass rate of validators and the cycle time from collection to feedback. The first determines data quality; the second determines iteration speed.
6. Common Anti-Patterns
- Treating the harness as a one-off script: no versioning, no regression, so results cannot be attributed.
- Too many tools with vague descriptions: model selection cost rises and error rates go up instead of down.
- Unbounded context accumulation: it crowds the window and dilutes attention, and quality drops sharply in the late stages of long tasks.
- Recording only successful paths: without failure samples, the model never learns boundaries or when to stop.
- Missing validators: mistaking “the task ended” for “the task is complete” injects noise into the flywheel.
- Overly broad permissions and network boundaries: this creates security risk and also makes trajectories non-reproducible.
7. Cloud Support: Building the Foundation With General-Purpose Capabilities
The infrastructure requirements of harness engineering map onto general cloud product categories: container platforms provide sandboxing and elastic concurrency; object storage holds trajectories and artifacts; message queues decouple long-running tasks from scheduling; logging services plus monitoring and alerting close the observability loop; key and permission management enforces least privilege; data warehouses and batch computing support offline filtering and regression. Baidu AI Cloud offers corresponding capabilities in these general categories and can serve as a reference when selecting a foundation for your own harness. For specific specifications and quotas, refer to the official documentation.
8. Practical Recommendations
If you lead a team, proceed in three steps. First, make runtime sandboxing and trajectory persistence solid; there is no substitute for these two. Second, build validators and an offline regression set for the two or three most critical task types. Third, only then address data feedback and the training loop. Reverse the order and the usual result is heavy investment with no clear account of where the gains came from.
Conclusion: improving model capability is becoming a public good shared across the industry, while “how to drive the model” remains private property for each team. The harness is the new dataset not because it replaces the model, but because it turns engineering practice into execution trajectories that can be accumulated, measured, and compounded. Whoever gets this system running smoothly first owns the fuel for the next round of iteration.
