Digital sozialisiert, Denker, Macher und Angel Investor.

What is an agent harness, and why is it important?

W

We talk about AI models and how well they perform on cognitive tasks. Do we talk about Claude, or about Sonnet, Opus or Fable? And who really does the heavy lifting on agentic tasks?

This post talks about the agent harness, its impact on task performance and “prompt wrapping” that turned into harness engineering. The model is the engine and the harness is the car built around it. What do you drive?

What is a harness?

Let’s use the picture of the brain (model) and its surrounding body (harness). The model is only a statistical representation of human knowledge at a given moment in time. Therefore, if I were to query the model about today’s weather in Zurich, it would be unable to answer because the information originated after its training. Or, as is often stated: after the cut-off date.

But the model “knows” from its training process what to do: Query MeteoSwiss (the Federal Office for Meteorology and Climatology). The brain tells the body to grab an internet-connected device and request updated data by typing…

In the following text, I draw on the illustration from datacamp.

Source: www.datacamp.com/blog/agent-harness

An agent harness is the software infrastructure surrounding an LLM (large language model). It executes a “the agent loop”, perceived as reasoning.

Tools

An essential aspect of the harness are tools, or more precisely, its ability to use external services. The model selects the right tool(s) and the harness coordinates times, order and proper error handling.

In the example of Zurich weather, such a tool could be a headless browser, that allows the harness to call the website of MeteoSwiss and pass the response back to the model. Tools let AI agents interact with the world.

The range of tools is very wide, varies from harness to harness and also depends on the access rights granted. Typical representatives of tools are shell access (execute any command of the operating system), web search or connectors to systems like Microsoft 365, Google Workspace, Slack, Hubspot, Salesforce, etc. Mostly via MCP (Model Context Protocol).

Memory

Agents need to know what happened earlier in a task, and they improve at repeating tasks by memorizing over time. To facilitate this process, a harness organizes short-term and long-term states in files, logs, summaries or saved preferences. Much like a project manager reminding a team what the next steps are after each meeting.

In order to manage memory in relation to importance/usage, and to technical limitations such as context length, the harness also compacts long state into shorter summaries and handles temporal aspects including forgetting/deletion.

Execution environment

Often, the most efficient way to complete a task is to have the LLM write a piece of code. Harnesses enable this code to be executed locally, allowing it to be easily embedded into the workflow. The execution environment could be a filesystem, a container, a sandboxed terminal, a browser instance, or a cloud runtime. The latter easily allows scaling the execution and the remote control of agent workflows.

Mostly, harnesses use isolated sandbox containers as execution environments to create short-lived environments that are cleaned up after a single session or when the task ends.

Guardrails and observability

Observability records model calls, tool calls, handoffs, errors, latency and other metrics in order to improve workflows, enable auditing and control resource usage.

Guardrails finally define what the harness is allowed to do. They enforce human approval, block risky tool calls, apply role-based permissions and check outputs.

Harness engineering and recursive improvement

Harness engineering holds this all together. It is the task of designing and building the programmatic systems that operate what we call “the harness”. It’s building and maintaining systems like Claude Code, OpenCode or Pi.

The functionality needed is very broad and exceeds this post by far. Think about coordinating hundreds of agents and sub-agents while managing overall context integrity and preventing mutual blocking.

To make this even more challenging, go read about Harness² by Google. It’s a framework for recursive agent harnessing, where agents encounter tasks unseen during harness design and rewrite its prompts, memory, tools, skills, scripts, subagents, plugins, and guardrails.

Source: github.com/google-research/harness2

Why should I care?

I’ll keep it brief. A recent paper examining Terminal-Bench results showed that selection of the harness can move success rates by 20+ points. Using the same model (Opus 4.6) they pushed benchmark scores from 58.0% to 79.8% only by changing the harness.

And my answer to the questions above: In my case it’s Claude Code and I don’t have a car ;).

Von Jürg Stuker
Digital sozialisiert, Denker, Macher und Angel Investor.