Lesson 35 of 57
The Harness
The last two lessons kept using a long phrase: "the surrounding software" or "the agent software". It was the program that sends the tool list to the model, runs the tool calls, and sends the transcript back each round. That program has a proper name. It is called the harness, or the agent harness.
People who build agents use this word all the time. Articles and job descriptions mention "writing a harness" or "improving the harness". Product comparisons say that two tools use the same model but different harnesses. Without the word, those sentences are hard to follow.
This lesson defines the harness, lists its three jobs, and explains how the word relates to "AI agent". After this lesson you can say which part of an agent is the model, which part is the harness, and why the same model can perform differently in two products.
| Idea | Short meaning |
|---|---|
| Harness | The software wrapped around a model that feeds it context and carries out its tool calls |
| AI agent | The system as a whole, seen from the outside: a thing that takes a goal and works on it |
| Context management | Deciding and collecting what the model reads in each request |
| Tool execution | Running the real code when the model asks for a tool |
| Memory | Notes the harness stores in files and sends back in later sessions |
1. Two names for one piece of software
Open the ChatGPT application or the Claude application. Each is a piece of software that you install and open. That one piece of software can be called by two names.
flowchart LR
A["AI agent"] --> S["The application<br/>for example the ChatGPT app<br/>or the Claude app"]
H["Agent harness"] --> SBoth arrows point at the same thing. "AI agent" is the common word, and an earlier lesson introduced it. "Harness" is the second word, and it is the more descriptive of the two, because it says what the software does: it is fitted around the model and controls what goes in and what comes out.
The word comes from the straps fitted around a horse so that its strength can pull a cart. The horse supplies the strength, and the harness connects that strength to useful work. In the same way, the model supplies the reasoning, and the harness connects it to files, tools, and the person. The comparison stops being accurate in one place: a horse can see the road, and a model sees only what the harness sends it.
One point of precision helps here. In strict use, "harness" means only the software around the model and does not include the model. "Agent" often means the two together: the model plus the harness. In everyday speech people point at the same application and use either word, which is why the two are treated as near synonyms.
2. What is wrapped around what
The model sits in the middle. It is the part that reads, reasons, and decides, so it is often described as the brain of the agent. The harness surrounds it.
flowchart LR
subgraph H["The harness"]
direction LR
f["The files it needs"] --> M["The model<br/>the brain in the middle"]
p["What was said before"] --> M
t["Which tools exist"] --> M
endThe diagram shows three kinds of information flowing to the model, and all three come from the harness:
- The files it needs. The model cannot open a file, so the harness reads the file and passes its text along.
- What was said before. The model has no memory between requests, so the harness keeps the conversation and sends it again each time.
- Which tools exist. The model knows about a tool only if the harness describes it.
The rule behind the diagram is this: nothing reaches the model unless the harness went and fetched it first. The model has no other source of information about the current task. If the harness does not send something, the model does not know it.
3. The three jobs of a harness
The harness has three responsibilities. Each one was introduced in an earlier lesson, and the harness is where they come together.
Describing the tools
The harness holds a list of tools and writes that list into the prompt. For example:
| Tool | What the model must supply |
|---|---|
read_file |
path (which file to open) |
search_web |
query (what to search for) |
run_command |
cmd (a command to run on the computer) |
save_memory |
text (a note to keep for later) |
This list is in the prompt before you have typed anything. It is part of what the harness sends with every request, as the lesson on tools described.
Running the tool calls
The model can ask for a tool. Doing the work is the harness's job. Suppose the model writes this request:
read_file("contracts/northwind.md")The harness opens the file contracts/northwind.md on disk and hands back its contents, which in this example is four pages of text. The model then reads those four pages as part of its next input. This is one pass of the agent loop, and the harness is the program that runs that loop.
Keeping the memory
A model forgets everything when a session ends. A harness can work around this by storing notes in ordinary files and sending them back later. One way this can look:
| File | What the harness does with it |
|---|---|
notes/preferences.md |
Found at the start of a session |
notes/last-session.md |
Sent to the model along with your message |
notes/this-session.md |
Stored when the session ends |
The file names are examples. The pattern is what matters: the harness finds saved notes, sends them in with the turn, and writes new notes back out afterwards. The model itself remembers nothing. It appears to remember because the harness puts the notes into its context each time.
4. Where each word puts the emphasis
The software is the same whichever word is used. The two names draw attention to different things.
| AI agent | Harness |
|---|---|
| The system as a whole | The software that does the work |
| The idea, in the broad sense | Manages the relevant context |
| What the thing is for | Performs the tool calls |
| The word used when talking about it | The word used when building it |
"Agent" describes the system from the outside. A person says "I gave the task to an agent" and does not care how it works inside. "Harness" describes the system from the inside. An engineer says "the harness trims old tool results" or "the harness asks for permission before running a command".
A short way to hold the difference: the agent is the idea, and the harness is the thing that runs. The harness is real program code, so you can point at it in a folder on a computer. An "agent" as an idea is not a file.
5. How the harness affects the results
Since everything the model reads comes through the harness, the harness shapes the results.
Take two products built on the same model. One harness sends the right files, describes its tools clearly, and keeps useful notes between sessions. The other sends too little, or sends a great deal of irrelevant text. The first product tends to give better answers, although the model is identical, because the model can only work from what it is sent.
A harness also decides things the model has no say in:
- which tools are offered and which are left out
- whether a risky action needs the person's approval first
- how many rounds of the loop are allowed
- what happens when the context window fills up
So a fair comparison of two agents looks at two things: which model each uses and what its harness does.
Interview points
- A harness is the software wrapped around a language model. It builds each request, runs the agent loop, executes tool calls, and manages memory.
- "AI agent" and "harness" are used for the same application. Strictly, the harness is the software without the model, and the agent is the model plus the harness.
- The model receives only what the harness sends: files, conversation history, tool descriptions, and saved notes.
- The harness has three main jobs: describing the tools in the prompt, executing tool calls with real code, and storing and reloading memory.
- Tool descriptions are in the prompt before the user types anything.
- Memory in an agent is a harness feature. Notes are stored in files or a database and placed back into the context in later sessions.
- "Agent" is the word for discussing what the system is for. "Harness" is the word for discussing how it is built.
- The same model can perform differently in two products because their harnesses manage context and tools differently.
- Permissions, round limits, and context handling are harness decisions, not model decisions.
Summary
- The harness is the program around the model.
- The model is the reasoning part in the middle, and the harness is its only link to the outside.
- The harness describes tools, runs tool calls, and keeps memory.
- Nothing reaches the model unless the harness sends it.
- "Agent" names the idea, and "harness" names the software that runs.
- The quality of an agent depends on both the model and the harness.
