One-Sentence Answer
A harness is everything around an AI model except the model itself — and harness engineering is the discipline of designing that environment so an agent gets the right answer the first time and self-corrects before a human ever sees the output.
This is the shift that quietly defines who ships reliable AI in 2026. As models get more capable, the bottleneck stops being "how smart is the model" and becomes "how well did we build the system around it."
The Problem: A Smart Model Is Not an Agent
An LLM by itself is stateless. Start a new session and it remembers nothing. Give it a multi-step task and it has no built-in way to run a tool, check its own work, persist progress, or recover when something breaks.
That gap is exactly what a harness fills.
The term comes from a now-common shorthand in the agent world: Agent = Model + Harness (LangChain's team uses this framing, and OpenAI, Anthropic, and Martin Fowler's group have all since written about it). The "harness" is the operational wrapper that turns a raw text generator into something that can do sustained, multi-step work.
What Is a Harness, Concretely?
Think of the model as the engine and the harness as the car around it: chassis, steering, brakes, dashboard, and fuel system. Without the car, the engine just sits there.
In practice, a harness handles what the model cannot:
- Tool execution — calling your APIs, running a script, querying a database, and returning the result into the next step.
- Memory and state — persisting context across turns and sessions so the agent picks up where it left off.
- Context management — deciding what to feed the model at each step (retrieved docs, prior results, constraints) without overflowing the window.
- Feedback loops — sensors that check the work: tests, linters, type checks, browser checks, logs.
- Approval policies — rules about what the agent may do automatically and what waits for a human.
- Error recovery — retrying, rolling back, or escalating when a step fails.
Microsoft's Agent Framework documentation puts it plainly: a harness is "the runtime scaffolding that turns a language model into an agent that can perform work." It drives model and tool calls, manages conversation state and context, applies approval policies, and keeps the agent progressing through a multi-step task.
Why Harness Engineering Became Its Own Discipline
In February 2026, OpenAI published a now widely-cited engineering post: a small team built a product with zero manually-written code, shipping on the order of a million lines generated by Codex agents. Their conclusion was not "the model got good." It was that their hardest problems were no longer writing code — they were designing environments, feedback loops, and control systems.
That is harness engineering. The human's job shifted from "write the function" to:
- Specify intent clearly.
- Build the environment and tools the agent needs.
- Add feedback loops that catch drift.
- Step in only when the system cannot self-correct.
Martin Fowler's site frames it through cybernetics: a well-built harness acts like a governor, combining feed-forward guidance (rules, references, how-tos) with feedback sensors (review agents, static analysis, runtime logs) to steer the codebase toward a desired state. The goal is twofold: raise the odds the agent is right the first time, and self-correct as many issues as possible before they reach human eyes.
The Parts of a Good Harness
You do not need a massive platform to start. A useful harness usually has these layers:
1. Feed-forward guidance (computational + inferential)
- Computational: language servers, CLIs, scripts, codemods, type checks.
- Inferential: written rules, architectural constraints, reference docs, how-tos.
These anticipate mistakes and make the right path the easy path.
2. Feedback sensors
- Static analysis, unit and integration tests, linters.
- Runtime signals: logs, browser checks, observability dashboards.
- Review agents that critique the diff before a human reviews it.
3. State and memory
- A place to store what happened, what was decided, and what to do next.
- Cross-session memory so the agent is not re-taught your project every time.
4. Guardrails and approvals
- Least-privilege tool access (read-only first; writes behind confirmation).
- Clear boundaries between "agent may act" and "human must approve."
Harness Engineering vs Context Engineering
The two are related but not the same.
- Context engineering is about what you put in front of the model at each step: prompts, retrieved knowledge, compressed history, and constraints.
- Harness engineering is the wider system: context plus the loops, sensors, state, and guardrails that keep the agent moving toward a goal over time.
You can have great context and still fail if the feedback loop is missing. Harness engineering is the umbrella; context is one of its inputs.
When You Need One (and When You Don't)
| Situation | Need a harness? | | --- | --- | | One-shot "summarize this" | No — a direct call is fine | | Multi-step coding task | Yes — needs state, tools, and verification | | Long-running agent (hours/days) | Yes — needs persistence and recovery | | Agent that acts on your systems | Yes — needs approvals and guardrails | | Reusable internal assistant | Yes — needs memory across sessions |
Rule of thumb: if the work spans more than one step or touches anything real, the harness is what makes it safe and repeatable.
A Simple Mental Model to Start
You do not have to build OpenAI-scale infrastructure. Start with a thin but real harness:
- Give the agent one clear job and a defined output.
- Let it call one or two narrow, read-only tools.
- Run a cheap check after each step (a test, a lint, a schema validation).
- Log what happened so the next run learns.
- Only then widen what it is allowed to do.
That loop — act, sense, correct — is the entire game. The model supplies the reasoning; the harness supplies the discipline.
Key Takeaways
- A harness is everything around the model: tools, memory, state, feedback, and guardrails.
- Harness engineering is now a distinct discipline because the model is rarely the bottleneck — the environment around it is.
- Feedback loops and guardrails matter more than prompt cleverness for reliable, multi-step agents.
- Start small: narrow tools, cheap checks, persistent logs, then expand scope.
If you want to see this applied to a specific tool, read the companion pieces: harness engineering with ChatGPT and harness engineering with Hermes.




