Same model, same week, same tasks: 87.2% functional in one tool, 61.5% in another. That is what Endor Labs measured in April 2026 when it ran GPT-5.5 through Cursor and through Codex on its agent security benchmark. The model did not change. The software wrapped around it did. That software has a name: the agent harness.
An agent harness is all the software around a language model that lets it act as an agent: the loop, the tools, the memory, the execution environment and the guardrails. LangChain sums it up in one formula, Agent = Model + Harness, and one line: "If you're not the model, you're the harness."
This guide explains what an agent harness is, the seven components inside one, why it matters as much as the model, how it differs from a framework or an SDK, and what a harness needs when the agent has to do real business work while nobody is watching.
In a hurry? Put a model to work inside a hosted harness, free for 5 days.
Agent harness, defined
Agent = Model + Harness
In The Anatomy of an Agent Harness, LangChain defines a harness as "every piece of code, configuration, and execution logic that isn't the model itself." The model brings the reasoning. The harness brings everything else: the tools it can call, the place it runs, what it remembers, when it stops and what it is not allowed to do.
A raw model is not an agent. It becomes one when a harness gives it state, tools and a way to act.
Why a raw model is not an agent
A large language model maps tokens in to tokens out. On its own it keeps no state between calls, runs no code, opens no files and touches no app. Ask it to "clean up the CRM" and the best it can do is describe how you might do it. A harness turns that description into actions: it gives the model a tool to read the CRM, executes the call, feeds the result back, and loops until the job is done or a rule says stop.
Where the word comes from
A harness channels raw force: a horse harness turns strength into pulling a cart, a climbing harness turns a fall into something survivable. Software engineers already used "test harness" for the code that runs and checks other code. In AI, the same idea was often called agent scaffolding, the term safety researchers used for the code built around a model to evaluate what it can do as an agent. Today "agent harness" and "agent scaffolding" mean the same thing, and "harness" is the word that stuck.
What is inside an agent harness: 7 components
Every serious AI agent harness, whether it ships as a coding tool or as a hosted platform, is built from the same seven parts. Each one solves a specific failure.
1. The agent loop
The loop is the heartbeat: the model reasons, picks an action, the harness executes it, the result comes back as an observation, and the cycle repeats. The harness also decides when the loop ends, which matters as much as how it runs. ReAct is the best-known loop pattern, and our guide to ReAct agents covers it in depth.
2. Tools and tool dispatch
Tools are how the model touches the world: a shell, a code runner, a browser, APIs, files. The harness describes each tool to the model, validates the arguments it sends back, runs the call and returns the output. Most harnesses now speak the Model Context Protocol so any MCP server plugs in, and package repeatable know-how as agent skills.
3. The execution environment
Tools need somewhere to run. That can be a sandbox, a container, a filesystem or a full computer with a screen. The environment sets the blast radius: an agent in a throwaway sandbox can only break the sandbox. When the agent needs to click through real apps, the environment becomes a desktop, which is what computer use agents do.
4. Memory and state
Context windows end; work does not. A harness keeps state outside the model: progress files, a git history, a database, an AGENTS.md file with standing instructions. That is how an agent picks up tomorrow where it stopped today. Our article on AI agent memory breaks down the types.
5. Context management
Even a long context window fills up. The harness decides what the model sees on each turn: it compacts old turns, offloads bulky tool outputs to files, and loads only what the step needs. This is a discipline of its own, and context engineering goes much deeper than this section should.
6. Guardrails and approvals
Permissions, scopes, rate limits, and the most important control of all: a human approval before an action that cannot be undone. A harness without guardrails is a model with root access. See our guides to AI agent guardrails and human-in-the-loop AI agents.
7. Observability
Logs and traces of every step, tool call, token and cost. Without them, "what did the agent do last night?" has no answer, and a failure cannot be debugged. Our guide to AI agent observability covers what to record.
| Component | Its job | What breaks without it |
|---|---|---|
| Agent loop | Reason, act, observe, repeat, stop | The model answers once and never finishes a task |
| Tools | Let the model act on files, apps and APIs | The agent can only describe work, not do it |
| Execution environment | A safe place for tools to run | Actions hit production with no isolation |
| Memory and state | Carry progress across sessions | Every run starts from zero |
| Context management | Keep the right information in view | Quality drops as the context window fills |
| Guardrails and approvals | Limit what the agent may do alone | One bad decision becomes an irreversible action |
| Observability | Record every step and cost | Failures are invisible and costs drift |
Why the harness matters as much as the model
The industry spent two years comparing models. The evidence now says the harness moves results just as much.
- Same model, 26-point gap. In the Endor Labs benchmark, GPT-5.5 reached 87.2% functional correctness in Cursor and 61.5% in Codex. Same model, different harness, a gap of roughly 26 points.
- Top 30 to Top 5 by changing only the harness. In The Anatomy of an Agent Harness, LangChain reports that it moved its coding agent from outside the Top 30 to the Top 5 on Terminal Bench 2.0 without touching the model. The LangChain article also points out that on that leaderboard, Opus 4.6 in Claude Code scores far below Opus 4.6 in other harnesses.
- Long-running work is a harness problem. Anthropic found that its agents tended to declare a project finished too early and left undocumented state behind between sessions. The fix was harness design: an initializer agent that writes a feature list (over 200 features in its example), progress files, git commits, and a rule to mark a feature as passing only after testing it.
Effective harnesses for long-running agentsHow an initializer agent and an incremental coding agent help the Claude Agent SDK make steady progress across many context windows.There is a fair counterpoint. Models are absorbing some harness work: newer ones plan better, call tools more reliably and need less hand-holding. That shifts what the harness does, it does not remove it. A model will never provide its own computer, its own permissions or its own audit trail. Those are properties of the system around it.
Choose the harness as carefully as you choose the model. You will spend more time living with it.
Agent harness vs framework vs model vs SDK
These four words get mixed up constantly. They sit at different layers.
| Layer | What it is | Examples | You use it to |
|---|---|---|---|
| Model | The reasoning engine | GPT, Claude, Gemini | Think, write, decide |
| Framework | Libraries to build agent logic in code | LangGraph, CrewAI, AutoGen | Write your own agent application |
| SDK | A packaged toolkit from a model vendor | Claude Agent SDK, OpenAI Agents SDK | Build on a vendor's agent runtime |
| Harness | The runtime that makes a model act | Claude Code, Codex, Cursor, a hosted operations layer | Run an agent on real work |
Google Cloud draws the line well in its definition of an agent harness: orchestration frameworks help developers chain prompts and data sources, while a harness is the deployment environment the agent actually runs in. A framework is about writing the agent. A harness is about running it.
The categories also overlap. You can build a harness with a framework, and an SDK like the one we cover in our Claude Agent SDK guide ships a harness you can embed. Some engineers also split the inner harness that the tool vendor ships from the outer harness a team adds on top: its own rules files, tests, checks and approvals. For how these pieces fit into a full system design, see our breakdown of AI agent architecture, and for the machines underneath, AI agent infrastructure. The broader "is this an operating system?" debate lives in our article on the agentic OS. Different altitudes, different articles.
Examples of agent harnesses
Coding harnesses
Almost every page you will find about agent harnesses talks about coding agents, and for good reason: they are the most mature harnesses today. Claude Code, Codex, Cursor, Antigravity and OpenHands each wrap a model with a terminal, a filesystem, a git workflow, permission prompts and context compaction. They are built for a developer sitting in front of the session, or for a background task that ends in a pull request, which we cover in our guide to background agents.
Business operations harnesses
A second kind of harness is emerging for work that is not code: chasing invoices, triaging an inbox, qualifying leads, updating a CRM, preparing a weekly report. The model is the same. The harness requirements are different:
- It must run when your laptop is closed, on a schedule or a trigger.
- It must reach business apps, not just a terminal: Gmail, Slack, Stripe, HubSpot, Notion.
- It must ask a human before sending, paying or deleting.
- It must leave a record a non-engineer can read.
That is the operations layer of a harness, and it is where most teams get stuck.
Harness engineering: improve the harness, not just the prompt
When an agent makes a mistake, the instinct is to rewrite the prompt. Harness engineering is the better reflex. Mitchell Hashimoto described it in February 2026 in My AI Adoption Journey: "anytime you find an agent makes a mistake, you take the time to engineer a solution such that the agent never makes that mistake again." Who coined the term is debated, several engineers were using it around the same time, but the practice is clear.
Birgitta Böckeler, writing on martinfowler.com, gives it a useful structure. Guides are feedforward controls that steer the agent before it acts: rules files, conventions, scoped tools. Sensors are feedback controls that let it self-correct after it acts: tests, linters, type checks, validation scripts.
In practice, a harness fix often looks like a line in a rules file rather than a clever prompt:
# AGENTS.md (excerpt)
- Never mark a task done until `npm test` passes.
- Invoices over 5,000 EUR: draft the email, then stop and request approval.
- Write a progress note to progress.md before ending a session.A five-point harness engineering checklist for any team running agents:
Running agents for real work: the operations layer of a harness
A coding harness on a laptop is perfect for a developer in the loop. It stops being enough the moment the work has to happen at 3 a.m., in company apps, with no developer watching. That is the gap Rerun fills.
Where Rerun fits, and where it does not
Rerun is a hosted harness for business work. It is not a model: you bring your own ChatGPT or Claude subscription, an API key, or use the models included in the plan. It is not a framework either: there is no code to write. On Rerun, these agents are called coworkers, and the harness around each one provides:
- Tools: 3,000+ apps and MCP servers a coworker can work in.
- An execution environment: a private cloud machine with a browser and a file system, so work continues when your computer is off.
- A shared workspace: coworkers share files and databases and can hand work to each other.
- Schedules and triggers: a coworker can run on a calendar or react to an event.
- Approvals: a coworker pauses before a sensitive action, asks you in the app, and resumes where it stopped once you approve.
- Logs: every action, tool call and token, readable by anyone on the team.

