dan@dlk25:~$ cat ~/notes/agentic-harness.md

What an agentic harness is

2026-05-27 · claude · 2 min read

The model only turns text into more text. Everything that lets it do things is the harness.

"Agentic harness" is one of those phrases that gets said a lot, so I wrote down what I mean by it.

A language model does one thing: text in, text out. It cannot read a file, run a command or notice that it got something wrong. The harness is everything around the model that closes that loop with the world, and turns a text completer into something that can work towards a goal over many steps.

The parts

The loop. The heart of it. The model picks an action (a tool call), the harness runs it, the result goes back into the context, and the model looks again and picks the next one, until the job is done:

loop [until the model stops calling tools] a prompt the context so far a tool call may I? (if it has to ask) run it the result an answer done you harness model tools
The loop: the model asks, the harness does

Without the loop you have a chatbot. Note who does what: the model never touches a file. It asks, and the harness decides whether to do it.

Tools. The bridge to reality: read and write files, run a shell, search code, fetch a page. The harness decides which tools exist, how they are described to the model, and runs them safely. The quality of the tools is often what decides whether an agent is useful or maddening.

Context. The system prompt, the conversation, which files are loaded on their own, and above all what happens when the context fills up: summaries, memory on disk. A lot of what looks like magic lives here.

Permissions. What it may do without asking, when it has to ask, and what runs in a sandbox. The balance between letting it get on with it and keeping a hand on the wheel.

Orchestration. Sub-agents, plan mode, skills, a worktree per agent: ways to break a big job down and hand parts of it off.

Claude Code is one

When I work in Claude Code I am inside a harness: a loop, a set of tools (Bash, Edit, Agent and so on), memory on disk, permission modes, and sub-agents, all of it steered by CLAUDE.md and settings.

So "building a harness for Claude" usually means one of two things:

  • using the Agent SDK to build your own agent on top of the API, with your own tools and loop logic, or
  • going straight to the API and running the tool-use protocol, the context and the loop yourself.

← all notes

← back to the terminal (q)