
A harness in AI is the software around a language model that turns it into an agent. The model suggests the next step and the harness carries it out: it reads a file, runs a test or calls a service, then returns the result to the model. Claude Code and Codex are ready-made harnesses for working with code. I use them every day when building websites, which is why I know the result depends not only on the model but also on the layer around it.
Agent = model + harness. The model suggests a step and the harness carries it out and verifies the result. On 11 February 2026 OpenAI reported that a team spent five months building an internal product without hand-written code: roughly a million lines and around 1,500 merged pull requests, all written by Codex. The people's work shifted to designing rules, tools, tests and feedback, which is harness engineering. Before connecting company data, ask about permissions, the sandbox and approvals. I build the harness around company data as part of AI automation, from €60 per hour.
What is a harness in AI?
The English word harness means a set of straps or a fixture that holds something in place. In AI it covers everything around the model itself: the code that calls the model repeatedly, hands it context, carries out its tool requests and decides when the work should end.
There is no formal standard for the term. In its engineering posts, Anthropic describes a harness as the loop that calls a Claude model and routes its tool calls to the right infrastructure. In February 2026, OpenAI described "harness engineering" on its own product, whose code was written by Codex. The documentation of both tools talks more about concrete parts: tools, permission modes, the sandbox, subagents. When someone tells you "we have our own harness", ask which of those parts they mean.
Harness, agent, model and framework: what is the difference?
| Term | What it is | Example |
|---|---|---|
| Model | processes input and produces output, runs nothing by itself | Claude, GPT |
| Harness | software around the model: loop, tools, context, permissions, checks | the runtime layer of Claude Code or Codex, Claude Agent SDK |
| Agent | a model wired into a harness that takes steps toward a goal on its own | Claude Code fixing a bug in a repository |
| Framework | a library you assemble your own harness from | LangGraph |
| Chat | an interface for conversation, which can have tools too | ChatGPT, Claude.ai |
The boundaries are not sharp. A chat with search and file handling already has a harness, just a simpler one with different permissions. So what separates a chat from an agent is not the interface but whether the model may use tools in a loop on its own and carry on based on the results.
How does an agent work? A loop of four steps
The agent loop in four steps
- Observe the contents of files, the output of a command, an API response, a page in the browser
- Decide based on the observation and the goal, choose the next step
- Use a tool not "write what should be done", but do it: edit a file, run a test, call a service
- Verify did the test pass, did the API return an error? Continue, fix or stop accordingly
The loop alone does not prove that the agent actually verified the result. What matters is the evidence the harness returns (test output, an error message) and the stopping conditions: a passing test, an exhausted step budget or a handoff to a person.

What is a harness made of?
The breakdown below is my own simplification. Different sources count four to eleven parts, but these keep coming back everywhere:
| Part | What it is for | What it looks like in Claude Code and Codex |
|---|---|---|
| Loop | repeats the model, tool, result step until the work is done | the agent reads, edits, runs and checks again |
| Rules | what the agent loads about the project at start | CLAUDE.md and AGENTS.md files in the repository |
| Tools | what the agent can physically do | reading and editing files, terminal commands, the web, connectors via MCP |
| Context and memory | what the model sees at a given moment and what it carries between tasks | compacting a long conversation, notes, a separate context for subagents |
| Permissions | what it may do on its own, what only after approval and what never | permission modes in Claude Code, approval rules in Codex, deny rules |
| Sandbox | isolation so a command cannot reach outside the project | file and network restrictions; Codex has the network off by default |
| Checks | verification that the result holds | tests, linters, hooks, review by a different context |
In this website's repository I keep the rules in CLAUDE.md and AGENTS.md files: where the canonical prices live, how to write headings, what must not be run when someone else is working in the folder. The agent loads them at the start of every job, so I do not have to repeat them in every brief.
The same model without a harness and with one: an example
The task: the contact form on a website stopped working.
The same model without a harness and with one
- A model in a chat without tools
- you describe the error, and the model suggests possible causes and code for a fix
- whether the fix suits your project, you find out yourself, after you copy it over and try it
- The same model in a harness
- reads the form code, runs a test and sees the concrete error
- edits the file, runs the test again and only then reports it is done
- depending on the settings, asks before deleting files or sending changes outside
The model is the same in both cases. What differs is what it may do and what feedback it gets back.
Why does the same model give different results in different tools?
The same model in three environments
- A chat without connected tools works with what you paste in; you verify the result
- A coding agent without rules has tools but no boundaries or checks; it does a lot, fast and without guarantees, exactly the situation from the article Vibe coding: 7 amateur mistakes
- An agent with a good harness loads the project rules, plans before writing, works in small steps, runs tests after each one and asks before risky actions
A harness also ages along with the models. In April 2026, Anthropic described how Claude Sonnet 4.5 ended tasks prematurely as it approached the context limit, so the team added context resets to the harness. With Claude Opus 4.5 that behaviour disappeared and the resets were only dead weight. A setup that helped last year therefore has to be measured again after a model change. How I approach this in development is described in my guide to developing an app with AI.
What is harness engineering?
Prompt engineering tunes a single instruction. Context engineering deals with everything the model sees while it works. Harness engineering goes a step further: it designs the whole environment the agent works in, meaning the rules, tools, tests and feedback.
OpenAI published a detailed account on 11 February 2026. A team spent five months building an internal product without hand-written code; Codex wrote everything. Over that time they report roughly a million lines of code and around 1,500 merged pull requests, at first with three engineers. According to the text, the people's work shifted from writing code to designing the environment, refining intent and building the feedback loops that let agents work reliably.
For an ordinary company the takeaway is simple: an agent without a described process, tests and boundaries will make mistakes no matter how good the model is. Most of the work on a company agent is exactly harness engineering.
How does an agent safely reach company data?
Principles that hold regardless of the tool:
Tools and connectors. An agent does not reach into systems "on its own". It is given a specific tool: read the calendar, search the CRM, create an email draft. For such connections the open standard MCP (Model Context Protocol) is used more and more, a universal socket through which AI applications connect to data and tools. One connector to your system can then serve several AI tools.
Least privilege. Every tool gets only the rights it needs for the task. An agent that summarises tickets does not need the right to delete them. An agent that writes email drafts does not need the right to send them.
A human before an irreversible step. Reading and drafting can run on their own. Sending, deleting, paying and anything that leaves the company waits for approval. A good harness enforces this in the tool; a sentence like "never send anything" in the brief is not enough.
A sandbox, with caveats. In Claude Code, the sandbox covers only terminal commands; file tools, MCP servers and hooks run outside it. On native Windows, Claude Code runs commands without a sandbox, and you get isolation through WSL2. Codex works with the network off by default. Before deployment, have someone show you what exactly is isolated.
Modes and deny rules. Claude Code has several permission modes, from manual approval to an automatic mode where a second model judges actions in your place. The default mode differs by version and environment. Deny rules, however, apply in every mode, so hard boundaries belong there, not in the prompt.
A log, and inputs as data. Record permissions, changes and errors, but without needless personal data and secret values. An email or a web page can contain planted instructions (prompt injection). The risk is reduced by separating untrusted content, limited rights and approvals; no prompt or harness removes it completely.

