Lesson 10.1: The model is not the agent: the harness
Learn what a harness is and why it matters as much as the model: task contracts that define done, context maps that show where things are, and a minimum viable harness.
By the end of this lesson you will be able to say what a harness is and what it contains, explain why the same model can be a reliable agent in one harness and an unreliable one in another, write a task contract that defines the goal, scope, evidence and limits of a piece of work, build a context map that tells an agent where to look, and decide on the smallest harness a given agent needs. You will work out that a ten-step run in which each step is wrong 5 per cent of the time succeeds only 59.9 per cent of the time, and that the same model in a harness that catches 80 per cent of the step errors succeeds 90.4 per cent of the time, and that a clearer task contract that cuts failures from 25 to 10 per cent saves ₹9,000 a day on 500 tasks at ₹120 of rework each. You should have read Modules 6 to 9, especially Lessons 7.1, 7.2, 8.3 and 9.1. No code is needed. The mathematics is powers and percentages.
This is the first lesson of a module about a layer of agent design that is easy to overlook. The earlier modules covered the model, the tools, the memory, the context and the safety controls. In practice, the reliability of a real agent depends less on which model is chosen than on everything built around it. That surrounding structure has a name. It is the harness. This module treats it as a subject of engineering in its own right.
The model is not the agent
It is natural to talk about "the agent" as though it were the model. A person says "we use such-and-such model for support". But a model, on its own, is a function that takes text and returns text. It has no memory between calls, no way to act on the world, no way to check its own work and no idea what your organisation expects. Everything that turns that function into something that does reliable work is added around it.
The harness is that added structure: the code, configuration and conventions that surround the model and determine what it is asked to do, what it can see, what it can do, how its work is checked, what happens when it fails and what record is left. Put another way, an agent is a model plus a harness, and the harness decides what kind of agent you get.
This has a practical consequence. Two teams can use the same model and get very different results, because their harnesses differ. When an agent disappoints, the instinct is to wait for a better model or to rewrite the prompt. Often the better move is to improve the harness: define the task more precisely, show the agent where information lives, check its work, limit what it can do and record what it did. A good harness also makes model changes cheap, since the surrounding structure stays the same and you can swap or upgrade the model and see how it performs.
What a harness contains
Nine components cover most harnesses. Each has a lesson in this track, and this module ties them together.
Component · What it does · Where it is coveredTask contract · Defines the goal, scope, inputs, outputs, evidence of completion, budget and stop conditions · This lesson
Context map · Tells the agent where information lives and what to read first · This lesson
Tool gateway · One controlled doorway for every tool call, applying policy and recording each call · Lesson 10.2
Policy outside the prompt · Rules enforced in code, not left to the model's obedience · Lesson 10.2
Durable state · The record of progress that survives interruptions · Lessons 8.3 and 10.3
Evidence-based completion · A rule that work is done only when evidence says so · Lesson 10.3
Adversarial verification · An independent check that tries to find what is wrong · Lesson 10.3
Bounded recovery · Limits on retries and a defined route when things fail · Lessons 7.4 and 10.3
Traces and change receipts · A record of what happened and what changed, for debugging and rollback · Lesson 10.4
The model sits in the middle, doing the reasoning. The harness decides what reaches it and what happens to what it produces.
Why a harness changes reliability
A simple calculation shows how much the harness can matter. Suppose a task needs ten steps, and at each step the model makes an error 5 per cent of the time. With no checks, an error at any step spoils the result. The chance that all ten steps are right is 0.95¹⁰ = 0.599, or 59.9 per cent. Four runs in ten fail.
Now add a harness that checks the output of each step, by validating its format, comparing it with an expected range or running a quick test, and catches 80 per cent of the errors, so that they are retried or corrected before they spread. The effective error rate per step falls to 5% × 20% = 1%. Over ten steps the chance of success is 0.99¹⁰ = 0.904, or 90.4 per cent. With a check that catches 95 per cent of errors, the per-step error is 0.25 per cent and the success rate is 0.9975¹⁰ = 97.5 per cent.
The model has not changed. Its error rate is the same 5 per cent at each step. The harness turned a 60 per cent system into a 90 or 97 per cent one. A better model, one that made errors 2.5 per cent of the time, would give 0.975¹⁰ = 77.6 per cent without checks. In this example, a check that catches half the errors does as much as halving the model's error rate, and a strong check does far more.
Predict first: a model is wrong at 5 per cent of steps and a task has ten steps. Without any checks, about what share of runs succeed? And if a harness catches 80 per cent of the errors at each step, about what share succeed? Decide before reading on.
The answers are about 60 per cent and about 90 per cent.
The task contract
The first part of the harness is the simplest, and the most often skipped. A task contract is a written definition of the work, handed to the agent in a fixed form. Most agent failures that people call "the model misunderstood" are really a missing or vague contract. The model did a reasonable thing with an unclear request.
A good task contract has eight parts.
Part · What it says · ExampleGoal · The outcome wanted, in the requester's terms · "Reconcile the October bank statement against the ledger"
Scope · What is in and what is out · "Only account 4410. Do not adjust entries"
Inputs · What the agent is given and where · "Statement file at path X, ledger export Y"
Outputs · What it must produce, and in what form · "A table of unmatched items with amounts and dates"
Definition of done · The conditions that must hold for the work to count as complete · "Every statement line is matched or listed as unmatched"
Evidence required · What the agent must show to prove it is done · "Counts of matched and unmatched lines, and totals that agree"
Limits · Budget in steps, time and money, and permissions · "At most 40 steps and ₹50. Read-only access to the ledger"
Stop and escalate conditions · When to stop and hand back · "If more than 5 per cent of lines are unmatched, stop and report"
Most of this is the same material as a brief to a worker in Lesson 5.2 and a hand-off record in Lesson 5.3, applied to every task, and made a standard form that the harness checks. Two parts deserve emphasis.
Definition of done. Without it, the agent decides when it has finished, and models tend to declare success early. A definition that can be checked, such as "every line is matched or listed", turns "done" from an opinion into a test. Lesson 10.3 shows how to enforce it.
Evidence required. The contract says not only that the agent must finish, but what it must show. "I reconciled the statement" is a claim. "412 of 415 lines matched, 3 unmatched, total difference ₹0.00 after the 3 listed items" is evidence that can be checked.
What a contract saves
Vague requests cost money, in rework. Suppose a team handles 500 tasks a day. With loose, free-text requests, 25 per cent need rework. With a task contract that spells out scope, output and done, rework falls to 10 per cent. Each rework costs ₹120 in people's time and compute. The saving is 500 × (0.25 − 0.10) × ₹120 = 500 × 0.15 × ₹120 = ₹9,000 a day. These rates are assumptions you should measure, and the pattern is common: a modest amount of writing at the start saves a lot of correction at the end.
Writing contracts people will use
A contract that is long and tedious will be skipped, or filled in carelessly. Four habits help.
Use a template with fixed fields, so that none is forgotten and code can check that each is filled.
Keep each field short and specific. One line for the goal, a short list for the rest.
Make "done" a checklist, not a description.
Generate what you can. Many fields can be filled by code from the request type: the limits, the permissions and the standard stop conditions. The requester supplies the goal, scope and inputs.
Some of the best contracts are produced by the agent itself, in a first step: it reads the request, drafts a contract and a person confirms it. For small tasks this is overkill. For larger or riskier ones, it catches misunderstandings before any work is done.
The context map
The second simple component is the context map. An agent working in a large environment, such as a codebase, a shared drive, a ledger system or a knowledge base, does not know where anything is. Without help, it searches blindly, or, worse, it guesses. A context map is a short, maintained guide that tells the agent where things are and what to read first.
It is not a manual. Lesson 9.1 showed that loading too much context hurts. The map is an index: a few hundred to a couple of thousand tokens that point to the sources, so the agent can fetch what it needs just in time. A good map has:
The layout. What the main areas are and what each holds. "Invoices are in the ap/ folder, one subfolder per month. Policies are in policy/."
Where to start. The first files or documents to read for a given kind of task.
Conventions. Naming patterns, formats, units and anything unusual that a newcomer would trip over.
What is authoritative. Which source wins when two disagree, and which are out of date.
What not to touch. Areas that are off limits or fragile.
How to check your work. The tests, reports or tools that tell you whether the work is right.
A map like this is what a good colleague would give a new joiner on the first day. Without it, the agent rediscovers the layout at every run, wastes steps and tokens and makes errors by relying on a stale copy. With it, the agent goes to the right place first.
Keeping it short, and keeping it true
Two dangers apply. A map that grows into a long manual defeats its purpose, since the agent must read it all every time. Keep the main map small, and let it point to deeper notes for particular areas, which are read only when relevant. And a map that is out of date is worse than none, because the agent trusts it. Give the map an owner, a review date and, if possible, an automatic check that the paths and names it lists still exist.
A useful discipline is to grow the map from failures. Each time an agent wastes steps looking in the wrong place, or uses an outdated source, add a line. Over time the map becomes a record of what a newcomer needs to know. This idea returns in Lesson 10.4 as the harness flywheel.
The minimum viable harness
It is tempting to build every component at once. That is a mistake. A heavy harness costs time to build, adds tokens and delay to every run, and has to be maintained. Start with the minimum viable harness: the smallest set of components that makes the agent reliable enough for its job.
Match the harness to the risk and the task.
A low-stakes drafting agent. A task contract, a short context map and a trace. That may be all.
An agent that changes records. Add a tool gateway with limits, evidence-based completion and a change receipt.
A high-stakes agent, such as one that moves money. Add policy in code, approval gates, adversarial verification, durable state and full audit.
Build it up from observed failures. Run the agent, watch where it fails, and add the lightest component that would have prevented each failure. This keeps the harness proportionate and tied to real problems. It also guards against the opposite problem, which is that harnesses accumulate rules that were once needed and are no longer, as Lesson 10.4 discusses.
A rough test for any component is: "what failure does this prevent, and how often does that failure happen?" If you cannot answer, it may not be needed yet.
Three worked examples
Example 1: a reconciliation agent
A finance team's agent reconciled bank statements and often reported success on partial work. The team wrote a task contract with a definition of done, "every statement line is matched or listed as unmatched", and an evidence field, "counts and totals that agree". They added a context map, five lines long, saying where the statements and ledger exports live, that the bank's date format differs from the ledger's and which ledger is authoritative. Rework fell from 22 to 9 per cent. The model did not change.
Example 2: the same model, two harnesses
Two teams used the same model for a document-extraction task of eight steps. Team A gave it a prompt and the documents. Team B added a schema check on each step's output, a check that totals agreed and a retry on a failed check. The model erred on about 4 per cent of steps in both. Team A's runs succeeded 0.96⁸ = 72 per cent of the time. Team B's checks caught about 85 per cent of errors, giving an effective 0.6 per cent per step and 0.994⁸ = 95.3 per cent. Team A concluded that the model was not good enough. Team B concluded that it was.
Example 3: a map that went stale
An agent working on a repository relied on a context map that said the tests lived in tests/unit. A refactor moved them to tests/. The agent kept reporting that no tests existed and declared work complete without running any. A nightly check that every path in the map exists would have caught it on day one. The team added that check, and made the map's owner part of the refactoring checklist.
A checklist for the first two components
1. Write a task contract template with the eight fields. Make code check that each is filled.
2. Make the definition of done a checkable list, and name the evidence required.
3. Fill what you can from the request type: limits, permissions and standard stop conditions.
4. Write a context map: layout, where to start, conventions, authoritative sources, no-go areas and how to check work. Keep it short.
5. Give the map an owner, a review date and an automatic check that its paths exist.
6. Add a line to the map after each failure caused by not knowing where something was.
7. Start with the minimum viable harness, and add a component only for a failure you have seen.
Common mistakes
Treating the model as the agent. The harness decides much of the reliability.
Waiting for a better model. Often a better harness is cheaper and sooner.
Free-text requests. Missing scope and done conditions cause most "misunderstandings".
No definition of done. The model declares success early.
A claim in place of evidence. Require counts, totals and checks that can be verified.
A context map that is a manual. Keep it an index, and let the agent fetch the rest.
An unowned, stale map. The agent trusts it and goes wrong.
Building everything at once. Start minimal and grow from failures.
Adding rules with no known failure behind them. They cost tokens and may be wrong.
Key takeaways
A model is a function from text to text. The agent is the model plus its harness: the structure that decides what the model is asked, what it sees, what it can do, how its work is checked and what is recorded.
The harness has nine parts: task contract, context map, tool gateway, policy outside the prompt, durable state, evidence-based completion, adversarial verification, bounded recovery and traces with change receipts.
A harness can matter as much as the model. At 5 per cent error per step over ten steps, no checks give 59.9 per cent success, and checks that catch 80 per cent of errors give 90.4 per cent.
A task contract defines goal, scope, inputs, outputs, definition of done, evidence required, limits and stop conditions. It cut rework from 25 to 10 per cent in the example, saving ₹9,000 a day.
A context map is a short, owned, current index of where things are, what is authoritative and how to check work. Grow it from failures.
Build the minimum viable harness for the risk, and add components for real failures.
Check yourself
1. What is a harness?
Everything built around the model that determines what it is asked, what it sees, what it can do, how its work is checked, what happens on failure and what is recorded.
2. A model errs on 3 per cent of steps and a task has 12 steps. What is the success rate with no checks?
0.97¹² = 0.694, about 69.4 per cent.
3. In that case, a harness catches 90 per cent of errors. What is the success rate?
The effective error is 0.3 per cent, so 0.997¹² = 0.965, about 96.5 per cent.
4. Name the eight parts of a task contract.
Goal, scope, inputs, outputs, definition of done, evidence required, limits, and stop and escalate conditions.
5. Why should the definition of done be a checklist?
Models tend to declare success early. A checkable list turns done from an opinion into a test.
6. Why must a context map be short and have an owner?
A long map must be read every time and defeats its purpose, and an unowned map goes stale, which makes the agent trust wrong information.
Try this
Set aside seventy-five minutes.
1. Take a task an agent does. Write its task contract with all eight fields. Make the definition of done a checklist and name the evidence.
2. Compare it with how the task is requested now. List what the contract adds.
3. Use the contract simulator with your task volume and an estimate of rework to see what a contract might save.
4. Write a context map of under 40 lines for the environment the agent works in. Mark what is authoritative and what must not be touched.
5. Write an automatic check that the map's paths and names exist.
6. Use the reliability simulator with your estimate of the model's error and the number of steps. What would a harness catching 80 per cent of errors do?
7. List the components you need now for this agent, and the failure each one prevents.
A good result is a task contract template, a context map and a short harness plan tied to real failures. Lesson 10.2 builds the next component: a single controlled doorway for everything the agent does.
Tags: Agentic AI Harness engineering Task contracts Context maps Agent reliability