Ask what an agent is and the answer is usually a model name. That answer does not help when the agent breaks, or when someone asks you to approve one, because on any one step the model did one thing: it read what it was given and wrote a response. Everything else, writing its input, running the tool, deciding to go again and deciding to stop, was done by the code and configuration around it, and that is where you look, test and set limits. The previous chapter named that code the harness. This chapter takes it apart, layer by layer, so that when an agent fails you know which part to open.

Thesis: An agent is not a kind of model. It is a model, a harness and an outcome someone is held to: the previous chapter's goal, with a named person answerable for it. The model writes the response; the harness is everything around it that assembles the input, runs the tools, enforces the limits and decides when the work is done; the outcome is the reason any of it runs. Strip the harness down to a reply box and you have a chatbot. Take away the outcome and you have a demo. Take away the model and you have a script. Most of what makes an agent reliable, and nearly everything about it you can log, test and govern, lives in the harness.

TLDRFour steps, about thirty seconds
modelwriting its inputrunning the tooldeciding to go againdeciding to stopthe harnessmodelControlBoundariesnot done: call againdenied: say so in the next callHarnessOutcome it is held toAgentChatbotWorkflowall five layersthin: history and a reply boxsteps and branches written in advanceyes, with a named ownernoneit can bemodelBoundariesapproveddenied: say so in the next callmodelwriting its inputrunning the tooldeciding to go againdeciding to stopthe harnessmodelControlBoundariesnot done: call againdenied: say so in the next callHarnessOutcome it is held toAgentChatbotWorkflowall five layersthin: history and areply boxsteps and brancheswritten in advanceyes, with a namedownernoneit can bemodelBoundariesapproveddenied: say so inthe next call

Step 1 of 4

Model, Harness, Agent

Most name a model as the agent. The model only replies; the harness writes its input, runs tools, and decides to go again or stop.

Read the TLDR as text
  1. Model, Harness, Agent. Most name a model as the agent. The model only replies; the harness writes its input, runs tools, and decides to go again or stop.
  2. Five Layers. Two of the harness's jobs: Control picks what runs next and when the work is done; Boundaries sets what is allowed and refuses the rest.
  3. Agent, Workflow, Chatbot, Script. The post's table also has a Script row, left out here. Against an agent: a chatbot has a thin harness and is held to no outcome; a workflow follows steps written in advance.
  4. An Example from Change Management. Illustrative week: the model filled the approval field, which only a human may set. Boundaries refused the write; the model resubmitted without it.

Six Words to Start With

The rest of this chapter uses six words precisely. The first two chapters introduced most of them; here they are in one place.

Term What it means
Model A network that reads a sequence of tokens and scores every possible next one. On each call it reads its input and writes a response, and it keeps nothing between calls.
Tool A function the harness describes to the model. The model asks for it by name, with arguments; the harness runs it and puts the result into the next call as text.
System prompt The instructions the team that built the agent puts into the model's input on every call. Part of the harness, written as text.
Context window The most the model can see on one call, counted in tokens; it holds the system prompt, tool definitions, history and tool results, with room left for the reply. An input, not a memory.
Harness Everything around the model: the code and configuration that assembles each call's input, runs the tools, enforces the limits and decides whether to call again and when the work is done.
Agent This site's working definition: a model, a harness and an outcome someone is held to, run as a loop until a check the model cannot fake says the work is done; what the check cannot cover goes to a named reviewer. Many agents stop when the model says so; this series counts them as agents with that failure unfixed.

The model's line is deliberately small, for the reasons What an LLM Actually Is gave. Anatomy of a Turn shows a model that seems to remember a ticket it searched earlier: it is reading the search result the harness put back into its input.

The Harness Is Most of the Agent

Which part you open when something breaks depends on where you draw the harness's edge, and the word is not fully settled: Addy Osmani, Anthropic's Claude Code documentation and LangChain each draw it a little differently. This site takes the wide sense, in the one-liner Osmani's post quotes, "Agent = Model + Harness" (credited there to Viv Trivedy): the harness is everything in an agent that is not the model. Anatomy of a Turn's narrower sentence, "the code that calls the model, runs the tools you define and decides whether to call it again", names its core and stays true. The wide sense is the useful one, because it leaves no part of the agent without a name.

