Mohamed Douare Logo

← Blog

Series: Software that acts · Part 2 of 12

An agent is a model plus a harness

In the first part, we said that agents do the work for us. Let us now open the hood to see what an agent is made of.

Let us start with the model.

The model

The model is a program trained on huge amounts of text: it receives text and produces what comes next. It does nothing else, since it has neither hands nor access to your files.

Picture a very knowledgeable expert, locked in a room, who can only read the messages slipped under the door and answer in writing.

So how can a model act? Through tools.

The tools

A tool is a function with a name, a description in plain language, and the list of what you have to give it. For example, the "read a file" tool needs the name of the file.

The model never runs the tool itself: it answers with a request, such as "read me the file notes.txt". Our expert writes the request on a piece of paper, and someone, outside, does it for them.

That someone outside is the harness.

The harness

The harness is the program around the model. It shows the model the available tools, runs its requests after checking them, sends the results back and decides when to stop.

The harness is what carries the reliability: a model sometimes makes a mistake, but the harness must not let the mistake through.

Let us put the pieces together.

The loop, step by step

An employee writes to her assistant: "show me my tasks for the week, and prepare a draft leave request for Friday".

  1. Employee, makes her request. "Show me my tasks for the week, and prepare a draft leave request for Friday."
  2. Model, asks for a tool. Since it does not know the tasks, it answers with a request: "call the tool that lists this person's tasks".
  3. Harness, checks, then runs. It checks that the tool is in the allowed list and that this person has the right to see these tasks, then it runs the call and writes it in the log.
  4. Application, returns the result. It returns seven tasks for this week. The harness adds the list to the conversation, and the model reads it.
  5. Model, asks for a second tool. It now asks for the tool that prepares a draft leave request for Friday.
  6. Harness, applies the rule. Preparing a draft is allowed, but sending the request is not: the employee will confirm it herself.
  7. Model, answers. It summarises the seven tasks and says that a draft leave request is waiting for the employee to confirm.
Figure 1. One request, from start to finish. The model never touches the application itself.

That is the loop of an agent: the model asks, the harness checks and runs, the result comes back, and we start again.

The loop stops when the model answers without asking for a tool, because it considers that it is done. It also stops when a cap is reached: a number of turns, an amount of text or a cost. In my first harness, the default caps are eight turns, fifty thousand tokens and fifty cents.

By the way, a token is a piece of a word: the unit in which we count what the model reads, what it writes, and so what it costs.

Now let us see what a real run produces.

The loop runs, but the result is wrong

This run was done with a small model that runs on my own server. The task was to read a note and write a summary in three points.

On the first turn, the model picks the wrong tool. The error does not stop the agent: it is sent back to it as a result so that it can correct itself, and it then reads the note.

On the second turn, it writes the summary. Except that it is not a summary in three points, but five sentences from the note copied almost word for word.

On the third turn, it announces that the summary was completed successfully, and the loop stops.

Remember this scene: the loop worked perfectly, but the result is wrong and the model says the opposite. That is why you have to check the result afterwards, and we come back to it in part 6.

To finish, what does the harness have control over?

Six things the harness decides

In the harnessWhat it decides
The list of toolsWhat the agent can ask for: a tool that is not there cannot be called.
The permissionsOn whose behalf the agent acts, and with which rights.
The sandboxWhere the agent works: which folder, which network.
The capsHow many turns, how many tokens and how much money before it stops.
The logThe trace of what the agent saw and did.
The checksThe controls that run after it.

We want to prevent an agent from deleting data. What works for certain?

Writing "never delete anything" in its instructions

Not quite. The model reads the rule, but it can ignore it or misunderstand it.

Not giving it a delete tool

Right. A tool that does not exist cannot be called.

Taking a more powerful model

Not quite. A better model makes mistakes less often, but it is still the harness that decides what is possible.

What to remember

  1. The model only reads and proposes: it acts only by asking for a tool.
  2. The harness checks, runs, sends the result back, and stops on caps of turns, tokens and cost.
  3. A loop that runs does not prove that the result is good: you also have to check it afterwards.

In the next part, we will see how to depend on no model provider.

Architecture · Published on November 17, 2026Lire en français

A question about this article? Send me an email, I answer.