Claude agent harness: what it is and which one to run
A Claude agent harness is everything around the model that turns it into an agent: the loop that feeds tool results back, the tools themselves, how context is trimmed or carried between sessions, and what the agent is allowed to touch. Anthropic now offers four ways to get one. At one end you write the loop yourself. At the other, Anthropic hosts all of it.
Claude agent harness
- Checked
- 9 November 2026
- Ways to run one
- Own loop, tool runner, SDK, hosted
- Claude Code's harness
- Packaged as the Agent SDK
- Hosted option
- Claude Managed Agents
- Main design lesson
- Hand off state between sessions
The short answer
The harness is the code and infrastructure that runs the agent loop around Claude: it sends requests, executes tool calls, returns results, manages context and enforces permissions. You can write it on the Messages API, let the SDK's tool runner drive it, embed Claude Code's harness with the Agent SDK, or use Managed Agents, where Anthropic runs the loop and the sandbox.
What a harness does
A model on its own answers one request. An agent needs something to call it again with the result of each tool, decide when to stop and keep the work coherent across hours. Anthropic calls that layer the harness. In its post on effective harnesses for long-running agents (26 November 2025) it describes the Claude Agent SDK as "a powerful, general-purpose agent harness" with context management such as compaction. A harness usually covers five things:
- The loop: send the request, run the tool calls the model asks for, return the results, repeat until the task ends.
- The tools: file access, shell, search, browsers, MCP servers and your own functions.
- Context: what stays in the window, what is summarised by compaction and what is written to files for later.
- Permissions: which commands and paths the agent may use without asking a person.
- State between sessions: progress notes, a task list and commits that let the next session continue.
Four ways to run a Claude agent
Anthropic's Agent SDK overview and its Managed Agents overview describe the options. Two questions separate them: who writes the loop, and who hosts the place where tools run.
| Option | Who runs the loop | Built-in tools | Where it runs |
|---|---|---|---|
| Messages API with your own loop | Your code | Only the tools you define | Your infrastructure |
| Client SDK tool runner | The SDK helper | Only the tools you define | Your infrastructure |
| Claude Agent SDK | Claude Code's harness, as a library | File, shell and search tools, permissions, sessions and hooks | Your infrastructure |
| Claude Managed Agents | Anthropic | Files, commands, web and code execution in a sandbox | An Anthropic cloud sandbox or your own |
The Agent SDK overview says the SDK gives you "the same tools, agent loop, and context management that power Claude Code". The Managed Agents overview calls Managed Agents a "pre-built, configurable agent harness that runs in managed infrastructure", best for long-running and asynchronous work.
Which one to pick
Your own loop. It fits when the agent calls a few of your own functions, you need full control of every request and you already run the infrastructure. It is the least code to depend on and the most to maintain.
The Agent SDK. It fits when the agent works like a developer: it reads and edits files, runs commands and needs permissions and sessions. You get Claude Code's harness in your own process, and you host and secure it yourself.
Managed Agents. It fits when the work is long-running or asynchronous and you would rather not operate a sandbox. Anthropic runs the loop, and each session runs in a cloud sandbox or one you host.
What harness engineering covers
Harness engineering is the work of designing that layer so the model finishes long tasks. Anthropic's two engineering posts are the clearest public account of it.
In November 2025, Anthropic reported that a frontier model running the Agent SDK in a loop with only a high-level prompt fell short of a production-quality web app. It tried to do too much at once, or declared the job done early. The fix was an initializer agent that sets up the environment and a progress file, and a coding agent that makes one feature of progress per session and leaves the code in a clean state.
In March 2026, a second post extended this to a planner, a generator and an evaluator. The evaluator clicked through the running application with the Playwright MCP before a sprint counted as done. The same post separates context resets, which give the next agent a clean slate, from compaction, which summarises the history in place.
On 2 June 2026 Anthropic's blog described dynamic workflows in Claude Code, where Claude writes and runs a harness for the task in front of it.
What Fable 5.2 changed for harness builders
Anthropic's notes on Claude Fable 5.2 (9 November 2026) make harness design a compatibility question as well as a quality one:
- On Fable 5.2, every account gets the prefix check. A harness that edits the system prompt, the tool list or an earlier message gets an error once thinking blocks come back.
- Anthropic says nothing changes if Claude Code, Managed Agents or the Agent SDK builds your requests. A hand-written loop has to be append-only.
- Compaction on demand and mid-conversation tool changes, both in beta, exist so a harness can stay append-only.
- Anthropic warns that subagents can account for a large part of what a session costs, depending on how the harness invites delegation.
How we run ours
Digiton runs its own sales and operations on a local agent fleet scheduled with launchd.
Each job is a small harness with one task, fixed tools and a written state file, and none of them sends email unattended. We describe the setup in our agent fleet post.
Where Digiton fits
We build harnesses for teams that already use Claude and need an agent in production:
- A new agent runs through our AI agent development service.
- A larger system with agents inside it runs through custom AI development.
- An agent that already exists goes through our production engineering review.
If you are also choosing a model, our Claude Fable 5.2 vs Opus 5.5 guide compares the two on Anthropic's own numbers, and our Claude Code permissions guide covers what an agent may run without asking.
Frequently asked questions
What is an agent harness?
It is the software around the model that makes it act as an agent: the loop that runs tool calls and returns results, the tools, context management, permissions and the state carried between sessions. Anthropic uses the term for the Claude Agent SDK and for Managed Agents.
Is Claude Code an agent harness?
Yes. Anthropic packages the harness that powers Claude Code as the Claude Agent SDK, so you can run the same loop, tools and context management inside your own Python or TypeScript application.
Should I use the Claude Agent SDK or Managed Agents?
Use the Agent SDK when you want Claude Code's harness inside a process you operate. Use Managed Agents when you want Anthropic to run the loop and the sandbox, which suits long-running and asynchronous work.
What is harness engineering?
It is the design of everything around the model so it finishes long tasks: splitting work into chunks, handing state between sessions through files and commits, choosing between compaction and context resets, and adding an evaluator that tests the result before the work counts as done.
Do I need to rebuild my harness for Claude Fable 5.2?
Only if your own code builds the requests and edits earlier messages, the system prompt or the tool list. Fable 5.2 runs the prefix check on every account, so a hand-written loop has to be append-only.
Sources, checked 2026-11-09
6 sources
- Anthropic describes the Claude Agent SDK as a powerful, general-purpose agent harness with context management capabilities such as compaction.Source: anthropic.com, checked 2026-11-09.
- Anthropic's long-running harness used an initializer agent that sets up an init script, a progress file and an initial commit, and a coding agent that makes incremental progress each session.Source: anthropic.com, checked 2026-11-09.
- The Agent SDK gives the same tools, agent loop and context management that power Claude Code, programmable in Python and TypeScript.Source: code.claude.com, checked 2026-11-09.
- Claude Managed Agents is a pre-built, configurable agent harness that runs in managed infrastructure, with sessions in an Anthropic-managed cloud sandbox or a self-hosted sandbox.Source: platform.claude.com, checked 2026-11-09.
- Anthropic's March 2026 harness used a planner, a generator and an evaluator, and the evaluator used the Playwright MCP to click through the running application.Source: anthropic.com, checked 2026-11-09.
- On Claude Fable 5.2 the prefix check applies to every account, and nothing changes if Claude Code, Managed Agents or the Agent SDK builds the requests.Source: platform.claude.com, checked 2026-11-09.
Digiton Dynamics OÜ is registered in Tallinn, Estonia, and delivers from Lisbon.
Update log
- Published. Definitions and options copied from Anthropic's Agent SDK and Managed Agents docs and its two harness engineering posts.
Each source above was opened on the date beside it. How facts get chosen and checked is written down in the editorial policy.
Talk to an engineer about your system
Book a free 25-minute scoping call. We tell you what we would build, what it takes to keep it running, and whether we are the right fit.
