An agent harness is the runtime software that turns a Large Language Model (LLM) into an executable AI agent. It owns the loop that prepares model input, receives model output, executes approved actions, updates state, and decides whether another model turn is needed.
The harness is distinct from the model. Two products can use the same underlying model but behave differently because their harnesses expose different tools, state, permissions, retry logic, and user interaction patterns.
Common harness responsibilities include:
- assembling context from instructions, memory, retrieved data, and tool results;
- presenting available tool calls and dispatching them to real implementations;
- validating structured output;
- enforcing agent guardrails;
- managing retries, errors, approvals, and step limits;
- emitting agent traces; and
- saving state for a resumable agent run.
The harness works together with agent scaffolding. Scaffolding shapes what the model sees and how it should behave; the harness executes the surrounding control flow.
Harness design is often more important than model choice for production reliability. A strong model inside a weak harness may loop, misuse tools, lose state, or take unauthorized actions. A carefully designed harness can make a smaller or cheaper model useful by constraining the task, validating outputs, and routing difficult cases elsewhere.
The OpenAI Agents SDK running-agents documentation describes a representative harness loop with final outputs, handoffs, tool calls, turn limits, and state management.
The LLM Knowledge Base is a collection of bite-sized explanations for commonly used terms and abbreviations related to Large Language Models and Generative AI.
It's an educational resource that helps you stay up-to-date with the latest developments in AI research and its applications.