Start Simple: The Harness Wraps the Model

First, one picture: the model in the middle and the harness around it. The harness builds the context for each call, acts on what the model wrote, and builds the context for the next call.

flowchart LR
    subgraph Harness["The harness, wrapped around the model"]
        Context["Context<br/>what the model is given<br/>on this call"] --> Model["Model<br/>reads it,<br/>writes a response"]
        Model --> Rest["Tools and limits<br/>act on what it wrote"]
        Rest --> Context
    end

    style Model fill:#5a5a8a
    style Harness fill:#e3f2fd

Figure: The harness wrapped around the model. Context goes in, the model writes a response, tools and limits act on it, and the result becomes the next call's context.

The model is inside; you build the outside. The rest of the chapter names its parts.

Five Layers

Everything around the model does one of five jobs. The grouping is this site's, not a standard. Naming the jobs matters when something fails: each layer is a different place to look and a different thing to change.

Layer The question it answers What lives there
Context What does the model see on this call? Assembling each call's input, the history, retrieval (finding passages to include), compaction (summarising old history to fit), memory kept in files
Interfaces How does it reach beyond itself? Tool definitions, MCP servers (a standard way to plug in tools) and command lines, channels to other agents and to people
Control What decides what runs next? The loop, what carries between turns, the stop condition and the check that says done, subagents (separate runs it starts for part of the task), routing a request to the right procedure
Boundaries What may it touch, and who says so? The sandbox (an isolated place it runs); permissions; hooks, code the harness runs on an event, which can deny a tool call; defences against untrusted text the model reads as instructions (prompt injection); how much it may do without asking (autonomy)
Direction What is it for, and how should it behave? The goal, written down; the system prompt, a project instruction file (AGENTS.md or a vendor's equivalent), written rules the model reads, skills (procedures loaded when needed)

Boundaries is the layer diagrams often leave out. Control decides what happens next; Boundaries decides what is allowed to happen at all. A sentence in the system prompt asking the agent to be careful is Direction. A permission that refuses the call is a Boundary. Only the second one executes.

Evals, repeatable tests of whether it does its job, sit outside all five: they judge the agent and must not be graded by it (The Clean Room).

The harness, wrapped around the modelContextwhat the model is givenon this callModelreads it,writes a responseTools and limitsact on what it wrote The harness, wrapped around the modelContextwhat the model is givenon this callModelreads it,writes a responseTools and limitsact on what it wrote Tools and limitsact on what it wroteContextwhat the model is givenon this callyesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againContextassemble this call's inputModelreads its input, writes aresponseBoundariesmay it do that?Did it askfor a tool?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metDirectionsystem prompt, project file,rules, skillsThe outcomesomeone is held to yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metIn an illustrative first week yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againnonethin: history and a reply boxModelreads its input, writes aresponseDirectionsystem prompt, project file,rules, skillsDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metThe outcomesomeone is held toContextassemble this call's inputModelyesHarnessthin: history and areply boxOutcome it is held tononeWho decides it is donethe human yesdenied: say so in thenext callallowedno: it says donethe last stepruns, or a checkat the endnot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseBoundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metsteps and brancheswritten in advanceDid it askfor a tool?Modelyes, in slotsHarnesssteps and brancheswritten in advanceOutcome it is held toit can beWho decides it is donethe last step runs, ora check at the end yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelBoundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textOutcome metModelreads its input, writes aresponsethe codeDid it askfor a tool?the codeControlis the work done?ModelnoHarnessn/a: it is all codeOutcome it is held towhatever its authoris held toWho decides it is donethe code yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomeDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metThe outcomesomeone is held toOutcome met yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it asked for, returnthe result as textControlOutcome metControlis the work done?Outcome metno: it says done yesdenied: say so in thenext callallowedno: it says donea check the modelcannot fake says donenot done: call againThe outcomesomeone is held toDirectionsystem prompt, project file,rules, skillsContextassemble this call's inputModelreads its input, writes aresponseDid it askfor a tool?BoundariesInterfacesrun the tool it asked for, returnthe result as textControlis the work done?Outcome metBoundariesmay it do that?yes The harness, wrapped around the modelContextwhat the model isgivenon this callModelreads it,writes a responseTools and limitsact on what itwrote The harness, wrapped around the modelContextwhat the model isgivenon this callModelreads it,writes a responseTools and limitsact on what itwrote Tools and limitsact on what itwroteContextwhat the model isgivenon this callyesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againContextassemble thiscall's inputModelreads its input,writes a responseBoundariesmay it do that?Did it askfor a tool?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metDirectionsystem prompt,project file, rules,skillsThe outcomesomeone is held to yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metIn an illustrative first week yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome met yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againnonethin: history and areply boxModelreads its input,writes a responseDirectionsystem prompt,project file, rules,skillsDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metThe outcomesomeone is held toContextassemble thiscall's inputModelyesHarnessthin: history and a replyboxOutcome it is held tononeWho decides it is donethe human yesdenied: say so in thenext callallowedno: it saysdonethe last step runs, or a check at theendnot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseBoundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metsteps and brancheswritten in advanceDid it askfor a tool?Modelyes, in slotsHarnesssteps and brancheswritten in advanceOutcome it is held toit can beWho decides it is donethe last step runs, or acheck at the end yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelBoundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textOutcome metModelreads its input,writes a responsethe codeDid it askfor a tool?the codeControlis the work done?ModelnoHarnessn/a: it is all codeOutcome it is held towhatever its author is heldtoWho decides it is donethe code yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomeDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metThe outcomesomeone is held toOutcome met yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?Boundariesmay it do that?Interfacesrun the tool it askedfor, return theresult as textControlOutcome metControlis the work done?Outcome metno: it saysdone yesdenied: say so in thenext callallowedno: it saysdonea check the model cannot fake saysdonenot done: call againThe outcomesomeone is held toDirectionsystem prompt,project file, rules,skillsContextassemble thiscall's inputModelreads its input,writes a responseDid it askfor a tool?BoundariesInterfacesrun the tool it askedfor, return theresult as textControlis the work done?Outcome metBoundariesmay it do that?yes

Step 1 of 14

An agent is not a kind of model.

Ask what an agent is and the answer is usually a model name. That answer does not help when the agent breaks, or when someone asks you to approve one, because on any one step the model did one thing: it read what it was given and wrote a response.

Agent, Workflow, Chatbot, Script
The Outcome Test
Read this figure as text
  1. An agent is not a kind of model. Ask what an agent is and the answer is usually a model name. That answer does not help when the agent breaks, or when someone asks you to approve one, because on any one step the model did one thing: it read what it was given and wrote a response.
  2. Start Simple: The Harness Wraps the Model. The harness builds the context for each call, acts on what the model wrote, and builds the context for the next call.
  3. Five Layers. Everything around the model does one of five jobs.
  4. Tool. A function the harness describes to the model. The model asks for it by name, with arguments; the harness runs it and puts the result into the next call as text.
  5. A permission that refuses the call is a Boundary. In an illustrative first week, the model filled the approval field with "approved", copying an example in the runbook template, though the project file said only a human approves. The Boundary refused the write, the refusal went into the next call, and the model resubmitted without it.
  6. Who decides it is done. Notice that the model saying it is done does not end the run: it only sends the run to the Control check.
  7. Control. The same week, the Control check held a run open until the record listed a service it had missed.
  8. Outcome met. Control decides what happens next; Boundaries decides what is allowed to happen at all.
  9. Chatbot. Strip the harness down to a reply box and you have a chatbot.
  10. Workflow. A workflow is the one most often confused with an agent: it has a model and a harness, and the difference that matters is that it does not choose its own steps.
  11. Script. Take away the model and you have a script.
  12. Who is held to the outcome? Take away the outcome and you have a demo.
  13. What says it is done, other than the model? A test, a reconciliation, a sign-off.
  14. What may it not do alone? A list, enforced by a Boundary, set per action as the previous chapter's autonomy dial describes.

Figure: One pass through the five layers. The outcome sets Direction, Context assembles the call's input and the model responds; a tool request meets Boundaries (denied goes back as a message, allowed runs through Interfaces), and Control calls again until a check the model cannot fake says the outcome is met.

One box in that figure is the model, shown in purple. Every box between the outcome and "Outcome met", other than the model, is code or configuration someone wrote, usually you. Notice that the model saying it is done does not end the run: it only sends the run to the Control check.

Agent, Workflow, Chatbot, Script

Each of the three nouns an agent gets confused with is missing something an agent has.

Model Harness Outcome it is held to Who decides it is done
Chatbot yes thin: history and a reply box none the human
Workflow yes, in slots steps and branches written in advance it can be the last step runs, or a check at the end
Script no n/a: it is all code whatever its author is held to the code
Agent yes all five layers yes, with a named owner a check the model cannot fake

A workflow is the one most often confused with an agent: it has a model and a harness, and the difference that matters is that it does not choose its own steps. What Makes AI Agentic covers when that makes it the better choice.

When the Model Really Is the Fix

Sometimes the harness is fine and the model is the limit.

The step itself is wrong. The input was right, the fact was in the window, and the model still drew the wrong conclusion. The test is cheap: replay the same call, unchanged, a few times against the current model and a few times against a stronger one. If the current model passes only sometimes, the step is unreliable, because each run is a fresh draw (the sampling from What an LLM Actually Is); a check and a retry in the harness is often cheaper than a bigger model. If the stronger model passes where the current one never does, the model was the limit. If both fail, the premise was wrong: read the input again.

The task needs no loop. The Agent Is a While Loop is plain about it: for a task that is "short, low-stakes, or genuinely one-shot", "a single call and the model's own judgment is the entire system." Build no harness beyond the call.

The scaffolding is older than the model. Instructions That Outlive the Model calls every behavioural instruction "a bet against the next model" and says most of those bets lose; harness code that covers a gap the model has since closed loses the same way.

An Example from Change Management

A platform team wants an agent that turns each merged code change into a record in its IT service-management (ITSM) system, rollback plan and affected services included, before the deploy runs.

The outcome: every production change has a complete, accurate record before it ships. The change manager is held to it, not the agent. The model reads the change, the runbook template (the team's standard steps for a change) and the entry in the configuration database (CMDB), and drafts the record. The harness, layer by layer:

  • Context pulls those three into the model's input.
  • Interfaces give read access to the code repository and the CMDB and one write tool for the ITSM system.
  • Control refuses to let the run end while the record's service list disagrees with the services the change touched.
  • Boundaries deny any write that sets the approval field, which only a human may set, and keep the agent's credentials read-only everywhere except that one tool.
  • Direction is a short project file with the record standard and the goal.

In an illustrative first week, the model filled the approval field with "approved", copying an example in the runbook template, though the project file said only a human approves. The Boundary refused the write, the refusal went into the next call, and the model resubmitted without it. The same week, the Control check held a run open until the record listed a service it had missed. Neither catch depended on the model behaving; both were parts of the harness that execute.

The Outcome Test

A system that chooses its own next steps is an agent you can leave running when three questions have answers. Who is held to the outcome? A named person or team, not the agent and not "the business"; no amount of engineering supplies this one. What says it is done, other than the model? A test, a reconciliation, a sign-off. What may it not do alone? A list, enforced by a Boundary, set per action as the previous chapter's autonomy dial describes. Without the first you have a demo: it may work, but no one is held to it working. Without the second you have an agent that grades itself, the first failure in What Makes AI Agentic. Without the third you have something unsafe to leave running.


What to Do Next

  • Find the three parts in one system you run. Its model, the files and code that make up its harness, and who is held to its outcome.
  • Sort your last five agent failures by layer. Context, Interfaces, Control, Boundaries, Direction, or the model's step. In this site's experience the model's column is usually the shortest.
  • Replay before you upgrade. Replay the failing call against the proposed model unchanged, several times, and pay for the model only if the replay passes.
  • Move one rule from Direction to Boundaries. Pick the instruction you would least like the agent to ignore, and enforce it with a permission or a hook.

Previous: What Makes AI Agentic. Next in Foundations: Agentic Thinking in Four Habits, the habits that turn these parts into how you work. Terms are defined in the glossary. By layer: What Compaction Actually Destroys (Context), The MCP Mental Model (Interfaces), Loop on the Gap, Not the Try-Count (Control), The Agent Sandbox You Already Run (Boundaries) and Bound, Don't Script (Direction).