An agent harness is the software around an AI model that turns it into an agent: it runs the loop, executes the model’s tool calls, decides what goes into the context window, and enforces what the model may do. Nielsen Norman Group defines it as “the software around an AI model that runs its execution loop: it carries out the model’s requests to use tools, returns the results, and controls what information the model receives and what it is allowed to do.” LangChain’s shorter version is that a harness is “every piece of code, configuration, and execution logic that isn’t the model itself.”
Agent harness meaning
The word is used for the whole non-model system, so definitions differ in how much they list, not in what they exclude.
| Source | How it defines the harness |
|---|---|
| LangChain | Everything that is not the model: system prompts, tools, skills and MCP servers, bundled infrastructure such as a filesystem, sandbox or browser, orchestration logic, and hooks or middleware |
| Anthropic | ”the system that enables a model to act as an agent: it processes inputs, orchestrates tool calls, and returns results” |
| OpenAI | The Codex harness “provides the core agent loop and execution logic that underlies all Codex experiences” |
| ”everything that is not the model”, described as “deterministic glue code around your model” | |
| Thoughtworks | ”the software environment around an AI model that gives the agent the context, tools, rules, state, and feedback it needs to actually get work done” |
| Fowler’s site | A shorthand for “everything in an AI agent except the model itself”, narrowed by the author to the setup around a coding agent |
What an agent harness does
The sources name the same handful of jobs. The table shows which ones each source says a harness covers.
| Component | What it covers | Named by |
|---|---|---|
| Execution loop | Send the prompt to the model, run any tool call it asks for, append the result, repeat until the model answers | OpenAI, NN/g, LangChain |
| Tools and environment | Tool calls, a filesystem, bash or code execution, a sandbox, a browser | LangChain, Thoughtworks |
| Context management | What enters the window, compaction, summarization, offloading large results | OpenAI, Anthropic, LangChain docs |
| Permissions and limits | Which tools the model may use, when a human approves, caps on time, cost and steps | NN/g, LangChain docs, Google |
| Memory and state | Session state, memory files such as AGENTS.md, progress carried across sessions | LangChain, Google, Anthropic |
| Sub-agents | Spawning agents with a fresh context window for isolated or parallel work | LangChain docs, Cursor, Google |
| Feedback and verification | Tests, linters, type checks and build results the agent reads before it continues | Thoughtworks, Fowler’s site |
| Evals and tracing hooks | Instrumentation that shows whether a harness change helped | Cursor, OpenAI |
Some of these map to other Learn pages: tool calling is the loop’s core step, context engineering covers the context row, AGENTS.md is one of the memory file standards LangChain mentions, and LLM tracing covers the instrumentation row.
LangChain argues that a harness is needed because a model out of the box cannot do some things. It lists maintaining durable state across interactions, executing code, accessing realtime knowledge, and setting up environments and installing packages. The post says these are “harness level features”. Thoughtworks makes the same point from the product side: “A better model does not automatically mean a better agent.”
Agent harness vs agent
LangChain writes the relationship as a formula, “Agent = Model + Harness”, and adds that “A raw model is not an agent.” Google’s codelab says “An AI agent is a combination of the model and the harness around it.” Fowler’s site uses the same equation.
Thoughtworks places the terms slightly differently. It calls the harness the environment that gives the agent what it needs to work, and describes the agent as “the model working through that environment”. In that framing the agent is the model in action and the harness is the surroundings, rather than the agent being the sum of both.
The practical consequence is the same in each version. Two products can use one model and behave differently because the harness differs. NN/g puts it this way: “Knowing which AI model a product uses does not tell you whether its harness can support your particular task.” Cursor makes the same point from the builder side: “The harness and the model together determine how good the agent is”.
Agent harness vs framework, runtime and scaffold
These words overlap. LangChain’s docs are the one source that sets them side by side, and the table below uses its taxonomy. Other sources use the words differently, which is noted after the table.
| Framework | Runtime | Harness | |
|---|---|---|---|
| What it provides | Abstractions that make it easier to get started when building with LLMs | Tooling for running agents in production, such as durable execution, streaming, human-in-the-loop and persistence | Opinionated, batteries-included tooling: predefined tools, prompts and subagents |
| Examples LangChain lists | LangChain, Vercel’s AI SDK, CrewAI, OpenAI Agents SDK, Google ADK, LlamaIndex | LangGraph, Temporal, Inngest | Deep Agents SDK, Claude Agent SDK, Manus, and other coding CLIs |
| Typical stance | You assemble the agent from parts | You get reliability for long-running, stateful work | You start from a working agent and change pieces |
Where the sources disagree:
- Scaffold. Anthropic treats the two as the same thing: “An agent harness (or scaffold)”. It does not draw a line between them.
- Frameworks and harnesses. Thoughtworks says an agent framework or SDK “can provide building blocks” that “can form part of a larger harness”. Google’s codelab lists “Building application harnesses” as a category, defined as using SDKs or agent frameworks such as ADK, LangChain or CrewAI to make a custom harness. LangChain files ADK and CrewAI under frameworks.
- OpenAI. OpenAI’s agents guide separates a managed option from an SDK. For the Agents API it says “OpenAI runs a managed Codex harness”. For the Agents SDK it says “The SDK runs inside your application”, and that its runner handles the agent loop and handoffs.
- Eval harness. Anthropic defines “An evaluation harness” as the infrastructure that runs evals end to end, which is a different thing from the agent harness. When an agent is evaluated, Anthropic says, “we’re evaluating the harness and the model working together”. See how to evaluate an AI agent.
Agent harness engineering
Harness engineering is the practice of building and tuning this layer. Three named posts from 2026 describe it in different ways.
- OpenAI, in February 2026, wrote about a team whose “primary job is no longer to write code, but to design environments, specify intent, and build feedback loops that allow Codex agents to do reliable work”. It also reports that a single large AGENTS.md failed, so the team treats it “as the table of contents” with pointers to a structured docs directory. The post describes one internal product and one team, so its results are a case, not a benchmark.
- Birgitta Bockeler, in April 2026, split the controls around a coding agent into two kinds. Guides are feedforward controls that “steer it before it acts”. Sensors are feedback controls that “observe after the agent acts and help it self-correct”. She argues you need both: feedback alone gives an agent that repeats mistakes, and feedforward alone gives one that never learns whether the rules worked.
- Cursor, in April 2026, described treating its harness like a product: form hypotheses, run offline evals with its CursorBench suite, and A/B test harness variants on real usage. It also customizes the harness per model, switching to “that model’s customized set of prompts and tools” when a user changes model.
Anthropic’s post on long-running agents, from November 2025, is an earlier example. It says compaction alone “isn’t sufficient” for work that spans many context windows, and describes pairing an initializer agent with a coding agent that leaves clear artifacts for the next session.
Harness design also changes how benchmarks read. LangChain reports improving its coding agent from Top 30 to Top 5 on Terminal Bench 2.0 “by only changing the harness”, and says a given model scores differently in different harnesses. These are LangChain’s own claims about a public leaderboard.
LangChain also expects the balance to shift: “some of what lives in the harness today will get absorbed into the model”.
Agent harness examples
The table lists harnesses that the vendors or authors themselves describe with that word, and what each source says about it.
| Harness | Who calls it a harness | Notes from the source |
|---|---|---|
| Claude Code and the Claude Agent SDK | Anthropic, on Claude Code and on the SDK | Claude Code is “a flexible agent harness”; the SDK is “a powerful, general-purpose agent harness” with context management such as compaction |
| Codex harness (Codex CLI) | OpenAI | Provides the core agent loop and execution logic behind all Codex experiences |
| Cursor agent | Cursor | Prompts and tools customized per model, and tested with offline evals and online A/B tests |
| Antigravity, Claude Code, GitHub Copilot | Listed as examples of “core harnesses”, meaning coding agent systems | |
| Deep Agents | LangChain | Adds planning, a virtual filesystem, subagent spawning and long-term memory on top of LangChain and LangGraph |
| Manus | LangChain docs | Listed by LangChain as an agent harness |
Open source agent harness options
Only some of the harnesses above publish their code. This table gives the license each project states, as shown on its own repository or docs.
| Project | License as stated | Does the source call it a harness? |
|---|---|---|
| Deep Agents | MIT | Yes: “an open source agent harness” |
| Codex CLI | Apache-2.0 | OpenAI calls its core logic the Codex harness |
| OpenHands software agent SDK | MIT | Described by its authors as an SDK for building AI agents, with no use of the word harness on the repository page |
| Claude Agent SDK | Governed by Anthropic’s Commercial Terms of Service, except where a component’s own LICENSE file says otherwise (the Python repository includes an MIT LICENSE file) | Anthropic calls it a general-purpose agent harness |
License and repository terms change, so check the repository before depending on any of them.
What to check when choosing a harness
NN/G suggests comparing products “using the same tasks and inputs” and treating differences in output as “a reason to investigate the system”. Its checklist for the harness side is connections, permissions and work limits. For anything built in-house, the sources above point to the same questions: where the agent runs, what tools it can reach, how it carries state between sessions, and how it verifies its own work.
Because a harness and a model are evaluated as one system, a harness change needs its own measurement. For that, see how to evaluate an AI agent and LLM tracing.