In short
Harness engineering means designing everything around an AI model that makes an agent reliable: its tools, context, permissions, tests, feedback loops and guardrails. A common shorthand is Agent = Model + Harness. It matters because models are increasingly capable, so what limits results is often the environment. Start by making your project easy to verify, with fast tests, clear instructions and restricted permissions.
The definition
The phrase took off during late 2025 and early 2026, and the widely repeated formula is Agent = Model + Harness, commonly credited to Mitchell Hashimoto. The harness is everything in an agent besides the model. Other guides define the discipline as designing the systems, constraints and feedback loops that wrap around AI agents to make them reliable in production.
Accounts of the term's exact origin differ, and much of what's written comes from blogs and vendors, so don't treat it as a formal standard. But the underlying idea is sound, and it's a useful way of thinking about AI work.
What's in a harness
| Part | What it does | Example |
|---|---|---|
| Instructions | Tell the agent how your project works | AGENTS.md, CLAUDE.md |
| Tools | Let it act on the world | Shell, search, MCP servers |
| Context management | Control what it sees | Compaction, retrieval, subagents |
| Permissions | Limit what it can do | Sandboxes, allow lists, approval steps |
| Verification | Tell it when it's wrong | Tests, type checks, linters, screenshots |
| Feedback loops | Turn failures into improvements | Rules added after a repeated mistake |
| Orchestration | Coordinate multiple steps or agents | Plans, handoffs, retries |
| Observability | Show what happened | Logs, traces, cost tracking |
How it relates to other terms
These overlap, but they operate at different levels:
- Prompt engineering: crafting a good input for one model call.
- Context engineering: deciding what information the model has at each step.
- Harness engineering: the whole system, including context, tools, permissions and feedback. One source treats context engineering as a component of it.
Think of a car. The prompt is where you want to go. The context is the map and the mirrors. The harness is the steering, brakes, dashboard and seatbelts.
Tools and permissions
Tests and feedback loops
Why it matters now
Capable models are widely available. Many teams have access to similar models, so differences in results often come from how they're used. The harness can vary much more than the model does.
Agents make longer runs. A chat answer can be checked at a glance. An agent working for an hour makes many decisions, and small errors multiply without checks.
Reports from the frontier point this way. Accounts describe an OpenAI team's experience of building a large codebase mainly through agents, with the humans' job shifting to designing the environment. These are second-hand accounts, and most teams shouldn't copy them directly, but they show the direction of travel.
What good looks like in a software project
The agent can check its own work. This is the most valuable item on the list. If an agent can run a fast test suite and see failures, then it can often correct itself. If the only way to check is for a human to click around, then you're the bottleneck. Our guide to how to test a vibe-coded app can help.
Mistakes become rules. When the agent gets something wrong twice, don't just fix it. Add a linter rule, a test or a line in your instructions, so that it can't happen again. A linter that fails with a clear error message teaches the agent at exactly the right moment.
The codebase is easy to navigate. Consistent structure, clear names and short files help agents, as well as people. Generated documentation is only as useful as it is accurate.
Boundaries are enforced mechanically. Rather than asking an agent nicely to avoid production, make sure that it can't reach production. Prompts aren't security controls.
Risky actions need approval. Deploys, deletions, payments and anything hard to undo should pause for a human, or be impossible. See how to put a human in the loop.
Runs are visible. You can see what it did and what it cost, and you can stop it.
A harness for AI products
If you're building an AI feature for customers rather than a coding workflow, the same ideas apply:
- Evaluations: a test set that shows whether a change made things better. See how to evaluate an LLM feature.
- Guardrails: checks on what comes in and goes out. See what an AI guardrail is.
- Tool design: clear descriptions and narrow permissions. See how to write a tool description for an agent.
- Failure handling: timeouts, retries and fallbacks. See how to handle LLM failures gracefully.
- Logging and cost controls. See how to log and debug AI features.
- Defence against manipulation. See how to stop prompt injection.
How to start
You don't need a platform, or a new job title. Start with the highest-value basics.
- Make your tests fast and easy to run. Put the exact commands in your instructions file.
- Write a short instructions file, with conventions and commands. Keep it short, because it's loaded every time.
- Set permissions deliberately. Start with approval for commands and edits, and then allow more as you gain trust. Keep production credentials out of reach.
- Keep a list of repeated mistakes. Convert each one into a test, a lint rule or an instruction.
- Review everything that ships. See how to do a code review.
- Measure. Track how often an agent's work is accepted, how many corrections it needs and what it costs.
What to be careful of
- Overbuilding. Elaborate multi-agent systems are often unnecessary. Start simple, and add complexity only when you can see it's needed.
- Believing the hype. Claims about how much a harness improves results are often from those selling one. Measure your own.
- Removing humans too early. A good harness lets people review less often, but it doesn't remove accountability.
- Forgetting that tools change. Keep your setup portable, because this market moves quickly. See Gemini CLI vs Claude Code for an example.
If you'd like help building a reliable AI development setup or product, book a call.
Common questions
What is harness engineering in AI?
It's designing everything around an AI model that makes an agent reliable, including tools, context, permissions, tests and feedback loops. The common shorthand is Agent = Model + Harness. The focus is on the system rather than the wording of a prompt.
How is harness engineering different from prompt engineering?
Prompt engineering is about the input to one model call. Harness engineering is about the whole environment, including how the agent gets context, what it can do, how its work gets verified and how failures improve the system over time.
Do I need harness engineering for small projects?
You need the basics, even if you never use the term: a short instructions file, runnable tests and sensible permissions. Those make any agent more useful. Complex orchestration or multi-agent systems usually aren't worth it for small projects.
What is the most important part of a harness?
For coding, usually verification. When an agent can run fast tests and see its failures, it can correct itself without you. After that come clear instructions and well-enforced limits. Measure what helps most in your own project.