Agent harness
An agent harness is the software around a model that turns it into a working agent: the loop, tools, system prompt, permissions, context management and any files used to carry progress between sessions.
Also called: harness engineering
By Divya Sharma · Checked Nov 15, 2026 · How we review
The same model can do well or badly depending on what it runs inside. The harness decides which tools the model sees, how results are fed back, when the conversation is trimmed and what the model is allowed to do without asking. Anthropic calls the Claude Agent SDK a general-purpose agent harness.
What a harness handles
- Running the agent loop and stopping it. - Defining tools and passing results back. - Managing the context window, for example with context compaction. - Permissions, approval prompts and an agent sandbox. - State that outlives one session, such as a progress file or a git history.
Example
In its work on long-running coding agents, Anthropic found that each new session starts with no memory of the last one. Its harness had the agent read a progress file and the git log at the start of each session, and finish by committing work and updating that file. The model and tools stayed the same; the harness changed the results.
Harness engineering
Harness engineering is the practice of tuning this layer: prompts, tool design, context strategy and checks. It matters most for long tasks, where small choices add up. The harness engineering guide covers it in more depth.
Related terms
- Coding agent
- A coding agent is an AI agent that works on software directly: it reads a codebase, edits files, runs commands and tests, and repeats until a change works, rather than only suggesting code for a person to paste.
- Agent loop
- An agent loop is the repeating cycle at the heart of an AI agent: the model asks for a tool call, the application runs it and returns the result, and the model decides what to do next.
- Agent sandbox
- An agent sandbox is an isolated environment, such as a container, virtual machine or operating-system restriction, in which an AI agent runs code and commands so it cannot reach files, networks or data outside set limits.
- Context engineering
- Context engineering is the practice of choosing and maintaining everything that goes into a language model's context window during a task: instructions, retrieved documents, tool definitions, tool results and conversation history.
- Context compaction
- Context compaction is the step where an agent summarises a conversation that is nearing its context window limit and continues in a fresh window that starts from that summary, so a long task can keep going.