What Is an Agent Harness?
An oversimplified equation: agent harness = ai agent − model.
Overview
An agent harness is everything in an AI agent besides the model — everything outside the LLM inference call. It’s a piece of software that provides an environment for the LLM to observe and take actions.
- The agent harness has a system prompt that defines the LLM’s basic behavior and controls how it puts out tokens.
- The agent harness includes a set of tools that the LLM can call.
- The agent harness interacts with the LLM to get tokens back.
- The agent harness interleaves LLM outputs and tool calls, typically called the agent loop.
The system prompt
Before the user’s message arrives, the harness sends the model a fixed set of instructions: the system prompt. It sets the model’s baseline behavior and constrains how it generates tokens.
Tools
The harness also defines a set of tools the model can invoke: named actions, each with a description of what it does and how to call it. The model doesn’t execute these actions itself — it only requests them.
The model call
The harness communicates with the model through a single interface: it sends a prompt and gets tokens back. That call is the only boundary between the harness and the model.
The agent loop
The harness inspects the returned tokens for a tool call. If one is present, it executes the tool, appends the result to the context, and calls the model again. If not, it returns the output as the final answer. This send-inspect-act cycle is the agent loop.
Further reading
- What is a Harness? — Earendil
- Agent Harness — Microsoft Learn, Agent Framework docs
- The Anatomy of an Agent Harness — Vivek Trivedy, LangChain