What is an agent harness?
Blame the model for a bad run and you will fix the wrong thing. Most failures live in the code deciding what the model sees and when it stops.
Agent harness
agent loopagentic loop
An agent harness is the surrounding program that runs an AI agent's loop. It assembles the context and tools the model sees, executes the actions it requests, and feeds results back in. It also enforces the rules that decide when a run stops. The model reasons. The harness decides what it is allowed to reason over.
A model on its own does one thing: it takes text in and returns text out. It cannot read a file, call an API or know when to give up. Something has to hand it tools, capture what it asks for, run that action, and put the result back in front of it. That something is the harness.
It also owns the parts a demo skips. A budget on how many turns a run gets. A permission check before a tool actually fires. A record of what was decided and why. None of that comes from the model. All of it comes from the code around it.
This is where production behaviour actually lives
Swap the underlying model and a well-built harness barely notices. The tool definitions stay the same, the stop rules stay the same, the permission checks stay the same. Only the reasoning inside each turn changes. Teams that can say "we swapped the model and nothing broke" are describing their harness, not the model they picked.
Teams that cannot say that usually built the loop by hand, once, around one model's quirks. The context window filled up in an undocumented way. Their stop condition was a hard turn limit instead of a real check. Every tool result went back in unfiltered. None of that shows up in a demo. It shows up three weeks after launch, on the run nobody tested.
This is also why the term has almost no marketing noise around it. "Agent" gets used to sell nearly anything. "Harness" describes one specific piece of code, so it stays useful.
- AssembleBuild the context the model sees.
- CallSend it to the model with tool definitions.
- ExecuteRun the tool call the model requested.
- Feed backPut the result back into context.
- CheckStop, continue, or hand off to a human.
The model only fills the middle of this. Everything else, including whether the loop runs again, is harness code.
Related questions
01Is an agent harness just another word for a framework?
Not quite. A framework is a library you install that gives you a harness plus extras: memory stores, prebuilt agent patterns, integrations. A harness is the narrower concept underneath it, the loop itself, and you can write one without any framework at all.
02What is the agentic loop?
The agentic loop is the repeating cycle a harness runs. Send context to the model, get back a decision, execute it, feed the result back in, check whether to stop. "Agentic loop" and "agent harness" describe the same mechanism from two angles: the process, and the code that runs it.
03Why does the harness matter more than the model choice?
Because most failures in production agents are not the model reasoning badly in one turn. They are a stop condition that never fires, a tool result that overflows the context, or a permission check that was never added. Those are harness bugs, and a bigger model does not fix them.
04Can I build an agent harness myself?
Yes, and for a narrow, well-scoped agent that is often the right call. The cost shows up later. Every stop rule, retry policy and permission check is now yours to maintain across every model update, instead of inherited from a maintained SDK.