What Rerun does not do: it does not replace a coding harness like Claude Code or Cursor for writing software, and it does not train or host your model. If you are building a custom agent product in code, a framework or an SDK is the right layer.
Why not a flowchart or a chatbot?
Zapier, Make and n8n run fixed flowcharts: if A happens, do B. Every branch is wired in advance, so when the email does not match the template, the Zap stops. A harness gives the model room to work out the steps itself, inside guardrails, which is a different tool for a different job. Our Rerun vs Zapier comparison goes through the trade-offs.
Chatbots answer questions. They wait for you, act only inside the conversation, and forget the job when the tab closes. A harness lets the agent act on its own and remember. Our article on AI agents vs chatbots explains the difference.
Most teams start with a ready-made coworker rather than a blank page. For example, an executive assistant coworker comes already wired to email and calendar:

Executive Assistant
AI Executive Assistant: Your Morning Briefing
You describe the job once, then watch it run from the dashboard. Rerun is one plan from $29 a month with unlimited coworkers and unlimited seats, after a free 5-day trial.
The agent harness is where agents succeed or fail
A model decides what to do. The agent harness decides whether it can do it, safely, repeatedly and on its own: the loop, the tools, the environment, the memory, the context, the guardrails and the logs. Benchmarks now show the same model gaining or losing more than 20 points depending on its harness, and long-running agents fail on harness problems far more often than on model problems.
So pick a harness as carefully as you pick a model, keep improving it every time the agent slips, and match it to the work: a coding harness for code, an operations harness for the business work that has to run without you.

