What a harness is

Last updated

When an AI agent performs well, people usually credit the model. In practice, much of an agent's behavior comes from the software wrapped around the model, often called the harness. Two products using the same model can perform very differently because their harnesses differ. Understanding what a harness does helps you evaluate agent products and design your own.

The basic idea

A model on its own only takes in text and produces text. It cannot remember earlier sessions, open a file, browse a website, or send an email. It also has no built-in sense of when to stop or what it is allowed to do.

A harness is the program that runs around the model and supplies everything else. It:

  • Gives the model its instructions.
  • Tells the model which tools exist and carries out the tool calls the model requests.
  • Feeds the results back to the model.
  • Runs the decide-act-observe loop described in What AI agents are.
  • Manages what information is in the model's context.
  • Enforces permissions, budgets, and stopping rules.
  • Records what happened.

The name comes from the idea of harnessing power: the model provides capability, and the harness directs it safely toward useful work.

What a harness is made of

Instructions

The harness provides a system prompt that defines the agent's role, goals, rules, tone, and how to use its tools. Good instructions are specific about what the agent should and should not do, how to handle uncertainty, and when to ask a person.

Tools

Tools are the actions the agent can take: searching, reading files, running code, querying a database, calling an API, or operating a browser. The harness describes each tool to the model, receives the model's request to use one, runs it, and returns the result. See Tools and tool calling.

Context management

Models have a limited context window. On long tasks, a harness must decide what to keep in front of the model: the goal, key findings, recent steps, and relevant documents. Techniques include summarizing older steps, saving notes to a file the agent can re-read, and retrieving only the relevant parts of large documents. Poor context management is a common reason agents lose track of their goal.

Memory

Some harnesses store information between sessions, such as user preferences, project notes, or lessons learned. Memory can make agents more useful over time, but it also raises questions about what is stored, where, and for how long.

Permissions and sandboxing

A good harness controls what the agent is allowed to touch. It might give read-only access to some systems, require approval for certain actions, restrict which websites can be visited, or run code in an isolated environment called a sandbox so mistakes cannot affect the rest of the system.

Approvals

The harness can pause before sensitive actions and ask a person to approve, edit, or reject them. This is one of the most important safety features for business use. See Keeping agents on track.

Limits and stopping rules

To prevent runaway behavior and costs, harnesses set limits such as a maximum number of steps, a time limit, a spending cap, or rules for when to stop and report back.

Logging and observability

The harness records each step: what the model decided, which tools it called with what inputs, what came back, and what it cost. Logs are essential for debugging, auditing, and building trust.

Error handling

Tools fail, websites time out, and models occasionally produce malformed requests. A robust harness retries sensibly, reports failures clearly, and avoids repeating a failing action endlessly.

Examples of harnesses you may already use

  • Chat assistants with tools. When a chat app searches the web, analyzes a spreadsheet with code, or creates a document, its harness is running tools on the model's behalf.
  • Coding agents. Tools that work inside a code editor or terminal have harnesses that let the model read and edit files, run commands and tests, and ask for approval before risky operations.
  • Research modes. Deep research features run multi-step search-and-read loops within a harness that manages sources and citations.
  • Agent frameworks. Developers use open-source and commercial frameworks to build harnesses for their own agents, connecting their chosen models to their own tools and rules.
  • Workflow platforms. Automation tools increasingly let you add AI steps or agent steps inside a larger process, with the platform acting as the harness.

Why the harness matters as much as the model

A strong model in a weak harness can be unreliable: it forgets its goal, misuses tools, takes risky actions without checks, or runs up costs. A well-designed harness can make a moderately capable model surprisingly effective by giving it clear instructions, the right tools, well-managed context, and guardrails.

When evaluating an agent product, ask about the harness, not just the model:

  • What tools does the agent have, and what can each one do?
  • What permissions does it need, and can they be limited?
  • Which actions require approval?
  • What limits exist on steps, time, and spending?
  • Can I see a log of every action it took?
  • What happens when something goes wrong?
  • Can I change the underlying model?

Designing a harness for your own use

If you are building or commissioning an agent, these principles help:

  1. Give the fewest tools needed for the task, with the narrowest permissions.
  2. Prefer read-only tools until the agent has proven reliable.
  3. Require approval for anything that sends, deletes, pays, publishes, or changes records.
  4. Set clear limits on steps, time, and spending.
  5. Log everything in a form a person can review.
  6. Write specific instructions, including what to do when uncertain.
  7. Test with realistic and adversarial examples, including content that tries to trick the agent. See Prompt injection explained.
  8. Keep the model swappable, so you can move to a better or cheaper model later without rebuilding everything.

Key takeaways

  • A harness is the software around a model that turns it into a working agent.
  • It supplies instructions, tools, context management, memory, permissions, approvals, limits, and logs.
  • The same model can perform very differently in different harnesses.
  • When evaluating agents, look closely at tools, permissions, approvals, limits, and logging.
  • Good harness design keeps agents useful, safe, and affordable.