IntermediateAnalysisAI

Agent harnesses - the layer that owns the loop

The difference between an agent harness, an agent framework, and a protocol - what a harness actually provides (loop, permissions, sandbox, context, recovery) and why the layer names get confused.

Updated Reviewed
intermediateAssumes working familiarity; skips the fundamentals.

Concepts covered

Agent harnesses - the layer that owns the loop

By 2026 the words “harness”, “framework” and “protocol” are used as if they named the same thing, and the confusion is expensive, because they are three different layers of an agent system and you choose each one by different criteria.

A harness is the execution system that wraps a model and turns it into a working agent. It owns the loop - the cycle of reason, call a tool, read the result, decide whether to stop - and everything the loop needs around itself: conversation state, the permission policy, the sandbox where code runs, the context strategy, and what happens when a run is interrupted. Anthropic’s own documentation describes the Claude Agent SDK as exposing “the same tools, agent loop, and context management that power Claude Code” - the loop is the product.

What a harness gives you that a framework does not

A framework - LangGraph, the OpenAI Agents SDK, Microsoft Agent Framework - is a library of primitives. It gives you model clients, tool abstractions, graph or workflow orchestration, memory interfaces and observability hooks, and a skeleton for the loop. You still write the policy: which tools need approval, how state survives a restart, when the loop gives up.

A harness is what you get when those decisions have already been made. The comparison that shows the difference:

Harness Framework Protocol (MCP / A2A)
What it is An execution system around the model A library of composable parts A wire contract
Owns the loop Yes Skeleton only No
Owns the permission model Yes - which tools run, which ask You write it No
Owns the sandbox Yes - where code executes No No
Owns recovery / resumption Yes - sessions, resume, fork Partially No
Examples Claude Agent SDK, OpenAI Agents API, Claude Code LangGraph, OpenAI Agents SDK, Microsoft Agent Framework MCP, A2A
The agent stack, by what each layer owns

Three different things get called "the plumbing". Only one of them owns the loop.

The agent stack: a harness owns the loop, permissions and sandbox; a framework owns composable primitives; MCP and A2A own the wire between themThree stacked layers. At the top, the harness owns the agent loop, conversation state, permissions, the sandbox policy and recovery - examples are the Claude Agent SDK, the OpenAI Agents API and Claude Code itself. In the middle, the framework owns the primitives - model clients, tool abstractions, graph orchestration and memory interfaces - examples are LangGraph, the OpenAI Agents SDK and Microsoft Agent Framework. At the bottom, the protocols own the wire: MCP connects the agent to tools and data, A2A connects agents to each other. Neither a protocol nor a framework runs the loop on its own.HARNESS - owns the loopThe execution system that wraps the modelagent loop · conversation state · permissions · sandbox ·context strategy · recovery across turnsClaude Agent SDKOpenAI Agents APIClaude Code itselfFRAMEWORK - owns the primitivesThe library of parts you composemodel clients · tool abstractions · graph orchestration ·memory interfaces · observability hooksLangGraphOpenAI Agents SDKMicrosoft Agent FrameworkPROTOCOL - owns the wireThe contract, not the runtimeMCP - agent to tools and dataA2A - agent to agentowns no loopowns no stateowns the message formatTHE MODELreasons, callstools, decideswhen to stopThe model is nota layer here -every layer wrapsor serves it.Choosing a model isa different decisionfrom choosing aharness.
The expensive confusion is layer one versus layer two. A framework gives you the parts and a loop skeleton; a harness gives you the finished loop, the permission model and the sandbox, opinionated. Teams pick a framework and then discover they were buying a harness - or pick a harness and discover they needed the parts. On a narrow screen, scroll the diagram; the same boundaries are listed below.
  1. Harness: owns the agent loop, conversation state, the permission and sandbox policy, and how a run recovers. Claude Agent SDK, the OpenAI Agents API and Claude Code are examples. You configure it rather than compose it.
  2. Framework: owns the primitives - model clients, tool abstractions, graph orchestration, memory interfaces. LangGraph, the OpenAI Agents SDK and Microsoft Agent Framework are examples. You write the loop policy yourself.
  3. Protocol: owns the wire. MCP standardises how an agent reaches tools and data; A2A standardises how one agent reaches another. A protocol runs nothing - it is the message format both sides agree on.

The right way to read the table is not “harness is better” but “they answer different questions”. A framework answers what parts do I have to work with. A harness answers who runs the agent and under what rules. A protocol answers how does this agent reach anything outside itself.

Where the harnesses actually are

The vendors have been quietly consolidating the loop into a product:

  • Claude Agent SDK - the harness behind Claude Code, exposed as a Python or TypeScript library. It gives you the built-in tools, the permission system, sessions you can resume or fork, hooks into the agent lifecycle, and automatic loading of skills, commands and memory from .claude/ - in other words, the whole loop, configurable rather than assembled. Anthropic also offers Managed Agents, the same loop hosted, running in an Anthropic-managed or self-hosted sandbox.
  • OpenAI Agents API - the harness behind Codex, exposed as a managed endpoint. You supply a task, a model, tools and a sandbox choice (OpenAI-hosted, self-hosted, or a partner such as E2B, Daytona or Vercel) and get a running agent in one call; OpenAI runs and maintains the loop.
  • Microsoft Agent Framework reached 1.0 in April 2026 - a framework rather than a harness, which is the point of naming it here: a framework can be the basis of a harness, but it is not one out of the box.

The pattern underneath all three is the same one the MarkTechPost taxonomy names: a harness is opinionated - it ships a loop, a permission model and a context strategy as a unit - where a framework gives you the parts and the decision burden.

Why the layer emerged

The honest answer is that the loop turned out to be the hard part. Early agent development was a prompt-engineering problem; once models could reliably plan and call tools, the durable work moved to everything around the model - managing context across long runs, deciding which tools fire automatically versus ask permission, keeping state when a session is interrupted, and knowing where the generated code physically runs. Those are the harness’s jobs, and they are the ones a production deployment cannot leave to the developer’s ad-hoc code.

Where it breaks

  • A harness is opinionated by design - that is the product and the lock-in. Its permission model, its context strategy, its idea of when to stop - you inherit all of it, and swapping harnesses later means re-expressing your agent’s whole behaviour, not just its calls.
  • “Managed” is a spectrum that matters. A hosted harness (OpenAI Agents API, Anthropic Managed Agents) runs the loop on the vendor’s infrastructure; a self-hosted one (Claude Agent SDK) runs it in yours. They are different products wearing the same name, and the data-residency and cost questions are entirely different.
  • The harness does not remove the framework decision. Pick a harness for the loop and you still choose a framework or SDK for the parts it does not cover - the layers stack, they do not merge.
  • Permissions are the harness’s promise and its failure surface. The whole point of the sandbox-and-approval policy is to bound what the loop can do; a misconfigured permission set is precisely the failure a harness is meant to prevent.

What this is not for

  • A task that is really one function call - if a tool invocation suffices, a wire call to it beats running a loop.
  • Workflows where you genuinely need to design the loop yourself - a framework plus your own policy is the honest answer when the harness’s opinions do not fit, because fighting an opinionated harness is worse than writing a simple loop.
  • Replacing the protocols - a harness still uses MCP to reach tools and A2A to reach other agents; it does not absorb them.

What to watch

Specific things that would change what this page concludes.

  • Whether 'harness' hardens into a stable product category or stays a word vendors use for whichever layer they happen to sell
  • Whether hosted harnesses (OpenAI Agents API, Anthropic Managed Agents) pull the loop into the vendor, or whether self-hosted harnesses remain the default