AI Agent Architecture Explained: Components, Patterns & Control Plane
A practitioner's guide to AI agent architecture: the core components, the perceive-reason-act loop, single vs multi-agent patterns, and the production control plane most designs miss.
Frequently asked questions
What is an agent harness?
An agent harness is all the software around a language model that lets it act as an agent: the agent loop, tools, execution environment, memory, context management, guardrails and observability. LangChain sums it up as Agent = Model + Harness. The model reasons, the harness lets it act.
Is an agent harness the same as agent scaffolding?
Yes. Agent scaffolding is the older term, used by safety researchers for the code built around a model to evaluate what it can do as an agent. Agent harness is the word most teams use today. Both describe everything around the model that turns it into a working agent.
Do I need an agent harness for a simple chatbot?
No. A single prompt and response needs little more than an API call. A harness becomes essential when the work takes many steps, calls tools, runs for a long time, or has to happen without a person watching, because that is when state, permissions, approvals and logs start to matter.
Is LangChain an agent harness?
Not by itself. LangChain and LangGraph are frameworks: libraries you use to write agent logic in code. You can build a harness with a framework, but the harness is the runtime the agent actually runs in, with its tools, environment, guardrails and logs.
Is Claude Code an agent harness?
Yes. Claude Code wraps a Claude model with a terminal, file access, a git workflow, permission prompts and context compaction. Codex, Cursor and OpenHands are other coding harnesses. Benchmarks show the same model scoring very differently from one of these harnesses to another.
What is harness engineering?
Harness engineering is the practice of fixing the system around an agent instead of only rewriting prompts. Each time an agent makes a mistake, you add a permanent fix such as a rule in a rules file, a test, a narrower tool or an approval step, so the agent cannot make that mistake again.
Is Rerun an agent harness?
Rerun is a hosted harness for business work. On Rerun, agents are called coworkers. You bring your own ChatGPT or Claude subscription or an API key, and Rerun provides the rest: 3,000+ apps and MCP servers, a private cloud machine, schedules and triggers, human approvals and logs. It is not a model and not a framework.







