An agent harness is the software around a language model: the tools it can call, the context it sees, the state it keeps and the checks that stop it wandering off. The usual shorthand is Agent = Model + Harness. Anthropic uses the word for both Claude Code and Claude Managed Agents, and other vendors use it a little differently, which is where the confusion starts. Here you get a plain definition, one task traced through the parts, a component diagram in table form, and an ownership matrix showing what you build yourself and what you rent.
What an agent harness is, in plain terms
LangChain's line, quoted by DataCamp, is the shortest version: "If you're not the model, you're the harness." Databricks gives the longer one: software infrastructure that wraps around an LLM and enables it to act on tasks, not just respond to prompts. The model reasons. The harness gives that reasoning somewhere to act, something to remember and rules to follow.
Anthropic's own wording is worth reading closely. The Claude Code docs say the agentic loop is powered by two components, models that reason and tools that act, and that Claude Code is the layer around the model that provides the tools and manages the context the model sees. In their words, this surrounding layer is what the term agentic harness refers to. The Managed Agents overview then describes that service as a pre-built, configurable agent harness running in managed infrastructure.
Two caveats before going further. DataCamp itself calls the formula "a mental model, not an industry standard" and says some vendors use harness, framework and scaffold to mean roughly the same thing. And the vocabulary is young: DataCamp traces the spread of the label to Mitchell Hashimoto using "harness engineering" in a February 2026 blog post.
One narrower definition is useful too. Knowlee describes a harness as the complete execution environment provided to an autonomous agent for a bounded task. Bounded is the interesting word. It treats the harness as something scoped to one job, not a permanent platform.
One task, traced through the parts
The Claude Code docs give a worked example for the request "fix the failing tests". Claude does roughly this:

