Last reviewed:
What is a harness in AI? Definition, components and business stakes
A harness (agent harness) is the software layer that wraps an AI model and turns it into an agent: it assembles its context, runs its tools, keeps its memory, sets its permissions and checks its work. The reference formula fits on one line: agent = model + harness.
A language model, on its own, takes in text and produces text. It remembers nothing from one request to the next, opens no files and checks nothing. Everything else comes from the software around it: the harness. On 10 March 2026, LangChain gave the most widely quoted definition: every piece of code, configuration and execution logic that isn't the model itself. Claude Code, Codex, Cursor or Microsoft Copilot all run on models, but each has its own harness. That is why two products built on the same model can deliver very different results.
A complete harness combines seven functions. The execution loop passes the request to the model, runs the chosen action and returns the result, until the goal or a stop condition is reached. Instructions: system prompt, business rules, instruction files such as AGENTS.md or CLAUDE.md. Tools: files, code execution, browser, MCP connectors, Agent Skills. Context management: choosing what the model sees at each turn and summarising history when the window fills up. Memory: progress files and notes that let work resume. Permissions and isolation: sandbox, allowed folders and sites, human approvals. Verification and observability: tests, automated checks, a log of every action.
The word comes from software testing, where a test harness drives a program to check its behaviour. It took hold for agents in February 2026: on 5 February, Mitchell Hashimoto, co-founder of HashiCorp, made it a step of his method ("Engineer the harness"), then on 11 February an OpenAI team described its practice of harness engineering. In May 2026, Thoughtworks called it one of the most significant terms to emerge in software engineering that year.
The harness matters as much as the model. LangChain lifted its agent from 52.8% to 66.5% on Terminal-Bench 2.0 by changing only the harness, with the same model. A study published in May 2026 reports that Claude Opus 4.5 scores 45.9% on SWE-bench Pro in a standardised harness and 55.4% in Claude Code. These gaps exceed the 2 to 4 points often presented as meaningful progress from one model to the next.
Concrete example
Illustrative case. A B2B distribution company with 600 employees receives 4,000 supplier invoices a month. It wants an agent that matches each invoice with the purchase order and the goods receipt, then prepares payment proposals. First pilot: a general-purpose assistant, a careful prompt and Excel exports pasted into the conversation. On 300 invoices, 62% of matches are usable without rework, price gaps go unnoticed and two invoices are wrongly reported as paid. The committee concludes that "the model isn't ready".
Second pilot, same model, a real harness. The agent reads the ERP in read-only mode through an MCP connector. A script recalculates every total and every VAT amount instead of trusting the model. Any invoice with a gap above 2% or from a new supplier goes to a human approval queue. The agent has no payment rights: it prepares the batches, an accountant approves them. Every action is logged, and business rules live in a versioned file that the accounting team maintains. On the same sample, 91% of matches are usable and every gap is flagged. Token consumption tripled, which remains marginal compared with the accounting time saved.
Comparison
| What it is | Examples | What it decides | |
|---|---|---|---|
| Model | The network that takes in text and produces text | Claude, GPT, Gemini, Mistral | The quality of reasoning and output |
| Harness | The software that makes the model an agent: loop, tools, context, memory, permissions, checks | Claude Code, Codex, Cursor, Copilot | What the agent sees, what it can do, how its work is checked |
| Agent framework | A toolkit for building an agent | LangGraph, CrewAI, Microsoft Agent Framework | The building blocks you use |
| AI agent platform | The service that hosts, administers and bills a harness | Microsoft Foundry, Claude Managed Agents | Where the agent runs, who administers it, how it is billed |
| Context engineering | One part of the work on the harness | Compaction, notes outside the context, sub-agents | The information given to the model at each turn |
FAQ
What is a harness in AI?
It is the software that wraps an AI model and turns it into an agent: it provides its context and tools, runs its actions, keeps its memory, sets its permissions and checks its work. A model without a harness answers a question. A model with a harness completes a task.
Why is it called a harness?
The term comes from software testing, where a test harness drives a program to check its behaviour. The image fits: the model provides the power, the harness directs it, limits it and puts it to work. It became standard for AI agents in February 2026, after posts by Mitchell Hashimoto and OpenAI.
Is the harness more important than the model?
It matters as much, not more. Work presented at an ICML 2026 workshop concludes that picking the best harness brings a gain comparable to picking the best model. Each limits the other: an excellent harness does not make up for a weak model, and an excellent model in a poor harness makes a mediocre agent.
What is the difference between a harness and an agent framework?
A framework, such as LangGraph or CrewAI, provides building blocks for an agent. The harness is the system that actually runs and governs the agent's behaviour: its loop, tools, permissions and checks. A harness can be built with a framework, or bought ready-made.
Should a company build its own harness?
Rarely from scratch. Proven harnesses (Claude Code and the Claude Agent SDK, Codex, Copilot, cloud agent platforms) cover the loop, tools and isolation. The useful investment is in what is specific to you: business instructions, skills, connectors, validation rules and tests. A custom harness is justified for a core, high-volume or heavily regulated process.
Does a more elaborate harness cost more?
Yes, every layer of checks consumes resources. In an experiment published in March 2026, Anthropic had the same application built by a single agent, in 20 minutes for 9 dollars, then by a three-agent harness (planner, generator, evaluator), in 6 hours for 200 dollars. The result was clearly better. The level of checks must therefore be justified by the value of the task.
Does a good harness make an agent safe?
It reduces risk without removing it. Defences that rely on the model remain probabilistic, and a prompt injection can get around them. Limits set by the environment, such as blocking the network, read-only folders or no payment rights, are deterministic. They are what prevent a data leak or an irreversible action.
What is harness engineering?
It is the discipline of designing and evolving an agent's harness. Birgitta Böckeler of Thoughtworks distinguishes guides, which steer the agent before it acts (instructions, conventions), and sensors, which check afterwards (tests, linters, review by a model). Mitchell Hashimoto's principle sums up the approach: every agent mistake calls for a fix to the environment so that it does not happen again.
See also
Further reading
Sources
- The Anatomy of an Agent Harness, Vivek Trivedy, LangChain, 10 March 2026 (definition, agent = model + harness). https://www.langchain.com/blog/the-anatomy-of-an-agent-harness
- Improving Deep Agents with Harness Engineering, Vivek Trivedy, LangChain, 17 February 2026 (Terminal-Bench 2.0 from 52.8% to 66.5%, same model). https://www.langchain.com/blog/improving-deep-agents-with-harness-engineering
- Harness engineering: leveraging Codex in an agent-first world, Ryan Lopopolo, OpenAI, 11 February 2026. https://openai.com/index/harness-engineering/
- My AI Adoption Journey, Mitchell Hashimoto, 5 February 2026 (step "Engineer the harness"). https://mitchellh.com/writing/my-ai-adoption-journey
- Stop Comparing LLM Agents Without Disclosing the Harness, Zhang et al., arXiv:2605.23950, 7 May 2026 (SWE-bench Pro, 2 to 4 point shifts). https://arxiv.org/abs/2605.23950
- How good is your harness?, Jiwoo Han and Yuekai Sun, ICML 2026 workshop, 10 July 2026. https://icml.cc/virtual/2026/68323
- Harness engineering for coding agent users, Birgitta Böckeler, martinfowler.com, 2 April 2026 (guides and sensors). https://martinfowler.com/articles/harness-engineering.html
- What is harness engineering?, Thoughtworks Technology Podcast, 14 May 2026. https://www.thoughtworks.com/en-us/insights/podcasts/technology-podcasts/what-harness-engineering
- Harness design for long-running application development, Prithvi Rajasekaran, Anthropic, 24 March 2026 (single agent and three-agent harness). https://www.anthropic.com/engineering/harness-design-long-running-apps
- How we contain Claude across products, Anthropic, 25 May 2026 (93% of prompts accepted, 84% fewer prompts with the Claude Code sandbox). https://www.anthropic.com/engineering/how-we-contain-claude
- Microsoft Copilot Harness Preview Keeps Tool Approval Policy With Microsoft, Futurum Group, 3 November 2026. https://futurumgroup.com/insights/microsoft-copilot-harness-preview-keeps-tool-approval-policy-with-microsoft/
- Qu'est-ce qu'un harnais d'agent IA ?, Matthieu Eugène, Blog du Modérateur, 3 September 2026 (in French). https://www.blogdumoderateur.com/harnais-agent-ia/
- Article 14, Regulation (EU) 2024/1689 on artificial intelligence, AI Act Service Desk, European Commission. https://ai-act-service-desk.ec.europa.eu/en/ai-act/article-14
- Test harness, Wikipedia (origin of the term in software testing). https://en.wikipedia.org/wiki/Test_harness
- Introducing the Microsoft Copilot harness in Foundry Agent Service, Microsoft, 28 October 2026 (preview, consumption-based billing from 1 December 2026). https://devblogs.microsoft.com/foundry/microsoft-copilot-harness-in-foundry/
- Claude Managed Agents: get to production 10x faster, Anthropic, 8 April 2026 (hosted harness). https://claude.com/blog/claude-managed-agents