What Is Harness Engineering? The Part of an AI Agent That Isn't the Model
PublicNovember 25, 20267 min read

What Is Harness Engineering? The Part of an AI Agent That Isn't the Model

Harness engineering is the work of building everything around a model — the loop, tools, context, permissions and checks — so an agent does the job reliably. Here is what it means and how to start.

Share:XLinkedIn

You have learned prompt engineering. You have probably heard that "context engineering" is the new prompt engineering. And now, in every agent talk and every second post on your feed, there is a third term: harness engineering. Is this just another buzzword, or is something real changing?

If you want some background first, two of my earlier videos pair well with this post. To see where the loop, tools, memory and planning sit inside an agent, I walked through it part by part in Anatomy of AI Agents: How They Actually Work. And for why the sandbox and permission parts of a harness matter so much, see MCP Explained: What's the worst that could happen?.

Let's take this step by step.

Where did the term come from?

The word "harness" has been used for evaluation rigs and agent runtimes for a while, but the phrase harness engineering took off in early 2026:

SourceDateWhat it adds
Mitchell Hashimoto, "My AI Adoption Journey"5 Feb 2026Names the habit: whenever an agent makes a mistake, engineer a solution so it never makes that mistake again
OpenAI, "Harness engineering: leveraging Codex in an agent-first world"Feb 2026Describes engineers designing environments, structure and feedback loops so agents can do the work
LangChain (Vivek Trivedy), "The Anatomy of an Agent Harness"10 Mar 2026The cleanest definition: "Agent = Model + Harness" — if you're not the model, you're the harness
Anthropic, "Harness design for long-running application development"24 Mar 2026Shows harness choices (planner, generator, separate evaluator, context resets) changing what an agent can finish

Hashimoto was candid that he did not know whether an accepted term existed yet. Today it clearly does.

Prompt vs context vs harness: what's the difference?

These three are layers, each wrapped around the previous one.

LayerThe question it answersExample
Prompt engineeringWhat do I ask, and how?"Summarise this PR in three bullet points."
Context engineeringWhat information should the model see right now?Load only the relevant files, the last error, and the team's style rules
Harness engineeringWhat system runs the model, checks its work and decides what happens next?A loop that runs tests after every edit, blocks network access, retries on failure, and stops after 20 steps

A model, on its own, takes text in and produces text out. It cannot run code, remember anything between sessions, or check whether its answer actually worked. The harness is what gives it those abilities.

What is inside a harness?

There is no single official list, but most harnesses are built from the same parts. LangChain's post lists system prompts, tools/skills/MCPs, bundled infrastructure like a filesystem or sandbox, orchestration logic, and hooks or middleware. In plain words:

  1. The loop. Call the model, run what it asked for, feed the result back, repeat.
  2. Tools. The actions the agent can take: shell commands, file edits, APIs, MCP servers.
  3. Context management. What goes into the window each turn, what is summarised, what is stored in files for later.
  4. Sandbox and permissions. What the agent is allowed to touch, and what needs a human's approval.
  5. Verification. Tests, linters, type checks, screenshots, or a separate reviewer that tells the agent when it is wrong.
  6. Stop conditions. When to finish, when to give up, and when to ask for help.
  7. Observability. Logs and traces so a human can see what happened and why.

Think of a Formula 1 car. The engine matters enormously, but nobody wins a race with just an engine. The chassis, the brakes, the telemetry and the pit crew turn raw power into laps. The model is the engine; the harness is everything that lets it finish the race without crashing.

How do you actually "do" harness engineering?

Hashimoto's version is the most practical starting point. Every time the agent does something wrong, you fix the system, not just the output. He describes two forms:

  • Better implicit prompting in an AGENTS.md file (or equivalent). For simple, repeated mistakes — running the wrong command, using the wrong API — add a line. He says each line in his example file is based on a bad agent behaviour.
  • Actual tools. Scripts that let the agent check itself: take a screenshot, run a filtered test suite, and so on.

Here is what that loop looks like in practice:

Agent runs the full test suite every time → slow, wastes tokens
  → Add to AGENTS.md: "Run only the tests for the package you changed: npm test -- <path>"
Agent edits generated files by hand → changes get overwritten
  → Add a lint rule that fails on edits to /generated, and a note explaining why
Agent says "done" without checking the UI
  → Add a script that takes a screenshot of the page, and require it before finishing

OpenAI's team adds an important warning about the instruction file itself: give the agent a map, not a 1,000-page manual. They tried one big AGENTS.md and found that it crowded out the task, became stale, and was hard to verify. Their fix was a short AGENTS.md of roughly 100 lines that points to deeper, versioned documentation.

Anthropic's research adds another lesson: separate the worker from the judge. When agents were asked to evaluate their own work, they tended to praise it even when the quality was mediocre. A separate evaluator, tuned to be skeptical, was far easier to get right.

Why does this matter for you right now?

Because two developers can use the same model and get completely different results. One gets an agent that edits the right files, runs the right tests and stops when it is done. The other gets an agent that wanders, burns tokens and confidently ships broken code. The difference is usually not the model. It is the harness.

This is also why "which model is best?" is often the wrong first question. A better one is: what does my agent need around it to succeed on this task?

You may also hear loop engineering in the same conversations. Some writers use it for the layer above a single run — designing how many runs work together over time. Treat it as a close cousin of harness engineering rather than a separate discipline.

What are the limitations?

  • A harness doesn't make the model smarter. It changes what the model can reach and how its work is checked, not how well it reasons.
  • The term is still fuzzy. Product teams call a whole coding agent "a harness"; benchmark researchers use the same word for a test rig. When someone says "harness", ask which one they mean.
  • Some of it will be absorbed into models. LangChain expects models to get better at planning and self-verification natively, so some harness pieces will matter less over time. But just like prompt engineering didn't disappear, a well-designed environment, the right tools and good verification will keep helping any model.
  • It is real engineering work. Every rule and script is something you now have to maintain.

Conclusion

Prompt engineering asks what to say. Context engineering asks what the model should see. Harness engineering asks the bigger question: what system will make this model reliable, every single time? And the simplest way to start is the one Hashimoto describes — the next time your agent makes a mistake, don't just fix the output. Fix the harness.

References

Share:XLinkedIn

Related Articles

Comments

Sign in to join the conversation.

No comments yet. Be the first to share your thoughts!