Skip to main content

Agent harness

AI concepts

The scaffolding that turns a model into an agent—system prompt, the tool-calling loop, context management, retries, and orchestration. Platform UIs ship a strong one; the raw API gives you a single turn and expects you to build your own.

An agent harness is everything wrapped around the model that makes it behave like an agent. The model itself only maps tokens to tokens; the harness is what lets it observe, call a tool, read the result, and try again. It typically bundles a tuned system prompt, the ReAct-style tool-calling loop, context window management, retries and error handling, and tool routing—often over MCP.

Why it matters for engineers

This is the most common reason a demo lies. When you build an agent inside the Claude or ChatGPT UI and attach data over MCP, you are borrowing a battle-hardened harness for free, and the results feel effortless. Rebuild the same idea against the raw /v1/messages API and you get a single turn of inference: the same tools, none of the scaffolding. The harness—not just the model—was doing the work, so the productionized version underperforms until you rebuild that runtime yourself.

Claude Code is a concrete example: it is an agent harness, not a model tier—the same model becomes far more capable once wrapped in a loop that edits files, runs tools, and iterates.