← AI glossary

AI glossary · Basic · Agents

Harness

A harness is all the code, configuration and execution machinery outside an AI model that surrounds it. It helps the model become an AI agent that actually does work, and is often summarized as 'agent = model + harness'.

About this term
Level
Basic · Technical terms you often meet in AI news
Fields
Agents
Added
2026-10-08
In plain words If the model is a powerful engine, the harness is the car body. You need a steering wheel, a dashboard and brakes to use the engine's power to get where you want to go safely. However, a harness is not a fixed set of parts but something you keep adjusting and adding to for the job, so it is closer to a work environment you keep tuning than to a finished car.

What it is

An LLM, at its core, only takes in data such as text and images and produces text. On its own, it cannot remember earlier conversations for long, run code, look up the latest information or set up a work environment. Harness is the umbrella term for everything that fills these gaps. A LangChain blog post defines a harness as 'every piece of code, configuration, and execution logic that isn't the model itself.' This includes the system prompt; tools, skills and MCP along with their descriptions; execution environments such as file systems, sandboxes and browsers; orchestration logic that hands work off to subagents; and hooks that run automatically according to set rules.

How it works

The simplest harness is a chat service. It wraps the model in a loop, keeps previous messages, and feeds them back in along with each new message. A harness for agents adds more functions on top of this. When the model says it wants to use a tool, the harness actually runs it and passes the result back to the model. Along the way, hooks handle tasks such as lint checks and context compaction according to set rules. An article published on Martin Fowler's site divides these mechanisms into two kinds: 'guides', which set direction before the agent acts, and 'sensors', which let it look at the results and correct itself.

The loop in which the harness wraps the modelUser request → Context assembly; Context assembly → Model (LLM); Model (LLM) → Tool execution(Tool call); Tool execution → Checks · hooks(Execution result); Checks · hooks → State · records(Record); State · records → Context assembly(Feed back in); Model (LLM) → Output(When done)User requestContext assemblySystem prompt · tooldescriptionsModel (LLM)OutputState · recordsPrevious messages ·progress notesTool executionFiles · code · browser(sandbox)Checks · hooksLinting, compaction,etc.Tool callExecution resultRecordFeed back inWhen done
The loop in which the harness wraps the model Only the 'model' in the middle is AI; every other box is work handled by the harness. Tool execution results are checked and recorded, then fed back into the model as input, and the loop continues.

Why it is getting attention

As models have improved, the environment a given model is placed in now makes a large difference to the results. OpenAI described an experiment in which a product was built using only Codex agents, with no code written directly by people. It said the engineers' main work in this experiment was designing the environment, stating intent clearly and building feedback loops. Anthropic addressed long tasks that do not fit in a single context window. It described building a harness with one agent that sets up the environment on the first run and another that makes incremental progress each time and leaves notes for the next session. The term 'harness engineering' has also started to be used for this kind of work.

Things to know

Harness is a very broad term, so where the line between the model and the harness is drawn varies somewhat from one article to another. Coding agents have a harness built into the product, and separately an outer harness that users add for their own projects (rule files, tests, checking tools and so on). Even a well-built harness does not eliminate model mistakes. Anthropic's article also noted that context compaction alone did not keep progress carrying over well on long tasks. That is why human review of the final result remains important.

Example

Coding agents are a typical example of harness use. Anthropic described the Claude Agent SDK as a general-purpose agent harness for coding and many other tasks. The SDK includes a compaction feature that shortens the conversation as it grows so the context window does not overflow. In OpenAI's experiment, a file called AGENTS.md was placed in the repository describing how the agent should work in that repository. Among the news covered on this site, Microsoft Research's 'Agent Lightning v1.0' is a framework that adds reinforcement learning to existing agents while leaving them unchanged. It is an example of the trend toward treating the harness and the model separately.

Where it came up on this site

Related terms

References