Harness engineering
An agent harness is the software around a language model that turns it into an agent. It runs a loop of model and tool calls, chooses what the model sees, keeps state, and controls which actions may run (Barbaste et al., 2026). Harness engineering is the work of designing and revising that software (Barbaste et al., 2026); it differs from building an evaluation harness, which runs and scores benchmarks. With the model held fixed, a different harness can change which tasks get solved and what they cost, by amounts that depend on model, tasks and budget (Zhang et al., 2026x; Liu & Han, 2026). Studies disagree on whether harness or model matters more, on whether automatically designed harnesses beat simpler uses of the same compute, and on how much harness stronger models still need.
Where the terms came from
Earlier sources used other names for the same software, such as a scaffold. A January 2024 report on evaluating agents used scaffolding program for software that lets a model act and observe the results in successive steps (Kinniment et al., 2024). In July 2025, LangChain described context engineering as deciding what information the model has at each step (The LangChain Team, 2025).
Uses of harness for this software appear in early 2026. In January, Schmid used agent harness for the infrastructure that wraps a model to manage long-running tasks (Schmid, 2026c). On 5 February, Hashimoto used harness engineering for changing an agent’s tools or instructions after it made a mistake (Hashimoto, 2026). On 17 February, Trivedy used the term more broadly, for designing the system prompt, tools and execution flow around a model, with context delivery as one of its jobs (Trivedy, 2026).
A later source-code study adopted the broad sense, and scaffold still overlaps with it. That study defines harness engineering as designing and evolving the model’s surrounding runtime (Barbaste et al., 2026). A survey keeps both words: a harness is a configured execution runtime, and a scaffold is the overlapping layer of prompts and workflow structure (Meng et al., 2026).
What a harness does Weak evidence: few or small studies support this
Studies that inventory harnesses name overlapping parts, among them a control loop, tools, context and state, and controls on execution. One study traces these through the source code of eleven coding agents (Barbaste et al., 2026). Another codes thirteen agents at fixed versions, and a survey rates 34 systems against six runtime functions: execution, tools, context, persistent state, lifecycle hooks and evaluation (Rombaut, 2026; Meng et al., 2026). How an agent’s tools are described and shaped is a subject of its own, covered in Tools for AI agents.
The studies draw the boundaries between these jobs differently. One treats the link to the model provider (protocols, prompt construction, choice of model) as a subsystem of its own, and treats transcripts, persistence and resuming a session as cross-cutting (Barbaste et al., 2026). The survey instead gives persistent state and evaluation their own functions (Meng et al., 2026). A third proposal lists eleven responsibilities, including task specification, failure attribution, checking and recording human interventions (Zhong & Zhu, 2026).
Not every harness has every part. The eleven-system study allows a subsystem such as orchestration to be absent by design (Barbaste et al., 2026). The minimal mini-SWE-agent, by its documentation, keeps an append-only message history with no separate step that reshapes it (SWE-agent team, n.d.a). Where a part lives can depend on the integration. In Cloudflare’s agent platform, Pi and OpenCode keep their own transcripts, while Claude Code and Codex use a shared SQLite-backed store (Cloudflare, 2026a).
How much the harness changes results Contested: studies disagree on this
Studies disagree on how much the harness matters next to the model. Some controlled comparisons find large harness effects, and one finds them larger than the effect of switching models. On 100 SWE-bench Verified coding tasks, a full harness beat a minimal one by 8.5 to 13.0 percentage points of first-try success. Models in the same harness differed by 2.5 to 5.0 points (Zhang et al., 2026x). When the context window was tight, a bundle of harness changes raised complete solutions from 43 to 72 of 169 tasks (Lewis, 2026).
Other studies find the harness effect small, or no larger than chance. On SWE-Bench Pro V2, scaffold choice explained 0.29% of the variation in whether a task was solved, against 2.65% for model choice (Dan et al., 2026). These are shares of the variance in whether tasks were solved or failed. On 45 difficult tasks, swapping the harness changed 13% of outcomes at the median, as many as rerunning an unchanged configuration (Liu & Han, 2026).
| Study | Model and tasks | What changed | Outcome |
|---|---|---|---|
| Zhang et al. (2026x) | Three models; 100 SWE-bench Verified tasks | Minimal to full harness | +8.5 to +13.0 points; 2.5 to 5.0 points between models |
| Lewis (2026) | Qwen3.6; 169 SWE-bench Verified tasks, 20,480-token window | Bundle of harness changes | Mean share of failing tests fixed 28% to 49%; complete solutions 43 to 72 |
| Liu and Han (2026) | Qwen3.8-27B; larger SWE-bench Verified pool | OpenCode, Claude Code, mini-SWE-agent | 70.1%, 78.2%, 79.3% |
| Liu and Han (2026) | 45 difficult SWE-bench Verified tasks | Harness swap versus unchanged rerun | 13% of outcomes changed at the median in both |
| Dan et al. (2026) | 642 SWE-Bench Pro V2 tasks | Model and scaffold | 2.65% of outcome variance for model, 0.29% for scaffold |
| Bjarnason et al. (2026) | Devstral-2, temperature 0; SWE-bench Verified, ten runs each | nano-agent versus r2e-gym | 63.8% versus 35.4%, ranges not overlapping |
| Li et al. (2026g) | GPT-6 Astra; 63 Terminal-Bench 4 tasks | PI versus DeepSeek Harness | 60.32% at $4.66 per task versus 52.38% at $19.94 |
Run-to-run noise is large enough to hide small harness effects, but some gaps exceed it. Repeating each configuration ten times on SWE-bench Verified gave pass rates that spread by 2.2 to 6.0 points within a single setting. In the same study, one model scored 63.8% in one harness and 35.4% in another, with no overlap between their runs (Bjarnason et al., 2026).
Harness choice can also change cost sharply. With model and tasks fixed, the dearest harness cost under 10% more than the cheapest for some models, and 3 to 4 times as much for another (Liu & Han, 2026). In another comparison, a lean harness scored higher than a heavier one at less than a quarter of the cost per task (Li et al., 2026g).
Effects of individual parts
Experiments that change one part of a harness at a time find effects that depend on the model, the budget and the tasks.
Planning and tool design Weak evidence: few or small studies support this
A planning step can help a smaller model. Asking Nemotron-3 30B to plan before acting raised its success on SWE-bench Verified by 11.6 percentage points, with a 128,000-token context budget (Fan et al., 2026c). Passing evidence from one iteration to the next also mattered in a multi-iteration agent: removing it lowered a game-building score from 71.52 to 65.23 (Yan et al., 2026b).
A gain from purpose-built tools was not found in a later study. In 2024, SWE-agent’s tailored agent-computer interface beat a plain Linux shell by 10.7 points on SWE-bench Lite (Yang et al., 2024e). A 2026 study crossing two agents with two benchmarks detected no significant difference in success between tool designs. On SWE-bench, restricting the agent to a single code-execution tool cut cost for Codex, while Claude’s cost moved, not significantly, the other way (Yang et al., 2026i). With only shell tools, the large Nemotron-3 550B succeeded more often and at lower cost (Fan et al., 2026c).
Tests, checks and repository files
Practitioner guides make mechanical checks part of the harness, but they describe practice rather than measure it. In a vendor case report, OpenAI’s application team enforced the architecture’s allowed dependency directions with custom linters and structural tests (Lopopolo, 2026). Adobe’s guide recommends one make check command that runs linting, type checking and tests (Adobe, n.d.a).
Test feedback helps or hurts depending on the quality of the tests. With the repair agent held fixed, tests written by one model lowered its success from 61.2% to 57.3%, and tests written by another raised it to 65.3% (Tao et al., 2026). Prompting agents to write more or fewer tests of their own left the number of solved tasks statistically unchanged, though resource use changed for three of four models (Chen et al., 2026q). Under matched settings, one feedback controller raised the mean pass rate from 61.2% to 68.2% while lowering cost (Zhang et al., 2026r).
Passing the functional tests does not mean a change meets the project’s other rules. SWE-Gate turns constraints from pull-request review comments into separate tests. Of 644 patches that passed the functional tests, 221 failed the constraint tests, although the constraints had been given to the agent (He et al., 2026d).
Repository instruction files for agents add cost without a general gain in success. Across several coding agents and models, files in the style of AGENTS.md did not generally raise task success. They raised inference cost by over 20% on average, even though agents followed them (Gloaguen et al., 2026). How such files are loaded and worded is covered in Agent skills and Progressive disclosure for AI agents.
Context and state across sessions
Harnesses can carry state outside the conversation so that a task survives a fresh session. In a vendor case report, Anthropic had each fresh coding session read a progress file and the Git history to learn where earlier sessions had left the work (Young, 2025).
Managing context helps less as the context budget grows. In matched ablations, the accuracy benefit of context management shrank as budgets widened (Fan et al., 2026c). In a comparison of whole harnesses on long mixed sessions, Opus 5.5 managing its own context matched Claude Code’s task success. It cost 34% less than Claude Code’s explicit 200,000-token setting and 49% less than its default (Busch et al., 2026).
Compaction Weak evidence: few or small studies support this
Compaction, in which the harness condenses earlier conversation once the context fills up, is rare in benchmarks, yet in sampled real use the sessions that compact use many tokens. More than ten frontier coding benchmarks rarely triggered even one compaction with current models. In sampled GitHub Copilot agent sessions, 7.8% compacted, and those sessions accounted for 44.2% of all tokens (Liu et al., 2026e). That share describes the compacting sessions as a whole, not the tokens compaction itself used.
Permissions and sandboxing Weak evidence: few or small studies support this
Evidence on permissions comes mostly from vendor reports, and it measures interruptions rather than safety. Anthropic reported 84% fewer permission prompts after it gave Claude Code an operating-system sandbox, with writes limited to the workspace and network access denied by default (McGuinness et al., 2026). OpenAI’s Codex sends requests that would cross its sandbox boundary to a separate approval agent (Trębacz et al., 2026).
Asking a person to approve each action does not guarantee close review. In a developer survey, 61% (64 of 105) of those who carefully reviewed most or all agent-written code often approved some kind of action without close review (Wu et al., 2026d).
What simplifies as models improve Weak evidence: few or small studies support this
In some comparisons with strong models, minimal harnesses matched elaborate ones. Under matched time budgets, a minimal single-session agent matched or beat four specialised machine-learning engineering harnesses with the frontier models tested (Brilliantov et al., 2026). On 80 private coding tasks, neither of two vendor-native harnesses showed an average advantage over a neutral harness running the same model (Arjmandi, 2026). In a vendor case report, Anthropic’s builder on Opus 4.6 ran coherently for over two hours after it dropped the sprint decomposition used with Opus 4.5 (Rajasekaran, 2026).
The best harness still depends on the model and the task. In a study crossing five models with several harnesses, the top-scoring harness changed between benchmarks for four of the five (Li et al., 2026g). Opus 4.8’s vendor harness showed opposite differences on repository tasks and contest tasks, a pattern found after the fact (Arjmandi, 2026).
Harnesses grow and drift, and growth does not guarantee gains. Five major open-source coding harnesses together shipped more than two releases a day. Across 35 releases of Qwen Code run with one fixed model, later versions used nearly twice the tokens and tool calls without a significant gain in solved tasks (Ben Sghaier et al., 2026). In a six-week case study of one repository, stale documentation was involved in 48 of 118 agent failures. On a newer model, three of four completed replays did not repeat their failure even without the old fix, but one failure recurred once its check was removed (Hassanzadeh Aliabadi, 2026).
Reporting harnesses in benchmarks
Because the harness moves scores, one proposal asks benchmark reports to include a Harness Card describing the configuration in seven categories. It comes with a breakdown of variance and measures taken from the agent’s step-by-step record (Zhang et al., 2026x).
In one small audit, benchmark papers disclosed their harnesses only in part. Seven of eight agent benchmark papers described their scaffold and tools to some degree but did not pin the exact environment image. The eighth scored zero on harness disclosure, in this pilot scored by one rater (Naser Moghadasi & Ghaderi, 2026). The software that runs those benchmarks is covered in Evaluation tooling for AI agents.
Automatic harness design Contested: studies disagree on this
Studies disagree on whether harnesses designed by a search process are worth their cost: two searches beat hand-built harnesses, but a third study found no advantage over simpler ways of spending comparable compute. Two search methods reported gains on Terminal-Bench 2. One raised pass rate from 69.7% for its starting harness to 77.0% after ten rounds of evolution, against 71.9% for the hand-designed Codex harness (Lin et al., 2026b). Another, with Opus 4.6 held fixed, reached 76.4% against 74.7% for the hand-engineered Terminus-KIRA (Lee et al., 2026b).
Another study found no advantage. On Terminal-Bench 2.1, harness evolution did not beat simple test-time scaling, which spends extra compute while the agent runs, with or without test feedback. The evolved harnesses also generalised only to a limited degree (Wang et al., 2026r). Agents that revise their own instructions, memory and tools more broadly are covered in Agent self-improvement.
Further reading
- Barbaste et al. (2026): a source-code study of eleven coding agents that names the parts of a harness and defines harness engineering.
- Zhang et al. (2026x): a matched model-by-harness experiment and the Harness Card proposal for disclosing harnesses in benchmarks.
- Liu and Han (2026): compares harness swaps with unchanged reruns, and the cost of the same work across harnesses.
- Fan et al. (2026c): ablations of planning, context management and tool sets in coding agents.
- Wang et al. (2026r): a test of whether automatically evolved harnesses beat simpler uses of the same compute.
- Young (2025): a vendor account of carrying state across sessions in long-running coding work.
First published .
Known gaps
What this article cannot tell you yet.
- Harnesses for agents outside software engineering were not researched; almost every comparison in this article uses coding benchmarks.
- The human time and money spent maintaining a harness across repository and model changes has not been estimated.
- The effect of enforced review gates on defects that reach production was not measured; the evidence counts what separate tests detect.
- The safety outcomes of permission systems and sandboxes rest mostly on vendor evaluations; independent comparisons measure prompts and reported attention.
- The separate effects of adding sub-agents, or of memory kept across unrelated sessions, were not isolated in the comparisons gathered.
- Most results come from 2026 preprints, and exact independent replications of particular harness gains are few.
References
- Solid source
- Rated highly trustworthy by the research, and every passage taken from it was found in it.
- Weak source
- Rated low, or a passage taken from it was not found in it.
- Medium trust
- Rated medium by the research.
- Not checked
- Rated high, but its passages could not all be checked against it.
Show all 43 references
- Adobe (n.d.a). Five control layers. Repository Harnesses for AI Coding Agents. https://opensource.adobe.com/ai-repo-harness-guide/03-Five-Control-Layers/ Medium trust Vendor page, read in large part.
- Hassanzadeh Aliabadi, H. (2026). Lessons outlive their failures: a case study of rules for AI coding agents. arXiv preprint. https://arxiv.org/html/2610.32578 Medium trust Preprint, read in full.
- Arjmandi, M. (2026). Harness or model? Isolating the harness effect in agentic coding with a contamination-controlled private suite. arXiv preprint. https://arxiv.org/html/2609.11987 Medium trust Preprint, read in full.
- Barbaste, P., Darrigol, T., Vu, G., & Wiltberger, T. (2026). Harness engineering: anatomy, architecture, and evolution of coding agents -- a source-code study of eleven systems. arXiv preprint. https://arxiv.org/html/2609.00006v1 Medium trust Preprint, read in full.
- Ben Sghaier, O., Li, H., Adams, B., & Hassan, A. E. (2026). Don't blame the large language model: how agent harness evolution shapes coding agent quality. arXiv preprint. https://arxiv.org/html/2607.03691 Solid source Preprint, read in full.
- Bjarnason, B. H., Silva, A., & Monperrus, M. (2026). On randomness in agentic evals. arXiv preprint. https://arxiv.org/html/2602.07150 Solid source Preprint, read in full.
- Brilliantov, K., Hernández-Cano, A., & Abbé, E. (2026). How much of a harness does a strong agent need for autonomous ML engineering? arXiv preprint. https://arxiv.org/html/2609.40303v1 Medium trust Preprint, read in large part.
- Busch, M., Tacke, M., Aydin, R. C., Feiler, C., & Cyron, C. J. (2026). CTXAgent: self-controlled context management of LLM agents. arXiv preprint. https://arxiv.org/html/2610.34425v1 Medium trust Preprint, read in large part.
- Chen, Z., Sun, Z., Shi, Y., et al. (2026q). Rethinking the value of agent-generated tests for LLM-based software engineering agents. arXiv:2602.07900. https://arxiv.org/abs/2602.07900 Solid source Preprint, read in full.
- Cloudflare (2026a). Harnesses. Cloudflare Agents documentation. https://developers.cloudflare.com/agents/harnesses/ Solid source Documentation, read in large part.
- Dan, S., Da, J., Bhutani, S., Romero Calvo, M., Guevara, I., Carabedo, F., et al. (2026). SWE-Bench Pro V2: a cleaner, harder-to-game coding benchmark. arXiv preprint. https://arxiv.org/html/2610.24206v1 Medium trust Preprint, read in large part.
- Fan, R., Zhang, Z., Ma, S., Hu, Y., Wang, S., Song, K., et al. (2026c). An empirical study of harness design for coding agents. arXiv preprint 2609.20804. https://arxiv.org/html/2609.20804 Solid source Preprint, read in large part.
- Gloaguen, T., Mündler, N., Müller, M. N., Raychev, V., & Vechev, M. (2026). Evaluating AGENTS.md: are repository-level context files helpful for coding agents? arXiv (2602.11988); ICLR 2026 workshop. https://arxiv.org/pdf/2602.11988 Solid source Preprint, read in full.
- Hashimoto, M. (2026). My AI adoption journey. Mitchell Hashimoto (blog). https://mitchellh.com/writing/my-ai-adoption-journey Medium trust Blog post, read in full.
- He, X., Wang, Y., Liu, M., Chen, J., Zhang, H., & Li, G. (2026d). SWE-Gate: passing functional tests is not enough for software engineering agents. arXiv preprint. https://arxiv.org/html/2609.04167 Solid source Preprint, read in full.
- Kinniment, M., Koba Sato, L. J., Du, H., Goodrich, B., Hasin, M., Chan, L., et al. (2024). Evaluating language-model agents on realistic autonomous tasks. arXiv preprint. https://arxiv.org/html/2312.11671v2 Medium trust Preprint, read in full.
- The LangChain Team (2025). Context engineering. LangChain blog. https://www.langchain.com/blog/context-engineering-for-agents Medium trust Vendor page, read in full.
- Lee, Y., Nair, R., Zhang, Q., Lee, K., Khattab, O., & Finn, C. (2026b). Meta-Harness: end-to-end optimization of model harnesses. COLM 2026. https://proceedings.colm.cc/paper_files/paper/2026/file/fde1a69a5b6e554b2f1f727197d2651d-Paper-Conference.pdf Solid source Peer-reviewed, read in large part.
- Lewis, S. (2026). Same model, different harness: different coding-agent results. arXiv preprint. https://arxiv.org/html/2608.26218v1 Medium trust Preprint, read in large part.
- Li, Y., Zhou, Y., Teng, Y. L., Yang, F., Deng, Y., Lyu, Z., et al. (2026g). Finding the right fit: model-harness interactions across agent tasks. arXiv preprint. https://arxiv.org/html/2610.00917 Solid source Preprint, read in full.
- Lin, J., Liu, S., Pan, C., Lin, L., Dou, S., Xi, Z., et al. (2026b). Agentic harness engineering: observability-driven automatic evolution of coding-agent harnesses. arXiv preprint. https://arxiv.org/html/2604.25850v4 Solid source Preprint, read in large part.
- Liu, Y., & Han, Z. (2026). What does a harness buy? Tokens, mostly. arXiv preprint. https://arxiv.org/html/2610.04433v2 Solid source Preprint, read in large part.
- Liu, B., Qiu, H., Goiri, Í., Zhou, J., Fonseca, R., Bianchini, R., et al. (2026e). Benchmarking long-horizon agent context compaction with CompactionBench. Preprint. https://www.preprints.org/manuscript/202611.0780 Medium trust Preprint, read in large part.
- Lopopolo, R. (2026). Harness engineering: leveraging Codex in an agent-first world. OpenAI. https://openai.com/index/harness-engineering/ Weak source Vendor page, read in large part.
- McGuinness, M., Grace, M., De Jonghe, J., Eaton, J., & Ribbink, A. (2026). How we contain Claude across products. Anthropic. https://www.anthropic.com/research/how-we-contain-claude Weak source Vendor page, read in large part.
- Meng, Q., Wang, Y., Chen, L., Li, Y., Wu, W., Jiang, W., et al. (2026). Agent harness for large language model agents: a survey. Unpublished survey. https://gloriaameng.github.io/Awesome-Agent-Harness/ Medium trust Preprint, read in full.
- Naser Moghadasi, M., & Ghaderi, F. (2026). What twelve LLM agent benchmark papers disclose about themselves: a pilot audit and an open scoring schema. arXiv preprint. https://arxiv.org/html/2605.21404 Medium trust Preprint, read in full.
- Rajasekaran, P. (2026). Harness design for long-running application development. Anthropic. https://www.anthropic.com/research/harness-design-long-running-apps Weak source Vendor page, read in large part.
- Rombaut, B. (2026). Inside the scaffold: a source-code taxonomy of coding agent architectures. arXiv preprint. https://arxiv.org/html/2604.03515v2 Medium trust Preprint, read in full.
- Schmid, P. (2026c). The importance of agent harness in 2026. Philschmid. https://www.philschmid.de/agent-harness-2026 Medium trust Blog post, read in full.
- SWE-agent team (n.d.a). The 100 line AI agent that is actually useful. mini-SWE-agent documentation. https://mini-swe-agent.com/latest/ Weak source Documentation, read in large part.
- Tao, L., Peng, B., Wang, H., Wang, H., Cheng, H., Yao, W., et al. (2026). ExecCritic: learn to test, test to improve for coding agents. arXiv preprint. https://arxiv.org/html/2609.09133v1 Solid source Preprint, read in large part.
- Trębacz, M., Arnesen, S., Matthews, O., Hurd, D., Park, W., Lin, O., et al. (2026). Auto-review of agent actions without synchronous human oversight. OpenAI. https://openai.com/safety-alignment/auto-review/ Weak source Vendor page, read in large part.
- Trivedy, V. (2026). Improving Deep Agents with harness engineering. LangChain blog. https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering Medium trust Vendor page, read in full.
- Wang, Y., Zhu, H., Hu, Z., Yuan, Y., Chen, Z., Senthil, S., et al. (2026r). Rethinking the evaluation of harness evolution for agents. arXiv preprint. https://arxiv.org/html/2607.12227v4 Solid source Preprint, read in large part.
- Wu, Y., Wermke, D., Li, Z. S., Thomasset Stolee, K., & Xu, B. (2026d). From delegation to action approval: an exploratory study of developers' practices in collaborating with AI coding agents. arXiv preprint. https://arxiv.org/html/2611.10058v1 Medium trust Preprint, read in large part.
- Yan, H., Su, M., Zhang, H., Li, Z., Zhang, C., Zhang, S., et al. (2026b). Harness-of-Harness: multi-day autonomous software development with continual improvement. arXiv preprint. https://arxiv.org/html/2609.01481v1 Medium trust Preprint, read in large part.
- Yang, J., Jimenez, C. E., Wettig, A., Lieret, K., Yao, S., Narasimhan, K., et al. (2024e). SWE-agent: agent-computer interfaces enable automated software engineering. Advances in Neural Information Processing Systems 37. https://arxiv.org/html/2405.15793 Solid source Preprint, read in full.
- Yang, H., Yu, Q., & Desell, T. (2026i). When does restricting a coding agent to execute_code help? A regime x agent-design ablation. SE 3.0 Workshop at KDD 2026 (arXiv:2607.10569). https://arxiv.org/html/2607.10569v1 Solid source Preprint, read in full.
- Young, J. (2025). Effective harnesses for long-running agents. Anthropic. https://www.anthropic.com/research/effective-harnesses-for-long-running-agents Medium trust Vendor page, read in large part.
- Zhang, Y., Wang, J., Ge, Y., Xu, W., Hamm, J., et al. (2026x). Stop comparing LLM agents without disclosing the harness. arXiv (2605.23950). https://arxiv.org/abs/2605.23950 Medium trust Preprint, read in large part.
- Zhang, X., Wang, D., Xu, K., Zhu, Q., & Che, W. (2026r). Scaling laws for agent harnesses via effective feedback compute. arXiv preprint. https://arxiv.org/html/2605.29682 Medium trust Preprint, read in full.
- Zhong, H., & Zhu, S. (2026). AI harness engineering: a runtime substrate for foundation-model software agents. arXiv preprint. https://arxiv.org/html/2605.13357 Medium trust Preprint, read in full.