Harness engineering: real or hype?
Agent = Model + Harness. The harness is everything around the model that turns text prediction into finished work. The name is new. The parts are concrete.
Agent = Model + Harness. Click a part
Instructions and rule files
Text the agent reads every session: its role, the project conventions and the things it must never do. CLAUDE.md and AGENTS.md are the common files.
Prevents: Stops the agent repeating the same mistake and guessing your conventions.
Run tests with `npm test`. Never edit generated files.
Words on this page (15)
- agent
- : A model run in a loop that chooses its own tools and steps until the task is done.
- harness
- : Everything around the model that makes it an agent: prompts, tools, rules, sandboxes, hooks, memory and checks.
- AGENTS.md
- : A shared convention for a repo file with instructions for coding agents.
- tool
- : A function the model can ask your program to run, described by a name, description and argument schema.
- MCP
- : Model Context Protocol: a standard for plugging tools and data into AI apps.
- subagent
- : A helper agent started by another agent for a focused job, with its own context.
- hook
- : A script the harness runs automatically at a fixed point, such as before a tool call. It enforces rules in code.
- tool use
- : The model asks your program to run a function and reads the result.
- observability
- : Being able to see what your system did, through logs, traces and metrics.
- trace
- : The full record of one run: inputs, model calls, tool calls, outputs, timing and cost.
- compaction
- : Summarizing older conversation so a long task fits in the context window.
- eval
- : A repeatable test of AI output quality, run before and after every change.
- workflow
- : A fixed sequence of steps written in code, with model calls at set points.
- prompt
- : The input text you give a model, including instructions, examples and data.
- attention
- : The mechanism that lets each token weigh all earlier tokens by relevance when computing its next representation.
What a harness contains
Instructions and rule files such as .md. , including servers and the descriptions that tell the model when to use them. Sandboxes where code runs, with limits on what it can reach. Orchestration: , model routing and handoffs. , which are deterministic code at fixed points such as before a or a commit. : logs, and cost metering. Memory and context management, including and resets.
Why it is more than a buzzword
Anthropic's long-running work found two failure modes that the model alone does not fix. As context fills, models lose coherence and sometimes wrap up early, so the adds context resets with a written handoff. And a model grading its own work tends to praise it, so the harness separates the generator from a skeptical evaluator. Both are engineering decisions you can test, and they produced measurable gains.
The honest caveat
Most of this is ordinary systems engineering: retries, permissions, tests, logging and separation of duties. The new part is that the central component is probabilistic, so verification and observability matter more, and changes need to prove they help. Google's practice adds meta-debugging: when an agent fails, fix the , not the model. If someone uses the word without naming which of these parts they changed, treat it as marketing.
Try it
Click through the parts in the diagram. Then take your own agent and list which parts exist, which are missing and which failure each missing part allows.
A worked example: one failure, one harness change
Failure: the agent says "done" but half the feature is missing. Cause: no way to check. Harness change: give it the test suite and require passing tests before it can finish. Failure: it edited a config file it should not touch. Harness change: a permission rule blocking that folder. Each change is small and measurable.
How a hook stops a bad action
A hook is code that runs at a fixed point, so the model cannot talk its way past it. Trace for a secrets check:
- The agent finishes a change and asks to run the commit command.
- The harness pauses the call and runs the hook first.
- The hook scans the staged files for text shaped like a password or key.
- It finds one and returns a refusal that names the file.
- The agent reads the refusal, removes the key, and tries again.
A rule in the , "never commit secrets", works most of the time. The hook runs every time, because the check does not depend on the model remembering. It still only catches what its scan can recognise.
What goes wrong: a harness that grows too heavy
A rules file grows to 300 lines. Some rules contradict each other, and the agent starts ignoring parts of it. The symptom is an agent that obeys rules early in a session and drops them later, as the rules compete with the task for and sometimes contradict each other.
To confirm, trim the file to the ten rules that matter. Run the same task ten times with each version and compare the passes. If the short file passes as often or more, the extra rules were noise.
How to tell a checker works
An evaluator that approves everything adds cost and no safety. Plant a known bug in a copy of the code and ask the evaluator to review it. If it misses an obvious bug, tighten its instructions or give it the tests to run. Repeat with three different bugs before you trust it.
When a harness is the wrong tool
Renaming twenty files once does not need sandboxes, tracing and a second agent. Write a short script and check the result by eye. A harness pays off when the task repeats, runs unattended, or can do real damage.
Common mistake
Adding harness parts without a way to measure whether they help.
Two teams use the same model for a coding agent. Team A types prompts into a chat window. Team B built a setup: a rules file, a sandbox, tests the agent can run, a hook that blocks commits with secrets, and a separate reviewer agent. Team B gets far more done with fewer surprises, and the difference is not the model. It is the harness.
Check yourself
A model grades its own output as excellent but it is mediocre. Which harness change helps?
Not quite. Tuning a standalone evaluator to be skeptical is easier than making a generator self-critical.
Which statement about harness engineering is most accurate?
Not quite. The parts are old ideas. The new context is that the central component is probabilistic.
An agent keeps editing a folder it should not touch. Which harness part addresses this?
Not quite. Rules enforced in code cannot be argued around.
You got 0 of 3 right.
Go deeper
- Article
Anthropic · Context resets, evaluator agents and what they bought.
- Article
Anthropic · Initializer and coding agents, progress files and handoffs.
- ArticleHarness engineeringArticle
OpenAI · OpenAI's account of building software with agents inside a harness.
- ArticleThe New Software LifecycleArticle
Addy Osmani · The harness anatomy diagram and its role in each phase.
- Repo
HumanLayer · Principles for building reliable LLM software, with code.
Spotted a mistake or something unclear? Report it on GitHub.