Agent Engineering
Module 02 · Concepts/Lesson 2.1/3 min

Model, harness, agent

Three things people call "the AI". Separating them tells you which of your problems are fixable.

When a session goes wrong, the first useful question is which layer failed. There are three, and only one of them is out of your hands.

The model

A model is a set of parameters that performs next-token prediction. It is stateless: it carries nothing between requests. It has no memory of yesterday, no awareness of your repository, and no ability to act. Given a sequence of tokens it produces a probability distribution over the next one, repeatedly. That is the entire mechanism.

Everything that feels like memory or agency is supplied by the layer above.

The harness

The harness is the program you actually run — the CLI, the editor extension, the web app. It owns:

  • The system prompt: standing instructions prepended to every request.
  • The tools: read, write, search, run a shell command, and whatever else it exposes.
  • The context window assembly: deciding what gets sent on each request and what gets dropped or summarised.
  • The permission model: what runs without asking you.

When people compare "AI coding tools", they are almost always comparing harnesses. Two products running the same model can differ enormously, because context assembly and tool design are where most of the engineering lives.

The agent

An agent is a model plus a harness plus a context window, taking turns with you. The loop is mechanical:

the agent loop
1. harness assembles context  ->  system prompt + history + your message
2. model provider request     ->  model returns text, possibly a tool call
3. if tool call: harness executes it, appends the result to history
4. repeat from 1 until the model returns plain text
5. turn ends; control returns to you

Note step 3: every tool result gets appended to the history. A single agent turn can make thirty tool calls, and every one of them lands permanently in the context window. This is why "just read the whole directory" is an expensive instruction, and it is the mechanical root of most of Module 02.

Why the split matters

SymptomLayerYour move
Cannot reason about a genuinely hard algorithmModelChange model or raise effort; otherwise, do it yourself
Forgot an instruction you gave twenty minutes agoContextShorter sessions, standing instructions (Module 05)
Never ran the testsHarness / steeringGive it the command and a rule that says run it
Edited a file you did not want touchedPermissionsTighten the permission mode or sandbox it

Try it

Open your agent and ask it to list the tools it has available, then check the harness documentation for the ones it did not mention. Knowing the exact tool surface is worth ten prompt tricks — most "the agent cannot do X" problems are really "the agent was never given a tool for X".

Takeaways

  • The model is stateless; every appearance of memory comes from the harness re-sending context.
  • Comparing AI coding products is mostly comparing harnesses, not models.
  • Every tool result is appended to the context window permanently — reads are not free.
Your agent gave a great answer yesterday and a worse one today on the same question. Which layer would you look at first?

Context, not the model. The model is stateless and identical; what differs is what was in the window. Either yesterday’s session had loaded something today’s has not, or today’s session has accumulated enough irrelevant material to degrade attention on the relevant part.

A course by Pieter Zandbergen