Skip to content

What is an agent harness?

By 5 min read

Line drawing for the post: What is an agent harness?

An agent harness is the software layer around a language model that turns it into an agent: it assembles the context, runs the loop of model calls and tool calls, enforces what the agent may touch, and decides when a task is finished. Claude Code, OpenAI’s Codex, and Cursor’s agent are harnesses around a model.

The term spread through agentic coding in 2025 and 2026, and it describes the part that decides whether an agent is useful. A strong model in a weak harness guesses. A good harness gives a model what it needs to work like a careful colleague.

A model answers, a harness acts

A language model on its own is a function: text in, text out. It cannot open a file, call an API, or check its own work. Everything an agent does beyond producing text, the harness does on the model’s behalf:

  1. Build the context: instructions, the task, relevant files, memory.
  2. Call the model.
  3. If the model asks for a tool, check the permission, run the tool, and add the result to the context.
  4. Repeat until the model says it is done, a check fails, or a limit hits.
  5. Verify the result and hand it back, or to a person.

That loop is small. What makes it work is what each step contains.

The six parts of a harness

Part What it does When it is missing
Context assembly Picks instructions, files, and memory for each call The model works blind or drowns in noise
Tools Shell, files, browser, APIs, databases, MCP servers The agent can only talk
Loop control Decides when to call again, when to stop, how many steps Endless loops or early surrender
Permissions Limits what the agent may read, write, or send One bad step reaches production
Verification Tests, schema checks, a second review Confident, wrong results
State and memory Task lists, logs, notes across sessions Every run starts from zero

The Model Context Protocol (MCP), introduced by Anthropic in 2024, is a standard for the tools part: one way to plug a CRM, a database, or a file store into any harness that speaks it.

Why the harness matters more than the model

Teams that build agents keep finding the same thing: changes to the harness move results more than changes to the model.

  • Context beats cleverness. An agent that can read the codebase’s conventions, run the tests, and see the error output fixes bugs a smarter model without those tools cannot.
  • Separate contexts catch more errors. Boris Cherny, who leads Claude Code at Anthropic, describes why subagents work: a second agent with a fresh context window finds bugs the first one introduced, the way a reviewer finds what the author missed.
  • Loops beat single shots. Geoffrey Huntley’s Ralph loop ran the same agent against a fixed specification again and again until the work passed; Claude Code and Codex now build it in as /goal. It works because the harness, not the model, holds the goal.
  • Techniques age, the harness idea does not. Most agent tricks of the last two years moved into the products within a year; see the timeline of AI agent techniques.
  • Small can be enough. Mario Zechner’s Pi harness gives the model four tools (read, write, edit, and bash) and still holds its own for real coding work. The design of the loop matters more than the number of features.

What a harness means for business AI

Coding agents made the idea popular. In a company process it matters even more, because the harness is where the business rules live.

Take an inbox agent that reads customer emails. The model can classify the mail, extract the order number, and draft a reply. The harness decides:

  • What it may write. A draft in the ticket system, yes. A refund in the ERP, no.
  • When a person decides. Complaints, cancellations, data requests, and low-confidence extractions go to a human first, as a fixed rule.
  • What gets logged. Every input, output, and tool call, for review and for audits.
  • What happens on failure. A timeout or an invalid result falls back to the normal manual queue, not to silence.

In our AI Inbox Triage demo, the model proposes a route and a reply, and the server computes whether a person must review it. The model can add caution; it cannot remove it. That rule is harness, not prompt, which is why it holds. The full pattern is in AI email triage.

A harness checklist before going live

Before an agent touches a real process, the harness should answer these:

  • Which systems can it read, and which can it change?
  • Which actions need a person’s approval, by rule rather than by the model’s judgment?
  • How is each result checked before it takes effect?
  • Where is every step logged, and who reads the log?
  • What is the step limit and the cost limit per task?
  • What happens when the model is down, slow, or wrong?

If the agent answers questions from company documents, the context part is a retrieval system; see what RAG is. If it talks to customers in the EU, check the transparency duties in the EU AI Act timeline.

FAQ

What is the difference between an AI model and an AI agent? The model generates text. The agent is the model inside a harness that gives it tools, a loop, and limits, so it can carry out a task instead of describing it.

Is a harness the same as an agent framework? No. Frameworks such as LangGraph or the OpenAI Agents SDK are libraries for building a harness. Claude Code or Codex are finished harnesses for one job, coding.

Do I need to build my own harness? For coding, no; the existing ones are excellent. For a business process, yes, usually a thin one: your permissions, your review rules, your systems. That part is specific to the company.

What is MCP? The Model Context Protocol, a standard way to connect tools and data sources to an agent harness. A system with an MCP server can be used by any harness that supports the protocol.

Which model should the harness use? The best one you can afford for the hard steps, a cheaper one for the simple steps. A good harness makes the model swappable, which matters because the best model changes every few months.

Try the pattern on a real message with the free AI Inbox Triage: paste an email and see what an agent extracts, where it routes the mail, and when the harness hands it to a person. Building that harness around your own systems is what we do when we build AI agents for business.

Contact

What eats your team's time?

Two or three sentences are enough. Philipp reads every message himself and usually replies within two business days.

Philipp Kant

Philipp Kant
Software & AI Architect, Krefeld

What is it about?

Opens your email app with the message to philipp@kant.dev, ready to send. You see everything before it goes out. Privacy policy

  • No sales call unless you ask for one.
  • No newsletter, no automated follow-ups.
  • Your message goes to one inbox: philipp@kant.dev.

Rather talk? Pick a 30-minute slot

Or write directly: philipp@kant.dev