Agent Harnesses
In Short
An agent harness is the software that wraps a language model and turns it into an agent. The model supplies the reasoning. The harness runs the loop, hands the model its tools, carries out the actions the model asks for, feeds the results back, and manages the limited context window. The same model can perform very differently depending on the harness around it, which is why a benchmark result measures a system, the model plus its harness, not the model alone. Claude Code, OpenAI Codex, and SWE-agent are harnesses. The vocabulary is still settling, and the words scaffold, runtime, and harness are often used for overlapping ideas.
Snapshot caveat:
The concept is stable, but the named products and the exact vocabulary are still moving. This reflects June 2026.
01. What It Is
A language model on its own only reads text and writes text. It cannot open a file, run a command, search the web, or check whether its last action worked.
An agent harness is the layer of ordinary software that gives a model those abilities and runs it in a loop, the structure described in agents-and-agentic-workflows.
Anthropic states the split plainly. Writing about the SWE-bench coding benchmark, it says "an 'agent' refers to the combination of an AI model and the software scaffolding around it." That scaffolding is "responsible for generating the prompts that go into the model, parsing the model's output to take action, and managing the interaction loop where the result of the model's previous action is incorporated into its next prompt." The harness is that scaffolding.
A useful picture is brain and body. The model is the brain that decides what to do. The harness is the body and nervous system that senses the environment, carries out the decision, and reports back what happened. Anthropic's own documentation uses the term directly, describing Claude Code as "the agentic harness around Claude" that "provides the tools, context management, and execution environment that turn a language model into a capable coding agent."
02. Why It Matters
The harness, not just the model, decides how well an agent works.
Anthropic found that "the performance of an agent on SWE-bench can vary significantly based on this scaffolding, even when using the same underlying AI model," and that outside developers raised scores "around the same model" purely by improving the scaffold. The research behind SWE-agent reached the same conclusion. Its authors showed that a custom interface "significantly enhances an agent's ability to create and edit code files, navigate entire repositories, and execute tests," reaching results "far exceeding the previous state-of-the-art achieved with non-interactive" use of language models.
The practical lesson is that a benchmark number measures a system, the model plus its harness, not a model in isolation. When two agents using the same model report different scores, much of the difference is the harness.
This is one reason agent benchmarks are hard to read, a theme in evals-and-benchmarking.
It also explains why "which model is best" is the wrong first question when building an agent. A capable model in a poor harness is unreliable, and a modest model in a well-built harness can outperform it.
03. How It Works
The loop the harness runs
Anthropic's short definition of an agent is "LLMs autonomously using tools in a loop." The harness is what runs that loop. Each turn, it sends the current context to the model and reads the reply. If the model asked to use a tool, the harness runs the tool and adds the result to the context for the next turn.
Tool use is a contract between the running software and the model. As Anthropic's tool-use documentation puts it, "the model never executes anything on its own." It emits a structured request, the harness runs the operation, and the result flows back into the conversation.
The harness owns that execution, covered in tool-use-function-calling.
The loop also needs to end. Harnesses include stopping conditions, "such as a maximum number of iterations," so a confused agent cannot run forever.
What the harness manages
Beyond the bare loop, a harness provides the parts a model cannot supply for itself:
- Tools and their dispatch:
The harness defines what the model can do, an edit-file tool, a run-command tool, a search tool, and runs each call. Without tools, a model can only produce text. - Context management:
A loop keeps generating text that piles into a fixed-size context window. The harness curates it. One common technique is compaction, which Anthropic describes as "taking a conversation nearing the context window limit, summarizing its contents, and reinitiating a new context window with the summary." See context-window and context-engineering. - Memory:
Short-term state for the current task, and in some harnesses long-term memory across sessions, often through files or a database the model reads and writes. - Permissions and human checkpoints:
Gates that pause before a risky action and ask a person, or block it outright. In Claude Code these controls live in the harness, not the model. - A safe place to act:
A sandbox, so the agent's commands run in a contained environment rather than directly on a live system.
Framework, runtime, harness
These three words get used loosely. LangChain's documentation draws a usable line. A framework provides the standard abstractions for models, tools, and agent loops that you wire together yourself. A runtime provides "the tooling for running agents in production," along with the state and persistence a long-running agent needs. A harness is the "opinionated, batteries-included" layer with tools and capabilities already built in. A coding tool you install and point at a task is a harness. The lower layers are what it is built from.
04. Examples
These are agent harnesses, not models. Each wraps a model you can often swap out.
- Claude Code:
Anthropic's "agentic coding tool that lives in your terminal," and Anthropic's own worked example of an agentic harness around a model. - OpenAI Codex:
"OpenAI's coding agent that you can run locally from your terminal." It "can read, change, and run code on your machine." - SWE-agent:
A research harness from Princeton that "enables your language model of choice to autonomously use tools to fix issues in real GitHub repositories." It introduced the agent-computer interface idea. - OpenHands:
An open-source platform that "runs autonomous agents that plan, write, and apply changes across your codebase," with sandboxed execution. - OpenAI Agents SDK and LangGraph:
Toolkits for building your own harness.
The Agents SDK ships "a built-in agent loop that handles tool invocation, sends results back to the LLM, and continues until the task is complete," plus handoffs for delegating to other agents, a pattern explored in multi-agent-orchestration.
Many harnesses connect to tools through the Model Context Protocol, "an open-source standard for connecting AI applications to external systems," described in mcp.
Browser and computer-use agents are harnesses too, covered in agentic-browsers-and-computer-use.
05. Common Misconceptions
"The model is the agent."
The model is the reasoning part. The agent is the model plus the harness around it. Swap the harness and the same model behaves differently.
"A better model always means a better agent."
Not on its own. A strong model in a weak harness is unreliable, and a well-built harness can lift a modest model above a stronger one running in a poor setup. Much of an agent's reliability lives in the harness.
"The harness is just a prompt."
A prompt is one input. A harness is running software, the loop, tool execution, context management, permissions, and error handling, that surrounds every prompt and decides both what the model sees and what its output is allowed to do.
"Harness, scaffold, and runtime mean exactly the same thing."
They overlap and are often used interchangeably. Scaffold is the common word in benchmarking, runtime stresses the production loop, and harness usually means the whole opinionated package. The boundaries are not fixed.
06. Key Terms
| Term | Plain-language meaning |
|---|---|
| Agent harness | The software around a model that runs the loop, hands it tools, runs its actions, and manages context. It is what turns a model into an agent. |
| Scaffold | Another name for the harness, common in benchmarking. Model plus scaffold is what people loosely call an agent. |
| Agent loop | The repeating cycle the harness drives. Send context to the model, run the tool it asks for, feed the result back, repeat until done or stopped. |
| Agent-computer interface (ACI) | The tools and interaction format a harness gives a model, the agent equivalent of a screen and keyboard. |
| Context management | The harness keeping the limited context window useful, including compaction, which summarizes a near-full window and starts a fresh one. |
| Runtime | The layer that runs the agent loop in production, with state and persistence. Often used as a near-synonym for harness. |