Not to be confused with Harness.io
Harness is also the name of a company with a platform for developing and deploying software (harness.io). Google results for the word "harness" therefore mix two different things. This article is about the harness around an AI model and has nothing to do with that company.
What should a company take from this?
Three things I say at every AI training session:
1. Describe the process first. What should happen after an enquiry arrives, which data is missing, who decides and how will you recognise a mistake? Then compare a simple rule, conventional automation and an agent. A first pilot need not start with building a custom system.
2. A custom assistant over company data makes sense only after that. When a process repeats, the data is in one place and it is clear what the assistant may and may not do, a custom layer starts to make sense. You are not building a model, you are building a harness: rules, connectors, permissions and checks over a model you can replace later. That is what I do as part of AI automation and custom applications: not an "AI chatbot", but an assistant with precisely defined tools and rights.
3. Assess the whole solution. Alongside model quality, look at permissions, sandbox, logs, verification, costs and the ability to change provider. I show the concrete rules and the division of roles between several contexts in the course.
Summary
- A harness is the software around an AI model: loop, rules, tools, context and memory, permissions, sandbox and checks.
- An agent is a model wired into a harness. A framework is a library you build a harness from.
- The result depends on both the model and the harness, and a harness has to be retuned for new models.
- An agent reaches company data through bounded tools (often MCP), with least privilege, approval before an irreversible step and deny rules enforced in the tool.
- A company should start with the process and the data, not with buying an "agent".
Frequently asked questions
What is a harness in AI and how is it different from the model?
A model processes input and produces output. A harness is the software around it: loop, tools, context, permissions and checks. Thanks to it the model does not just advise, it reads files, runs tests and carries on based on the result.
What is the difference between an AI agent and a harness?
An agent is the whole, meaning model plus harness. The harness is the part that gives the agent tools, memory and boundaries. A framework, for example LangGraph, is a library you assemble your own harness from. Ready-made harnesses are Claude Code and Codex.
Is Claude Code a harness?
Yes. Claude Code is an application that wraps Claude models in tools, permission modes, subagents, hooks, skills and connectors via MCP. Claude is the model, Claude Code is the harness around it. The same holds for Codex and OpenAI models.
What is an AI harness made of?
A loop, rules, tools, context and memory, permissions, a sandbox and checks. Example: the model proposes a bug fix, the harness writes it to a file, runs a test, returns its result and the model fixes whatever failed.
What is harness engineering?
Designing the whole environment around a model: rules, tools, tests and feedback. It is broader than writing prompts. The term is used, for example, in OpenAI's February 2026 text about a product whose code was written by Codex.
Is an AI harness related to the company Harness.io?
No. Harness.io is a company with a platform for developing and deploying software. Harness in AI is a general name for the layer around a language model.
What is MCP?
An open standard that describes how AI applications connect to data sources and tools. One connector to your system can then serve several AI tools. What matters for a company is that the connection is bounded and has its own permissions.
Sources and links
- Anthropic: Effective harnesses for long-running agents, 26 November 2025, a harness for long tasks and the Claude Agent SDK
- Anthropic: Scaling Managed Agents, 8 April 2026, the definition of a harness as a loop and how its assumptions age
- OpenAI: Harness engineering, 11 February 2026, a product written by Codex, read 20 October 2026
- Claude Code: permission modes and sandboxing, read 20 October 2026
- Codex: approvals and security, sandbox, approval rules, network off, read 20 October 2026
- Wikipedia: Agent harness, an overview of the term and the synonym agent scaffolding
- Model Context Protocol, an open standard for connecting AI applications to data and tools
- Anthropic: Building effective agents, 19 December 2024, the difference between a workflow and an agent
