What is an agent harness?
An agent harness is the system around a model that enables it to act as an agent. That is the definition in Google Research's Harness² README, which lists "prompts, tools, memory, skills, orchestration, and more." The model reasons; the harness decides what it sees, what it is allowed to do, and how its work gets checked.
You already use harnesses. Anthropic describes its Agent SDK as "the agent harness that powers Claude Code," built around a simple loop: "gather context → take action → verify work → repeat". Codex, OpenCode, Cursor's agent mode, and self-hosted agents like Hermes Agent are all harnesses wrapped around someone's model.
Why the term caught on in 2026: as models got good enough to run for hours, the gap between a strong and a weak agent stopped being mostly the model. Two agents on the same model can differ widely depending on what instructions they read, what tools they get, how they recover after their context window fills, and whether anything checks their work. That surrounding system is the harness, and it is the part you control.
What goes into an agent harness? The eight parts
Harness² treats eight components as editable. It is a useful checklist for any harness, whether you build it by hand or buy it:
| Component | What it does | Go deeper |
|---|---|---|
| System prompt | Role, rules, and the definition of done the model reads on every turn | — |
| Tool guidance | Which tools exist, when to use each, and how to read their output | What is MCP? |
| Guardrails | Checks on inputs, tool calls, and outputs that the model can't talk its way past | AI guardrails explained |
| Memory | What carries over between steps and sessions: progress notes, facts, user preferences | AI agent memory |
| Subagents | Specialist agents the main agent delegates to, each with its own context | Multi-agent orchestration patterns |
| Skills | Reusable, loadable instructions for a recurring kind of task | How agent skills work (Hermes) |
| Scripts | Deterministic code the agent can run instead of reasoning step by step: setup, tests, checks | — |
| Plugins | Packaged extensions that add tools, commands, or hooks to the agent | — |
Add the control loop that ties them together (plan, act, observe, repeat) and the context management that decides what fits in the window each turn. Our agentic AI guide covers the loop from the model's side.
Agent harness vs agent runtime vs framework vs eval harness
"Harness" is overloaded, and that causes most of the confusion. Five things get called by similar names; each answers a different question:
| Term | What it is | Examples | Question it answers |
|---|---|---|---|
| Agent harness | Everything around the model that lets it act: prompts, tools, guardrails, memory, skills, orchestration | Claude Code, Codex, OpenCode, Hermes Agent | Does the agent do the task well? |
| Agent runtime | The production layer that keeps a harness running reliably | Durable execution, sandboxes, retries, tracing, approval gates | Does the agent keep working at scale, safely? |
| Agent framework | A library you use to build your own harness | LangGraph, CrewAI, OpenAI Agents SDK, Google ADK, Claude Agent SDK | How do I build my own agent? |
| Eval harness | A test rig that runs a model or agent against a benchmark and scores it | lm-evaluation-harness, Inspect | How good is it, measurably? |
| Harness optimizer | A system that improves a harness automatically | Google Harness², Meta-Harness | Can the harness improve itself? |
The distinction that matters most in practice is harness vs runtime. The harness determines how good the agent is at the task. The agent runtime determines whether it keeps working in production: it persists state so a crash doesn't lose an hour of work, sandboxes tools, retries failures, traces every step, and pauses for human approval. A clever harness on no runtime is a demo; a solid runtime with a weak harness is a reliable way to do the wrong thing. Frameworks such as LangGraph, CrewAI, or the Claude Agent SDK sit between the two: they are what you use to build your own harness, compared in our open-source agent frameworks guide.
What is harness engineering?
Harness engineering is designing the harness so the agent does reliable work without a person steering every step. OpenAI popularised the term in February 2026 with Harness engineering: leveraging Codex in an agent-first world, about a team that shipped an internal product whose code was written by Codex, summed up as "Humans steer. Agents execute." The work shifts from writing code to writing the environment the agent writes code in.
Anthropic's Effective harnesses for long-running agents (November 2025) is the most concrete public recipe. It found agents tried to build everything at once, declared victory early, marked features done without testing them end to end, and lost track of state when a new context window started. The fix was a harness, not a better model: an initializer agent sets up a feature list (200+ features marked passing or failing), a progress file, an init.sh script, and a git history; every later session reads them first, works on one feature, tests it, and leaves a clean commit. In Anthropic's words, "the key insight here was finding a way for agents to quickly understand the state of work when starting with a fresh context window."
The practices that keep showing up:
- • Write instructions for the agent, not for humans. An
AGENTS.mdorCLAUDE.mdwith how to build, test, and what "done" means. - • Turn rules into checks the agent can run. Linters, type checks, and tests give feedback the model can't argue with.
- • Make state survive the context window. A progress log, a task list, and small commits are the agent's only memory between sessions; see AI agent memory.
- • One unit of work per session. Incremental beats ambitious for long-running agents.
- • Guard the actions, not just the text. Put checks on tool calls; see AI guardrails.
- • Add a reviewer. A second agent or a human pass that checks work against the spec before it counts.
Get the weekly AI engineering brief
Agent harnesses, runtimes, memory, and the tools worth using: one practical email a week. Plus the free roadmap PDF.
By subscribing you agree to receive emails from AI Engineer Insights. Unsubscribe anytime. See our Privacy Policy.
What is Google Harness², and how does it optimize a harness?
Harness² (pronounced "harness squared") is a research framework from Google, released in October 2026 with the paper Harness²: Recursive Agent Harnessing for an Open World. Its starting point is the paper's first line: "LLM agents' capabilities depend not only on their underlying models but also on their execution harnesses." Instead of a person doing harness engineering, Harness² does it automatically, and it keeps the model's weights frozen.
It works at two levels, which is where the "²" comes from:
- • Task level: Propose → Probe → Compose. For a new task it proposes edits to the harness, probes them by running the agent on that same task, and composes a refined harness from the differences in behaviour between runs, without needing ground-truth answers.
- • Harnessing level: learning to improve. It keeps a persistent "improvement harness" of adopted harnesses and evidence-backed lessons, so each task makes the next refinement better.
It can probe several candidate harnesses in parallel or refine one sequentially. Tasks run on an existing coding agent (OpenCode by default, or Codex), and a separate model does the improving; the setup docs allow Claude or Gemini on Vertex for that role. On three professional benchmarks the paper reports gains of up to 11.5 points on WorkBuddy-Bench, 4.5 on JobBench, and 11.8 percentage points on the legal benchmark LAB.
Read the results with three caveats:
- • It costs more runs. Every round of probing means extra agent rollouts on the same task. Wavect's review argues the cost per accepted result can end up worse than the baseline, and that the largest gain was on one executor model.
- • It is not a production system. The README states "This is not an officially supported Google product," and notes executor network access is unrestricted and Codex runs with its sandbox disabled.
- • It optimizes against the task in front of it. With no ground truth, "better" means better behaviour as judged by the system; Wavect also reports an agent fetching its own grading rubric during a run. Watch for that kind of reward hacking if you try it.
Harness² vs Claude Code vs Hermes Agent vs OpenClaw: who is it for?
Harness² is not something you run as an assistant. It sits one level up: it tunes harnesses like the ones below.
| Tool | What it is | Who it's for | Used for | License |
|---|---|---|---|---|
| Google Harness² | Research optimizer for agent harnesses | Researchers and AI engineers | Automatically improving the prompts, skills, memory, and guardrails around a frozen model | Apache-2.0 |
| Claude Code | Coding agent (a ready-made harness) | Developers | Doing software tasks in your repo | Commercial |
| Hermes Agent | Self-hosted personal agent | Individuals | Everyday assistant that turns solved tasks into skills | MIT |
| OpenClaw | Self-hosted assistant gateway | Individuals | Assistant across 20+ messaging channels | MIT |
There is a family resemblance with Hermes Agent, which also improves itself by turning solved tasks into reusable skills. The difference is where it happens: Hermes learns while it works for you, one user at a time; Harness² is an offline optimizer that runs batches of tasks and keeps whichever harness changes the evidence supports. For a personal agent, see Hermes Agent vs OpenClaw.
When should you invest in your harness?
- • Your agent fails in the same ways repeatedly. Stopping early, skipping tests, losing track after a long session: these are harness problems, and a bigger model rarely fixes them.
- • You are about to pay for a larger model. Try a better harness first; it is cheaper per task and the gains carry over when you do upgrade.
- • You run the same kind of task many times. That is when harness engineering pays back, and when automatic optimizers like Harness² start to make sense.
- • You are moving to production. Then the next investment is the runtime underneath, not more harness.
A good order of work: write the instructions and a definition of done, give the agent tests it can run, add a progress log and small commits, put guardrails on risky tool calls, then measure. Only after that is it worth reaching for an optimizer.
Go deeper on agent harnesses with AI
Ask your next question with this article as context. Opens in a new tab; you can edit the question before sending.
Frequently Asked Questions
What is an agent harness?
An agent harness is everything around a language model that lets it act as an agent: the system prompt, the tools and the guidance on using them, guardrails, memory, skills, subagents, scripts, plugins, and the loop that runs them. Google's Harness² README defines it as the system around a model that enables it to act as an agent. The model supplies the reasoning; the harness decides what it sees, what it can do, and how its work is checked. Claude Code, Codex, OpenCode, and Hermes Agent are all harnesses.
What is harness engineering?
Harness engineering is the work of designing that system so an agent does reliable work: writing the instructions and docs it reads, encoding rules as linters and tests it can run, giving it ways to record and recover progress, and adding review loops. OpenAI used the term in February 2026 for how a team shipped a product whose code was written by Codex, and Anthropic's guidance on long-running agents describes the same practice: a feature list, a progress file, an init script, and clean git commits so each new session knows where things stand.
What is the difference between an agent harness and an agent runtime?
The harness decides how well the agent does a task: prompts, tools, memory, skills, guardrails. The runtime decides whether the agent keeps running safely in production: durable state, sandboxed tool execution, retries, tracing, and human approval gates. You can swap a better harness onto the same runtime, or run the same harness on a sturdier runtime. Google's Harness² is a harness optimizer, not a runtime; its README notes it runs executors with unrestricted network access and, for Codex, with the sandbox disabled.
What is Google Harness²?
Harness² (google-research/harness2, Apache-2.0, released October 2026 with the paper Harness²: Recursive Agent Harnessing for an Open World) is a research framework that improves an agent's harness automatically while keeping the model weights frozen. For each task it proposes harness edits, probes them on that task, and composes a refined harness from the differences in behaviour, without ground-truth feedback. It also keeps a persistent store of adopted harnesses and lessons that guides later tasks. The paper reports gains of up to 11.5 points on WorkBuddy-Bench and 11.8 percentage points on LAB.
Is Harness² for personal use or enterprise?
Neither. It is research code for AI engineers and researchers: the README says it is not an officially supported Google product, it runs agents through OpenCode or Codex from the command line on Linux, and it is built for benchmark runs, not for chatting with. For a personal agent, use something like Hermes Agent or OpenClaw; for production, put your harness on a proper agent runtime.
Do I need a harness optimizer like Harness²?
Probably not yet. Most teams get more from hand-built harness engineering first: clear instructions, runnable tests, a progress log, and guardrails on tool calls. A harness optimizer becomes worth trying when you already run an agent on many similar tasks, have a way to compare runs, and can afford the extra rollouts each round of optimization costs.
References
- • Google Research — Harness² (GitHub README)
- • Xu et al. 2026 — Harness²: Recursive Agent Harnessing for an Open World (arXiv:2610.14224)
- • Harness² setup docs (executors and improver models)
- • Harness² project site
- • Anthropic — Effective harnesses for long-running agents (Nov 2025)
- • Anthropic — Building agents with the Claude Agent SDK (Sep 2025)
- • OpenAI — Harness engineering: leveraging Codex in an agent-first world (Feb 2026)
- • Wavect — Google Harness²: setup, cost, and safety review