Explainstuff.mebeta
All concepts
AI-Driven Developmentbeginner6 min

What is a Harness?

The harness is the program that runs the agent loop — the body around the model's brain.

An agent decides what to do — but something has to actually do it. A model on its own can't open a file, run a command, or remember what happened three steps ago. The harness is the program that wraps the model and turns its decisions into real actions.

Brain vs. body

Think of the model as a brain in a jar: brilliant at deciding, but with no hands, eyes, or memory of its own. The harness is the body. It feeds the model what it needs to see, listens for the actions it wants to take, carries them out, and reports back. Same brain, different body, and you get very different behavior.

How it works

On each turn the harness assembles the context window — the goal, history, and relevant files — and calls the model. The model replies with text or a request to use a tool. The harness executes that tool, checks permissions first, and feeds the result back into the next call. The diagram below shows the harness as the outer box driving that whole loop.

The harness wraps the model
one turn
You
Harness
Context window
Model
Tools
Everything routes through the harness: it gathers context, calls the model, runs the tools the model asks for, and reports back to you.
Note

In our stack — Claude Code is the harness. It manages the context window, sends each turn to Anthropic's Claude model, runs the tools Claude asks for — editing files, running tests, calling MCP servers — and asks you before anything risky.

Why the harness matters

The harness decides what the agent can see and what it's allowed to touch — so it's where safety lives. Permission prompts, sandboxing, and which tools exist at all are the harness's job, not the model's. That's why the same model can feel like a careful pair-programmer in one harness and a free-roaming automaton in another.

Key takeaways

  • The model is the brain; the harness is the body and nervous system.
  • The harness runs the loop: build context, call the model, execute its tool calls, feed results back.
  • It owns the context window, permissions, and safety — the model never touches your machine directly.
  • Swap the harness and the same model behaves very differently.

Keep going