What is an agent harness?
An agent harness is the runtime around a model that assembles context, dispatches tools, and drives the working loop.
Guide details
- Type
- Explainer
- Reading time
- 2 min read
- Scope
- Fourth rung of the agent fundamentals ladder: the runtime that makes models useful.
An agent harness is the software around a language model that turns a single-step text generator into a working system. The model proposes; the harness does everything else: assembling the prompt, enforcing rules, running code, and deciding what happens next.
A typical harness owns several jobs. It builds and maintains context: system prompt, message history, retrieved documents, and tool results, all within the token budget. It defines the tools the model may call, validates the arguments the model produces, executes the real function, and feeds the result back as text. It runs the loop: send context to the model, act on the response, repeat until the task finishes or a limit is hit. It also enforces what the model cannot do, through permission checks, timeouts, retries, and audit logs.
Anthropic's guide on building agents draws a useful line between workflows, where the sequence of model calls is fixed in code, and agents, where the model dynamically decides the steps. Either way, the harness is that code. Agent frameworks and SDKs ship prebuilt harnesses, but the moving parts are the same: context management, tool dispatch, and loop control. When an agent misbehaves, the harness, not the model, is usually where you look first.
Sources
- Building effective agents — AnthropicofficialAnthropic
- Agents — OpenAI documentationdocumentationOpenAI
Taxonomy
Concepts
Topics
Related content
- RelatedWhat is a tool?Tool dispatch and result injection are core harness responsibilities.
- RequiresWhat is an LLM?A harness is defined relative to the model it wraps.
- Used byWhat is an AI agent?Every agent runs on a harness; the harness is the agent runtime.
Related
- What is an AI agent?Mellnx first-partyagent-fundamentals
An AI agent is an LLM plus a harness plus tools running in a loop, with the model deciding each next step.
- What is a tool?Mellnx first-partyagent-fundamentals
A tool is a schema-described function the model can call by name, turning text output into real action.
- What is an LLM?Mellnx first-partyagent-fundamentals
An LLM is a neural network trained to predict the next token, and that single mechanism is the engine every chat app and agent runs on.