What is an agent harness?
An agent harness is the code around an AI model that runs the agent loop, routes tool calls, manages context, enforces permissions and keeps state, turning a model that predicts text into an agent that acts.
A model answers one request at a time. Everything that makes it behave like an agent lives outside it: the loop that sends the model's tool calls to real tools and feeds results back, the logic that decides what goes into the next prompt, the sandbox that limits what it can touch, and the store that lets a run resume after a crash.
That surrounding code is the harness. Two teams using the same model with different harnesses can get very different reliability, which is why the labs now ship their harnesses as products.
What a harness contains
The agent loop
Call the model, run any tool it asks for, return the result, and repeat until the model replies without a tool call.
Tools and routing
Tool definitions, argument validation, retries and error messages written to steer the agent back on course.
Context management
What goes into each call, what gets summarised or cleared, and what is loaded only when needed.
Permissions and sandbox
Which actions run freely, which need approval, and the file system and network limits around execution.
State and resume
A durable log of the run kept outside the context window, so work survives restarts and long pauses.
Verification
Tests, checks or a reviewer that the agent's output must pass before the run counts as done.
Harnesses as products
Anthropic's Managed Agents post (April 2026) separates the brain, meaning the model plus harness, from the hands, meaning sandboxes and tools, so a failed container becomes a retryable tool error and credentials stay out of reach of generated code. OpenAI describes the open-source Codex harness as a reusable runtime that other products can build on rather than writing agent infrastructure from scratch.
Frameworks have followed. Pydantic AI v2 ships a Harness, LangChain's Deep Agents calls itself an agent harness, and Vercel's AI SDK 7 added adapters for existing harnesses. The common thread across lab guidance is that a harness should shrink as models improve.
How Motiontic's engineers apply it
Motiontic's engineers usually start from an existing harness, such as the Claude Agent SDK, the OpenAI Agents SDK or Google ADK, and spend the effort on what is specific to the client: the tools, the permission tiers, the state store and the checks that define done.
Each harness decision is logged with the assumption behind it, so it can be tested with evals and removed when a newer model no longer needs it.
Agent harness compared with evaluation harness
| Agent harness | Evaluation harness | |
|---|---|---|
| Job | Lets the model act as an agent | Runs evals against the agent end to end |
| Runs in | Production and development | Development and CI |
| Contains | Loop, tools, context, permissions, state | Tasks, trials, graders and result storage |
| Output | Completed work | Scores and transcripts |
Common questions
What does harness mean in AI?
In AI, a harness is the code that wraps a model to make it useful for a job. An agent harness runs the model as an agent, with a loop, tools, context and state. An evaluation harness runs tests against a model or agent and records scores.
Is an agent harness the same as an agent framework?
They overlap. A framework is a library for building agents, and many now include a ready-made harness. The harness is the running system: the loop, tools, permissions and state for one specific agent.
Why does the harness matter as much as the model?
Because most agent failures happen around the model: a tool returns too much data, context fills up, a run crashes without saved state, or nothing checks the result. The harness is where those problems are prevented.
Should a team build its own harness?
Usually not from scratch. Lab SDKs and open-source harnesses cover the loop and sandboxing. The custom work is the tools, permissions, state and verification that fit the team's own systems.
Related
Harness engineering
Designing the environment an agent works in, so its output can be checked and shipped.
Eval
Repeatable, scored tests that tell a team whether an AI change made things better or worse.
Context engineering
Curating everything in the model's view, not just the wording of the prompt.
Single Agent vs Multi-Agent
One loop with good tools, compared with several agents splitting the work.
AI agent development
Agents that do real work for users, with the evals, traces and guardrails to keep them in production.
Deep Agents
LangChain's batteries-included, model-neutral harness for long-running agents.
Running agents that have to hold up?
Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.