The Harness pillar
Good tools fail in bad harnesses.
A harness is the runtime layer between a model and its tools. It selects the call, checks the arguments, enforces permission, handles failure, decides how much of the result belongs in context, and records what happened. This pillar collects the patterns for building that layer, each one tied to the official documentation or production writing behind it.
9 patterns · 3 new guides · 5 profiles with harness notes · sources checked 2026-10-08
The loop every agent run travels: the model proposes, the harness checks the proposal (arguments, permissions, budget), the tool acts, and the result comes back trimmed, logged, and grounded before it becomes context for the next step. Everything on this page hangs off that loop.
Between intent and execution
Six jobs, one layer
Different frameworks name the pieces differently: tool design, context engineering, workflow patterns, middleware. AgentsUse uses “harness” for the whole layer a builder owns between model intent and tool execution. That layer has six jobs.
Constrain
Check every call against the schema before anything executes.
Recover
Retry what heals, stop on what cannot, resume where it broke.
Budget
Cap, shape, and clear tool results before they crowd out the task.
Gate
Let safe calls run. Hold the irreversible ones for a decision.
Record
Log every call and ground every claim in a result that arrived.
Coordinate
Run independent calls in parallel and dependent calls in order, with gates.
Why the layer matters
What the harness buys you
The value of a harness is easier to judge by failure than by feature list. Each outcome below names the failure it prevents, the patterns that do the work, and the AgentsUse direction that follows from it. The claims are mechanisms, not benchmarks.
Performance
3patterns
Prevents: Wasted steps: malformed calls failing late, bloated results, dependent calls guessed in parallel.
Calls are checked before they run, results are sized for the context they re-enter, and independent work runs in parallel where the dependency graph allows it. Argument validation, Context budgeting, Sequencing.
RoadmapThe catalog compatibility record is the starting point: put a documented tool in front of the model before tuning the loop around it.
Security
3patterns
Prevents: An action nobody approved executes, and nobody can reconstruct it later.
Only allowlisted tools run. Destructive calls wait for an approval, edit, or reject decision, and each call leaves an audit record. Permission gating, Tool-call logs, Grounding.
RoadmapThe planned permission and audit middleware is the AgentsUse direction for carrying these patterns across runtimes.
Reliability
6patterns
Prevents: Runs stall on a hung call, loop on a flaky one, or repeat a side effect after a resume.
Retries are classified and capped, calls run against a timeout with cancellation, and re-runs are designed so a repeated call does not repeat the side effect. Bounded retries, Timeouts and cancellation, Idempotency.
RoadmapThe roadmap treats recovery as reference code, so teams do not have to rediscover the same failure handling in every stack.
Cost and observability
2patterns
Prevents: Token burn nobody can attribute, and agent behavior nobody can review.
Result budgets cap what re-enters context at each step, and structured logs make per-tool cost and failure rates visible without reading a transcript. Context budgeting, Tool-call logs.
RoadmapThe planned audit layer is meant to turn call logs into a cost and behavior record for each connected tool.
One call, start to finish
Anatomy of a tool call
A single pass through the loop shows why order matters. Validation and permission checks sit before execution because a call stopped there has not changed anything yet. Past execution, failure handling has to be explicit: retry inside a bound, then move to a fallback, a compensation step, or a person.
And every step leaves a record
{
"ts": "2026-10-08T14:03:11Z",
"run_id": "run_8f3",
"step": 7,
"tool": "web_search",
"gate": "auto-approved",
"args_hash": "b3:9f2c",
"duration_ms": 1840,
"outcome": "ok",
"result_tokens": 3120,
"attempt": 1
}Arguments are hashed, not stored. Outcome, duration, and result size are what the monthly review reads. The pattern: Tool-call logs and observability.
Start from the failure
The failure you keep hitting, and the pattern that ends it
Start from the symptom your runs produce, then read the pattern that addresses that failure mode.
Without harness work
With the harness patterns
Same model, same tools. The difference is whether each failure mode has an owner before the run starts. The table below maps the symptom to the pattern that handles it.
| Symptom in your runs | Pattern | Job |
|---|---|---|
| A transient failure ends the run, or a permanent failure gets retried until latency and cost spin out of control | Error recovery and bounded retries | Recover |
| Malformed arguments execute and fail downstream, or the model burns turns guessing the format you wanted | Argument validation before execution | Constrain |
| One oversized result evicts the instructions and constraints the model still needs | Context budgeting for tool results | Budget |
| The agent sends, deletes, or spends before anyone reviews the actual call | Permission gating and human approval | Gate |
| A retry or resume repeats a side effect: two charges, two emails, the same edit applied twice | Idempotency and safe re-runs | Recover |
| After a bad run, nobody can answer what the agent did, in what order, or why | Tool-call logs and observability | Record |
| One hung call stalls the entire run, and a cancelled tool keeps writing after the user said stop | Timeouts and cancellation | Recover |
| Dependent calls race in parallel, or independent calls run serially and the task takes far longer than it should | Sequencing dependent tool calls | Coordinate |
| The final answer asserts numbers and quotes that no tool returned | Grounding and citing tool results | Record |
The patterns library
Nine patterns, each sourced
Recover
Error recovery and bounded retries
A transient failure ends the run, or a permanent failure gets retried until latency and cost spin out of control.
Read the patternConstrain
Argument validation before execution
Malformed arguments execute and fail downstream, or the model burns turns guessing the format you wanted.
Read the patternBudget
Context budgeting for tool results
One oversized result evicts the instructions and constraints the model still needs.
Read the patternGate
Permission gating and human approval
The agent sends, deletes, or spends before anyone reviews the actual call.
Read the patternRecover
Idempotency and safe re-runs
A retry or resume repeats a side effect: two charges, two emails, the same edit applied twice.
Read the patternRecord
Tool-call logs and observability
After a bad run, nobody can answer what the agent did, in what order, or why.
Read the patternRecover
Timeouts and cancellation
One hung call stalls the entire run, and a cancelled tool keeps writing after the user said stop.
Read the patternCoordinate
Sequencing dependent tool calls
Dependent calls race in parallel, or independent calls run serially and the task takes far longer than it should.
Read the patternRecord
Grounding and citing tool results
The final answer asserts numbers and quotes that no tool returned.
Read the patternHow frameworks handle the same control problems. Twelve frameworks and agent runtimes compared on permissions, approvals, recovery, logs, and tool-result context, from their official documentation. Goose and Paperclip are included with their roles named: one is a local agent product, the other an orchestration control plane.
Compare frameworksLong-form
The harness guides
Three guides carry the pillar in long form: the engineering overview, a failure-diagnosis method, and the production checklist. They connect to the earlier guides on error recovery, tool permissions, and pre-flight checks.
Guide · 2026-10-08
Agent Harness Engineering: Where Tool Use Succeeds or Fails
The model gets the credit and the blame. The harness decides what actually happens: which call runs, with what arguments, under whose permission, and what occurs when it fails. This guide defines the layer, its six jobs, and the build order, drawn from published production practice.
Read the guideGuide · 2026-10-08
Diagnosing Tool-Call Failures: Read the Run, Fix the Layer
An agent run failed and the transcript will not say why. A field method for separating six failure layers (arguments, tool, transport, context, permission, sequencing) from per-call records, with the fix that belongs to each one.
Read the guideGuide · 2026-10-08
The Production Harness Checklist: 24 Checks Before an Agent Touches Real Work
Twenty-four pass-or-fail checks across the call, the gate, the run, and go-live. Each check requires evidence, not testimony, and traces to Anthropic engineering posts, the MCP specification, or LangGraph and OpenAI documentation. Widen scope only where every check holds.
Read the guideInside the catalog
Harness notes, where the vendor docs support them
Five catalog profiles carry harness notes: repeat behavior, result volume, scope rules, and polling behavior, each taken from the vendor's documentation and dated. A profile gets a note only when the documentation states the behavior clearly enough to design against.
Tool profile
Harness notes: result volume is the budget lever
max_results accepts 1 to 20. Tavily agent guidance sets 5 as the starting point. Every result re-enters the context on each following step, so a high ceiling taxes the whole run, not just one call.
Open the profileTool profile
Harness notes: poll crawls to a terminal status
Crawl responses page results at 10 MB per response and hand back a next URL. The next URL also appears while pages are still processing, so job status (completed, failed, cancelled) is the end signal, never the absence of a next link.
Open the profileMCP profile
Harness notes: scope the server before the model runs
The --read-only flag (or GITHUB_READ_ONLY=1) restricts the server to read tools, and read-only wins over --tools selections. A wrapper cannot widen what the flag closed. Permission gating sits in the server, not the prompt.
Open the profileMCP profile
Harness notes: snapshots are the context cost
The server works from structured accessibility snapshots rather than screenshots. Each observation stays text-shaped and referenceable (click by ref) instead of image-priced.
Open the profileMCP profile
Harness notes: scope is dynamic, repeat behavior is per tool
Allowed directories come from launch arguments or from client Roots. Roots replace the configured list entirely when present, and they can change while the server runs. Scope checks belong in the harness on every call, rather than only at connect time. With no allowed directory from either source, the server fails at startup.
Open the profileNotes follow the documentation
A note appears only when a vendor document states the behavior. Browse the tools catalog and the MCP index for the setup, pricing, and limits behind each profile.
Questions
What is an agent harness?
The code and policy around a model that turns intent into tool calls. It selects the tool, checks the arguments, enforces permissions, handles errors and timeouts, decides how much of each result stays in context, and logs what happened. The model proposes a call; the harness decides whether and how it runs.
Are a harness and a framework the same thing?
They overlap. A framework (LangGraph, CrewAI, the OpenAI Agents SDK) ships harness machinery such as retry policies, approval interrupts, and checkpointing. Your harness is the set of choices you make with that machinery: which tools run ungated, what the retry bound is, what gets logged. Two teams on the same framework run different harnesses.
Do I need all nine patterns?
No. Argument validation and a per-call timeout pay for themselves on day one. Add approval gates before the agent touches anything irreversible, logs before it runs unattended, and the rest as the failures show up. The checklist guide orders all nine by what breaks first.
Where does the catalog fit in?
The harness assumes tools worth calling. Catalog profiles record setup paths, auth, pricing, and limits for the tools and MCP servers a harness drives. Five profiles also carry harness notes: vendor-documented facts about repeat behavior, result volume, and scope that a harness design needs.