The Harness Around the Model
The model handles understanding, judgment, and fuzzy calls. Whether any of it ships depends on the engineering control layer wrapped around it.
The model handles understanding, judgment, and fuzzy decisions. Whether any of that ships depends on the engineering control layer wrapped around it. That layer is the harness. It does not make the model smarter; it decides whether the model's judgment can land inside your system and be recalled when something goes wrong.
What the model owns, what the harness owns
Models are good at inferring intent from messy input, judging under incomplete information, and producing output that needs semantics. They are bad at remembering your release process, restoring state after a crash, and refusing an out-of-scope write.
So the split is clear: semantic understanding, planning, and fuzzy judgment go to the model; deterministic flow, validation, data passing, state, and permissions belong in the harness. Splitting thinking from doing into separate planes also pays directly. One team decoupled planning from execution and cut p50 time-to-first-token by about 60%, because the first byte the user sees stopped waiting on the long tail of tool execution cursor-agent-harness.
But answer one admission question first: does this agent's conclusion have to answer to a person, a rule, or an audit tencent-deterministic-harness? If it does — ticket review that decides user and merchant outcomes, compliance determinations — accept that the LLM is probabilistic (rerun the same ticket and the verdict can drift), and everything the harness does is bridging that gap between probabilistic judgment and deterministic conclusion. That engineering cost is worth paying. If it does not — purely generative work like copywriting, translation, summarization — prompt engineering is enough, and a harness is dead weight. In between there are gradations to use: the model concludes directly, the model recommends and a human decides, or the model only drafts the SOP and auto-execution stays off. Pick the tier by how much responsibility rides on it.
It is not a framework, and it is not MCP
Harness, framework, and MCP get used interchangeably, but they are different layers, and blurring them makes a selection discussion miss its target. Separating them takes one question: does this layer own the loop, state, permissions, and recovery?
| Category | What it owns | What it costs you |
|---|---|---|
| Harness | Loop, session state, permission model, sandbox, recovery — shipped as one unit | The loop is not yours to rewrite; you trade control for production behavior |
| Framework | Primitives and a loop skeleton only | You write the permission policy, the persistence policy, and the sandbox |
| MCP | Tool transport only — no loop, no state | It cannot govern permissions; the spec states it cannot enforce security at the protocol level mcp-spec |
That makes selection simple. If the task looks like coding, operations, or research, a harness gets you further faster. If you need custom control flow — a graph you can test node by node — use a framework, and accept that the policy is all yours to write.
In practice the three are layers, not rivals: a framework orchestrates the outer flow, a harness runs the heavy steps inside its own sandbox, and MCP carries every tool call. Choose by layer, not by brand.
The boundaries are also moving — frameworks are growing harness layers, harnesses are shipping SDKs, and MCP is adding interaction features. The test is not what a thing calls itself today but which responsibilities it takes off your plate.
The four-layer map and its two decouplings
Teams exploring agents usually picture one monolithic program: write a prompt, wire a few external tools, and call it a system. It works in a local demo, and then hits three walls in production.
The first is uncontrolled security and compliance. Put real access credentials directly into the prompt, and the moment model output drifts or an injection lands, database keys and high-privilege tokens walk out the door.
The second is debuggability. When an agent takes a wrong action deep into a long task, an operator who can only see the model's final error line cannot reconstruct which step the misjudgment happened at or which tools were called.
The third is the absence of deterministic protection. A model is capable of emitting a delete command or moving money; with no independent interception layer outside it, the destructive action reaches production.
A production agent therefore cannot be a monolithic black box. It needs four layers with clear jobs:
| Layer | What it holds | Problem it solves |
|---|---|---|
| L4 Platform governance | Credential vault, distributed tracing, baseline eval sets, experience and rule evolution | Long-term security, audit trail, quality regression, continuous evolution |
| L3 Ecosystem protocols | Standard MCP tool bus, A2A between agents, office channel adapters | External capability discovery, multi-role collaboration, reaching humans |
| L2 Decision and orchestration | Dynamic context assembly, model routing, the lifecycle interceptor pipeline (Hooks) | Intent understanding, planning, deterministic checks, human approval |
| L1 Sandbox execution host | Lightweight isolated environments, process lifecycle management, snapshots and rollback | Isolating destructive actions, recovering from a crash mid-run, destroying environments on demand |
Two decouplings make the four layers hold.
Vertical: governance and execution hosts are physically separate. The upper governance services manage security policy, hold enterprise credentials, and collect global metrics, and they never execute untrusted user code themselves. The lower execution host offers clean compute and isolation; whatever the model does inside it cannot contaminate the layer above. Even if the host process dies, the audit records and task state above it survive intact.
Horizontal: the cognitive brain and the operating sandbox are strictly split. The model understands intent, plans, and reasons — it is the brain. Real physical side effects (writing files, calling the network, running commands) are delegated entirely to an isolated sandbox — the hands. And on the path from thought to action sits an interceptor pipeline that cannot be reasoned around. When a destructive action is recognized, the process suspends into a safe wait, and only a signed human approval releases it to the sandbox.
That map is the coordinate system for the chapters that follow: from context assembly and tool contracts, through state machines and human-in-the-loop interception (see Hooks: Deterministic Gates at Each Lifecycle Node), down to virtualized sandbox scheduling and snapshot recovery (see A Process-Oriented Runtime), and standard protocol access (see Ecosystem Connectors). Every mechanism has a defined place on it.
The five jobs a harness does
The harness is talked about as one object, but it does five jobs: Context (what the model sees), Tools (what it can touch), Constrain (fail-safe defaults — every capability starts closed and has to be opened explicitly), Verify (decide automatically whether the result is right), Correct (fix or roll back when it is not) ai-agent-book. The first two decide whether the model can get it right. The last three decide whether you can pull it back when it does not. Most teams spend on the first two and take their incidents from the last three.
The last two each carry a rule that gets skipped. Verify reads structured data only — the fields a tool returned, exit codes, assertion results — and never the prose the model generated, because that text may already be under someone else's influence. Letting the model grade its own account of what happened is letting the defendant issue the certificate of innocence. Correct keeps intermediate state off the screen until recovery has been ruled out: retry quietly, resume generation, and only degrade or hand to a human once you know it cannot be repaired. Showing a user a half-finished result makes their experience pay for your retry budget.
These five are not a rival skeleton to the six domains below. Constraint, verification, and correction land on Gate and Recovery — which are also the two domains most often left without an owner.
What is that layer worth? A reference point that does not depend on a particular model generation: LangChain moved from 52.8% to 66.5% on Terminal Bench 2.0, from outside the top 30 on the leaderboard into the top 5. The model never changed. Everything that changed was harness work — making the agent check its own execution results, notice that it had started repeating itself, and adjust how it spends thinking. The point is not "a harness is worth 13 points." It is that once the model stops being the differentiator, the whole advantage moves to what sits outside it.
This layer grew one piece at a time
A harness today looks like a small operating system — managing subprocesses, keeping memory files, driving tools, handling permissions, isolation, and recovery. Nobody designed it that way up front. Each layer is the answer engineering had to supply after the model hit a boundary.
| The boundary the model hit | The part that got added |
|---|---|
| It does not know what was said last turn | Context assembly |
| It cannot change the outside world | Tool calling |
| One call cannot finish the job | The execution loop |
| History does not fit | Memory |
| The loop starts causing real side effects | Permissions and sandboxing |
| One loop is not enough in parallel | Subagents |
The order is worth remembering, because it explains something routinely misread: the dividing line for an agent is not that it "thinks" — it is that it closes the loop of model → action → environment → observation → model. The model only emits tokens. What keeps it running is the program outside it: parsing the output, deciding whether to stop, calling the environment, writing observations back into context.
The same logic answers whether a stronger model makes the harness disappear. It does not: the more capable the model becomes at acting, the less the runtime around it can afford to be vague. More capability amplifies consequences rather than reducing the need for boundaries, recovery, and records.
The specific problems line up once you see it this way. Tasks get longer, so sessions must be resumable. Side effects get real, so permissions cannot rest on the model's good intentions. Context runs out, so it has to be compacted. Clients multiply — terminal, IDE, desktop, web, SDK — so there must be one shared runtime state. Capabilities multiply, so there must be a definite discovery and loading mechanism. Each looks small enough to keep inside the application. They condense into a separate layer when they arrive together.
Six domains, each with artifacts and an owner
| Domain | Responsibility | Main artifacts |
|---|---|---|
| Identity | Role, inputs and outputs, capabilities, permissions, forbidden actions | Agent contract, policy, capability allowlist |
| Orchestration | Paths, phases, dependencies, parallelism, human nodes | Workflow, state machine, router |
| Context | Selection, isolation, compression, references, handoff | Context policy, handoff, artifact reference |
| Gate | Phase entry, output acceptance, release gates | Validator, checklist, grader |
| Recovery | State, retry, rollback, cancel, resume | Execution ledger, checkpoint, recovery policy |
| Evolution | Failure attribution, experience, rule and asset governance | Trajectory, experience, feedback patch |
Every agent project needs an owner per domain, and safety, permissions, data integrity, and hard gates must live in the system instead of in a prompt openai-harness. The two domains most often left unclaimed are Gate and Recovery: the gate decays into "please check carefully," and recovery quietly defaults to "run it again."
Replaceable, switchable, ablatable
Record what each component solves, what it costs, and how you measure it — and make each one individually replaceable and switchable. The reason is that models move the ground beneath you. A patch written for one generation's quirk can flip from life-saving to dead weight on the next: Anthropic added a context reset to work around a model's context anxiety, and the behavior was gone in its successor. The test is not whether a component helps today. It is whether you can switch it off in five minutes and run an eval that shows the difference.
The symmetric discipline: adopting a harness does not justify multi-agent, a vector store, a durable workflow, or a governance platform. Each of those still has to clear the complexity ladder on its own.
When the next model ships, does this gain or expire?
Test every harness investment with one question: when the next frontier model ships, does this pay off or expire?
Work that substitutes for or compensates model reasoning — decomposing steps, prompt choreography, flow tuning — gets absorbed by the next upgrade, with a half-life of roughly one model generation. Work that hands the model information it cannot manufacture — real internal system state, build output, logs, test feedback — keeps compounding. That is not an argument for never doing the first kind; it is an argument for knowing how much runway you are buying.
The return is a product, not a sum
Return is roughly model capability multiplied by environment capability. The model is a rented factor that rises on the vendor's schedule, outside your control. The environment is a factor you own, have to build yourself, and that only accumulates. Multiplication means that when the environment is zero, no amount of model capability rescues the outcome.
Cursor ran into exactly this when moving agents to the cloud. Locally, an agent inherits a complete environment: installed dependencies, login state, caches, the right data. In the cloud the machine is clean, every invisible premise vanishes, and environment becomes a silent quality killer. Their conclusion is that environment setup is not a deployment detail; it is a precondition for quality cursor-cloud-agents.
So route engineering effort into environment and verification assets: turn internal systems into something with feedback and checkable state, so the agent can obtain ground truth on its own. Do not join the race to make models generate harder. That is the vendor's track, and it is not one you win.
