> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oumi.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AGENT HARNESSES

> What an agent harness is, what it contains, and why it matters as much as the model

A model takes input tokens (this could be text, images, audio, etc.) and returns output tokens (the output too could be multi-modal).
On its own, it cannot run a tool, read a file, remember an earlier session, or check its own work.
An agent harness is the software around the model that gives it these abilities. A common way to say this is:

> **Agent = model + harness**

Any part of an LLM agent that is not the model weights is part of the harness. The system prompt, the tool definitions, the code that runs each tool call, the conversation history, the memory files, and the rules that stop a run are all harness.

***

## THE MODEL AND THE HARNESS

The model supplies the intelligence. The harness supplies everything that lets that intelligence act.

| The model | The harness |
| - | - |
| Reads the context that it receives | Decides what goes into that context |
| Proposes a tool call | Validates the call, runs the tool, and returns the result |
| Has no memory between requests | Stores the conversation, files, and notes between requests |
| Has a fixed context window | Compacts or offloads context when the window fills |
| Generates the next message | Decides when the run continues and when it stops |

Even a simple chat app is a harness. It is a loop that keeps the message history, adds each new message, and sends the full history to the model on every turn. Without that loop, the model forgets the conversation after each reply.

***

## THE AGENT LOOP

At the center of every harness is a loop, commonly a [ReAct loop](https://towardsdatascience.com/ai-agents-explained-what-is-a-react-loop-and-how-does-it-work/). The model only proposes actions. The harness carries them out and decides what the model sees next.

![The harness builds the context, calls the model, runs each tool call and loops back, and sends the final reply to the user](https://mintcdn.com/oumi/utu7_qxGqvVUwYVB/images/agent-loop-light.svg?fit=max\&auto=format\&n=utu7_qxGqvVUwYVB\&q=85\&s=8f3193b25201921898a4d1354bead38c)

Each pass through the loop is one step. An agent that looks up a customer, reads their order, and then answers runs three steps. The harness also sets the limits on the loop, such as the maximum number of tool calls, the time budget, and which actions need approval from a person.

***

## WHAT A HARNESS CONTAINS

Harnesses differ in size, from a short script to a full product such as a coding agent. Most contain some or all of these parts:

| Part | What it does | Examples |
| - | - | - |
| Instructions | Tell the model its role, rules, and output format | System prompt, project instruction files such as `AGENTS.md` |
| Tools | Define the functions that the model can call, and run them when it calls them | Function definitions, MCP servers, a shell tool |
| Context management | Keep the context window useful as a run gets longer | Compaction, saving large tool outputs to files, loading skills only when needed |
| Memory and state | Keep information between steps and between sessions | Conversation history, memory files, a scratch filesystem, git |
| Execution environment | Give the tools a safe place to run | Sandbox, container, browser, allowed network hosts |
| Orchestration | Split work and route it | Subagents, handoffs between agents, routing to different models |
| Guardrails and hooks | Run fixed logic before or after model steps | Permission checks, approvals, linters and tests after an edit, retries, step limits |

A tool always has two halves. The model sees only the definition: a name, a description, and a schema for the arguments. The harness owns the implementation that runs when the model calls the tool. The model cannot tell whether a tool reads a live database, a fixed test fixture, or a simulation. It's up to the harness to decide on each tool's implementation.

***

## WHY THE HARNESS MATTERS

### THE SAME MODEL GIVES DIFFERENT RESULTS IN DIFFERENT HARNESSES

The harness controls what the model sees and what it can do, so it has a large effect on results.
[LangChain reports](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness), that it moved its coding agent from about the top 30 to the top 5 on Terminal Bench 2.0 by changing only the harness.
[Google research's Harness²](https://github.com/google-research/harness2), keeps the model weights fixed and refines only the harness, and it reports gains of up to 11.5 points on WorkBuddy-Bench from one refinement step.

### THE HARNESS IS FASTER TO CHANGE THAN THE MODEL

You can change a system prompt, a tool description, or a compaction rule in minutes and test the result on the same day.
Changing the model needs new training data and a new training run.
When an agent fails, look at the harness first: a missing tool, an unclear tool description, or context that the model never received causes many failures that look like model errors.

***

## HARNESSES IN OUMI

Oumi uses harnesses in three places:

* **Oumi as the harness:** During [synthesis](https://docs.oumi.ai/guides/synthesis/how-it-works.md#add-tools-and-a-simulated-user) and [evaluation](https://docs.oumi.ai/guides/evaluations/running.md#add-tools-and-a-simulated-user), Oumi runs the agent loop. It presents your [tools](https://docs.oumi.ai/guides/agents/tools.md) to the model, answers each call with a [tool implementation](https://docs.oumi.ai/guides/agents/tool-implementations.md), plays the user with a [simulated user](https://docs.oumi.ai/guides/agents/simulated-users.md), and stops runs that exceed the tool-call limit.
* **Your harness, called by Oumi:** With [Bring Your Own Harness](https://docs.oumi.ai/guides/harnesses.md), Oumi sends each turn of an evaluation to an agent that you already run, and your agent calls the model under evaluation. Your own prompts, tools, and memory stay in place. In the Oumi app, a registered endpoint of this kind is called a **harness**.
* **Your harness, after deployment:** A [deployed model](https://docs.oumi.ai/guides/deployment/deploy-a-model.md) has an OpenAI-compatible endpoint, so any harness that supports that API can use it. Your agent can run there as the main model or as a subagent of another model. See [Run your agent](https://docs.oumi.ai/guides/agents/run-your-agent.md).

To get the best results from a fine-tuned agent, use the same tools and instructions in all three places. The conversations that you generate in Oumi become your training data, so the harness that you use for synthesis is the harness that your model learns.

***

## FURTHER READING

* [The anatomy of an agent harness](https://www.langchain.com/blog/the-anatomy-of-an-agent-harness), LangChain
* [Harness²: recursive agent harnessing](https://github.com/google-research/harness2), Google Research


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.