Agent harness
An agent harness is the software wrapped around an AI model that turns it into an agent: it runs the loop of model calls and tool use and manages the prompts, tools, context, permissions and memory.
A language model on its own takes text in and gives text back. It cannot run a command, open a file or remember what it did yesterday. The harness is everything around the model that makes those things possible. It sends the model its instructions and the list of tools, carries out the tool calls the model asks for, feeds the results back, decides when to stop, and keeps the growing conversation inside the model's context window. A March 2026 LangChain post summed it up as Agent = Model + Harness.
That post lists what a harness typically contains: system prompts; tools, skills and MCP connections with their descriptions; infrastructure such as a filesystem, a sandbox or a browser; orchestration logic for spawning subagents or routing between models; and hooks for fixed steps such as compacting old context or running a lint check. Anthropic describes its Claude Agent SDK, which runs the same loop as Claude Code, as a general-purpose agent harness that handles tool use, planning and context management.
Anthropic's November 2025 engineering post on long-running coding agents shows harness design in practice. Each new session starts with an empty context, so the agent forgets earlier work. Left alone, agents tried to build everything at once and ran out of room halfway, or a later session saw progress and declared the project finished. The fix was in the harness: a first session sets up a start-up script, a progress log, a feature list in JSON and a first git commit, and every later session reads those, works on one feature, commits it and updates the log.
The practical point is that the same model can perform quite differently depending on the code around it. LangChain argues that harness changes alone can move an agent up a benchmark table, and that products such as Claude Code and Codex are trained with their own harness in the loop. When a company announces a score for an agent, the result belongs to the model and the harness together, and a fair comparison names both.
It is the code and configuration around a language model that let it act as an agent. The harness supplies the instructions and tools, executes the tool calls the model requests, returns the results, manages the context window and enforces limits such as permissions and budgets. Not quite. A framework or SDK is a toolkit for building agents, while a harness is the running system that wraps a particular model. Some SDKs ship a ready-made harness: Anthropic's Agent SDK, for example, runs the same execution loop that powers Claude Code. The model only sees what the harness shows it and can only do what the harness lets it do. How tools are described, how old context is summarised, and whether progress is written down between sessions all change the results. Anthropic's work on long-running coding agents improved them mainly by changing the harness, not the model.Common questions
What is an agent harness in AI?
Is an agent harness the same as an agent framework?
Why does the harness affect how well an agent performs?
Search for "agent harness", "harness engineering" or the name of a specific agent SDK to see how developers build the layer around a model. The most reliable sources are engineering posts and documentation from model makers and framework builders, which describe their own systems in detail. Treat benchmark comparisons between agents with care unless they state which model and which harness were used.Finding more
Working out what this means for your business?
Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.