The Harness

The program around a language model that turns it into an agent

Summary

A language model on its own can only write text. Everything that turns this text into action, running the loop, carrying out the tool calls, deciding what the model gets to see and what it is allowed to do, is done by a program around the model: the harness. Claude Code, Codex and OpenCode are harnesses, and the same model in a different harness becomes a different agent. This page answers:

  • What does the harness do, and what does the model do?
  • Why can the same model behave differently in two agents?
  • Where are the limits of what an agent may do, and who sets them?

You meet this concept in the experiment Be the Agent, where one of you plays the harness and carries every card between the Model and the tools.

Explanation

Where the name comes from

A harness hitches a horse to a cart. The horse provides the power, and the harness decides where that power goes. In an agent, the language model provides the decisions, and the harness connects them to the world: to files, commands, web pages and to you. An AI agent is therefore an LLM plus a harness.

What the harness does

The harness runs the loop. It sends the context to the model, reads what comes back and, if the answer is a tool call, carries it out and adds the result to the context before it asks the model again. When the model writes a final answer instead of a tool call, the harness stops.

The harness assembles the context. It decides what the model sees at each step: the system prompt with the list of tools, instructions from files such as agents.md, the skills it loads when they are needed, the plan, and every result so far. When the context window fills up, it summarises or drops older parts.

The harness sets the limits. It decides which tools exist at all, asks you for permission before a command runs, and can confine the agent to one folder. The model cannot bypass these rules, because it never touches anything itself.

Same model, different agent

Because the harness decides what the model sees and may do, two agents with the same model can behave very differently. One gets a web search and the other does not; one reads a project’s instructions and the other starts blank; one asks before every command and the other just acts. Comparing agents therefore means comparing harnesses as much as models.

Slides

Slides for this concept will follow.

Practice questions

Practice questions for this concept will follow.

Further reading