- Run the test suite to see what's failing.
- Read the error output.
- Search for the relevant source files.
- Read those files to understand the code.
- Edit the files to fix the issue.
- Run the tests again to verify.
The docs frame the loop as three phases that blend together: gather context, take action, verify results. The model decides each next step. Everything else on that list is the harness doing its job. Something has to expose "run a command" and "edit a file" as callable tools. Something has to feed the error output back in without drowning the context window. Something decides whether step five may write to disk without asking you. And something records what happened.
Here's one way to draw it. This table is my own grouping of the components named across the sources, not a standard and not an Anthropic diagram.
| Component | What it does | Where it shows up in the trace |
|---|---|---|
| Model | Reasons and picks the next step | Decides to read the error before editing |
| Tool layer | Exposes file, search, execution and web actions | Steps 1, 3, 4 and 5 |
| Context management | Controls what the model sees, summarises when needed | Step 2, error output fed back in |
| State and memory | Keeps history and files across turns | The edit from step 5 is still there at step 6 |
| Execution sandbox | The place commands actually run | The test runs in steps 1 and 6 |
| Guardrails | Permissions, approvals, allow-lists | Whether step 5 needs your sign-off |
| Verification | Checks the result against something real | Step 6 |
| Event log | Records the run for replay and audit | The history you can read afterwards |
Eight rows is a choice. Count differently and you get a different diagram, as the next section shows.
Model, SDK, framework, harness: where the lines fall
Four words get mashed together, so here's a rough separation:
- Model: the reasoning engine. Anthropic's Messages API is described as direct model prompting access, best for custom agent loops and fine-grained control.
- SDK: a library you call to build agent behaviour yourself. Our Claude Agent SDK guide covers that side in detail.
- Framework: per Salesforce, the framework provides the libraries to build an agent, while the harness is the actual runtime system that governs how the agent behaves in a real-world setting.
- Harness: the running thing that wires tools, context and state around the model.
Those boundaries blur in practice. A framework can ship with a harness inside it, and a managed service can hide the framework entirely.
Two more neighbours matter. Knowlee separates harness from runtime: a runtime hosts many harness instances, while a harness is the bounded context for one task. Fiddler separates harness from control plane: a harness manages the runtime for a single agent, while a control plane provides observability, evaluation, monitoring and governance across every agent in an organisation. DeepWiki commentary on a "Meta-Harness" idea goes further and splits the agent into Session (event log), Harness (orchestration loop) and Sandbox (execution environment). That's one commentator's reading, but it shows the harness can be one swappable piece rather than the whole box.
And the component count? Nobody agrees. Fiddler lists five. A survey proposing a taxonomy from 23 systems uses six. Fountain City lists seven, synthesised from eight published articles between March and April 2026. Databricks titles a section "Eight building blocks every production harness needs". They're slicing the same ground differently. The survey does add one useful point: the components form a dependency graph, and its execution loop depends on tools, context construction and state. Pull one out and the others wobble.
Who owns what: an ownership matrix
This is the part most definitions skip. The matrix below is illustrative and is my reading of Anthropic's documentation. It is not an Anthropic table, and the middle column depends heavily on which library you pick.
| Concern | Messages API | Agent SDK or other framework | Managed Agents (beta) |
|---|---|---|---|
| Agent loop | You write it | You wire it, with library help | Anthropic runs it |
| Tool execution | You | Mostly you, check the library | Built in: Bash, file operations, web search and fetch, MCP servers |
| Sandbox | You | You | Anthropic-managed cloud sandbox, or a self-hosted sandbox on your infrastructure |
| Prompt caching and compaction | You | Depends on the library | Built into the harness |
| Event history | You store it | You store it | The service keeps it, and you can fetch it in full |
| Permission and approval design | You | You | You still choose the agent's tools and skills |
| Definition of "verified" | You | You | You still decide what done means |
| Cross-agent governance | You | You | You |
Read the bottom three rows twice. Renting a harness moves the plumbing off your plate. It does not move the judgement calls.
A few facts about the managed option, from the overview. It's built around four concepts: an Agent (model, system prompt, tools, MCP servers and skills), an Environment (where sessions run), a Session (a running agent instance performing one task) and Events (the messages between your app and the agent). It's in beta and requires the managed-agents-2026-04-01 beta header on all requests. Because sessions are stateful and stored server-side, it's not currently eligible for Zero Data Retention or HIPAA BAA coverage, with the exception of Zero Data Retention for self-hosted Managed Agents. Setup and deployment mechanics live on the Managed Agents pages, so I'll stay on architecture here.
One more data point on ownership. Anthropic's commerce blueprint says its implementations can be built using the Messages API, the Agent SDK or Claude Managed Agents (beta). Same agent behaviour, three different splits of responsibility.
Tools, state and verification: choose on purpose
Whichever column you land in, three decisions stay yours.
Tools
Claude Code's built-in tools fall into file operations, search, execution, web and code intelligence (the last needs code intelligence plugins). Knowlee's trade-off is blunt: wider tool access enables more capable agents but increases the blast radius of agent errors. So I'd start narrow and widen with a reason.
Skills are the cheap way to add behaviour. Per the skills docs, a skill's body loads only when it's used, so long reference material costs almost nothing until you need it, unlike CLAUDE.md content. Custom commands have been merged into skills: a file at .claude/commands/deploy.md and a skill at .claude/skills/deploy/SKILL.md both create /deploy. Bundled skills are prompt-based, while most built-in commands execute fixed logic. And availability varies, because the commands reference says not every command appears for every user and depends on platform, plan and environment.
State and context
Knowlee names the other trade-off: state persistence versus clean-slate isolation. Persistent state helps long work and hurts reproducibility. A clean slate per task is easier to reason about and forgets everything. Managed Agents leans persistent, with filesystems and conversation history surviving across interactions.
Context is the quieter problem. In Claude Code, /context visualises current context usage and /compact frees space by summarising the conversation. I won't give you a percentage at which to compact. I haven't seen a source that supports a universal threshold, so if you set one for your own agent, test it and label it as a heuristic.
Verification
The loop's third phase is verify, and it's the one teams under-build. A harness unable to check its own work is a very fast way to produce confident mistakes. In Claude Code, the bundled /verify skill builds and runs your app to confirm a change does what it should, without falling back to tests or type checks. The commit-time instruction that runs a verify or simplify skill before each commit requires Claude Code v2.1.286 or later.
Verification can also be a person. Anthropic's commerce merchant agent is designed so that when it proactively suggests a change, a person approves it before anything goes live.
My defaults, for what they're worth:
- Give the agent the fewest tools that finish the task.
- Start with per-task state and add persistence only when the work demands it.
- Pick one check the model can't talk its way past, such as a running app or a human approval.
Questions to answer before you build your own
Building the loop yourself buys control and costs maintenance. Renting buys speed and costs flexibility. These questions usually settle it:
- Does the work run for minutes or hours, or asynchronously? Anthropic positions Managed Agents for exactly that, and the Messages API for custom loops.
- Do you need to change how the loop itself behaves, or only what tools and prompts it gets?
- Can the data sit in a stateful, server-stored session, given the ZDR and HIPAA position above?
- Who approves a risky action, and where does that approval sit in the loop?
- What counts as verified, and what checks it?
- Who watches all your agents together? That's a control-plane job, and a single harness won't do it for you.
If you'd rather talk those through with someone who builds this for a living, our agentic engineering page covers how we work.
FAQ
Do I need a harness for a single prompt-and-response call?
Probably not. Fiddler's view is that any agent that executes tools, persists state across turns or operates in production benefits from one. A one-shot call with no tools has little to harness.
Does changing the harness change a model's benchmark score?
It can, a lot. FutureAGI reports that on the Terminal-Bench 2.0 leaderboard, Claude Opus 4.6 scores anywhere from 58.0 to 76.4% depending only on which harness runs it. That's a leaderboard result, not proof any harness is production-ready. The same article warns that the popular "70%" headline about model versus harness is shorthand, not a measured statistic.
Do the commerce agent figures prove harnesses pay off?
No. Anthropic's post says retailers running shopping agents on Claude have seen carts up to 35% larger and shoppers 60% more likely to complete a purchase. Those are vendor-reported results about one kind of agent, and they don't show a gain for your use case.
Is a harness the same as a runtime?
Not in Knowlee's usage. A runtime hosts many harness instances, and each harness is the bounded context for one task. Other vendors blur this, so check what a given page means.
The most useful thing to carry away is the ownership matrix: renting a harness removes the plumbing, but tool scope, state policy and the definition of verified stay with you. And treat any component count or benchmark headline as one vendor's framing, not a standard.