What is a harness?
The code wrapped around an AI model that turns it from something that writes text into something that can do work.
An LLM on its own does one thing: it takes text in and predicts text out. It can’t open a file, run a search or remember yesterday. The harness is the ordinary software around the model that makes those things happen.
Everything in an AI product that isn’t the model: the loop that calls it, the tools it can use, the memory it is given, and the rules for what it may do.
The model is an engine. On a test bench it only spins. The harness is the rest of the car: steering, brakes, fuel line and dashboard. The same engine makes a very different car depending on what is built around it.
What a harness does
- 1Builds the prompt — puts the system prompt, the conversation so far, any files and your message into one request
- 2Calls the model — sends the request and reads the reply
- 3Runs the tools — when the model asks for a search or a file edit, the harness is what actually does it
- 4Feeds the result back — adds what the tool returned and calls the model again
- 5Manages the context window — trims or summarises old turns so everything still fits
- 6Enforces the limits — decides what needs your approval and when to stop
- 01Build prompt
- 02Call model
- 03Tool wanted?
- 04Run tool
- 05Add result
- 06Repeat
That loop is the same one described in AI agent. The agent is the model and the harness working together.
Who does what
- Decides what to do nextModel
- Writes the words of the replyModel
- Runs the search or edits the fileHarness
- Remembers earlier turnsHarness
- Asks you before a risky stepHarness
Same model, different harness
One model can sit behind a chat app, a coding tool and a support bot. What changes is the harness: which tools it offers, what instructions it sends, and how much it lets the model do without asking. Coding tools such as Claude Code are a good example. The model proposes a command, and the harness runs it, shows you the result and asks permission where it should.
The word has a second meaning
You will also see evaluation harness or test harness. That is code that runs a model through a set of test tasks and scores the results. It is the same idea, scaffolding around a model, built for measuring instead of for doing work.
A common misunderstanding
“Only the model matters.” From what I have read, the same model can do noticeably better or worse depending on the harness around it: the tools it gets, how its context is managed, how errors are handled.
The word is also used loosely. Scaffolding, orchestrator and agent framework often mean roughly the same thing. On the AI map it is the box in the middle.
Two shopping assistants can run on the same model and behave very differently. One looks up your order before it answers and hands refunds to a person. The other only chats. The difference is the harness.
Related buzzwords
AI agent · MCP · Context window · Guardrails · Tool calling