Topic: agentic-harnesses

An agent harness is the program wrapped around a language model that turns it into an agent: the loop, the tools, the context it sees, the permissions and sandbox that limit it, and the interface you work in. This root is the map: the parts of a harness, how the products differ on each, and which child page owns each part; three labs span the children. Reading: 24 min, plus 3 in closed details. Data as of October 2026.

The topic in one screen

The core idea. An agent is a language model called in a loop; the harness is everything except the model, and it decides what the model sees and what it is allowed to do. Anthropic's own definition: Claude Code "is the layer around the model that provides the tools and manages the context the model sees. This surrounding layer is what the term agentic harness refers to" (How Claude Code works, read 5 Oct 2026).

Fig. 1: one turn of an agent. The model makes one decision; the harness does the other six steps

  1. Assemble the request. The harness stacks the system prompt, the tool definitions, the memory files and the history into one request. Section 3; Context engineering.
  2. Call the model. The only step the model takes: it reads the whole request and picks the next action. Section 1.
  3. Stop at the action. The turn ends at the tool call, and the harness parses its name and JSON arguments. Section 1; Building a harness sections 1 and 2.
  4. Check permission. Rules allow, ask a person, or deny; an unknown tool fails closed. Section 5; Agent security section 4.
  5. Run the tool. Inside a sandbox, with a timeout. Section 5; Agent security section 6.
  6. Return the result. The output, errors included and clipped with a note, joins the history for the next call. Section 2; Building a harness sections 5 and 7.
  7. Stop or go again. A reply with no tool call, a turn or budget limit, or a hook ends the run; otherwise the loop repeats from step 1 with one more reply and result in the history. Section 4; Building a harness section 10.
Wrapped as products (section 6): Claude Code, taken apart, Other coding harnesses, Personal agents, and 23 products side by side in the Harness atlas.
Used as a ruler and a gym (section 7): the same loop scores models on benchmarks and generates their training data, on Harnesses for training and evaluation.

The running example. A tiny Python library, textstats, with two planted bugs: the word splitter drops apostrophes (so word_count("don't stop") returns 3, not 2), and top_words breaks ties in no particular order instead of alphabetically. One test file, run with plain python3 tests/test_core.py, catches both. Every run on this page gets the same prompt: "The tests in this repository fail. Find out why and fix the code so they pass. Do not edit the tests." The same model, Claude Haiku 4.5, given the source file in a single call fixed one bug and left a test failing; inside Claude Code's loop it ran the tests, saw both failures and fixed both MEASURED (section 1).

Every measured number comes from runs recorded on 5 October 2026 with the Claude Code CLI 2.1.289 on a Claude subscription (no API key), kept redacted in this page's source; dollar figures are the API-price equivalent the CLI reports, not money paid. MEASURED marks those numbers, SOURCE marks published ones. How libraries and frameworks package these pieces (LangGraph, Pydantic AI, the Claude Agent SDK and others) is the sibling root, Topic: agentic-frameworks.

New terms, each defined where it is first used:

Harness (benchmark papers say scaffold): the program around the model.
Tool call: a structured request for an action, with a name and JSON arguments.
Action boundary: the point where the model's turn must end, right after its action.
Context window: everything the model reads on one call.
Prompt cache: a provider's stored copy of a repeated request prefix, read at a tenth of the input price.
Compaction: replacing the conversation with a model-written summary when the window fills.
Permission gate: rules that allow, deny or ask before each tool call.
Sandbox: an operating-system boundary around what does run.
Lethal trifecta: private data, untrusted content and a way out, all in one agent.
Trajectory: the full record of a run; with a verifier (the tests) it becomes a reward.

The parts of a harness, and where harnesses differ on each

PartThe decisionWhere the harnesses differOwner page
Action format (1)How the model asks for an action, and who ends its turn thereNative tool calls (Claude Code, Codex, Gemini CLI, opencode) or a text protocol the harness parses (Aider, mini-SWE-agent's text mode)Building a harness 1, 2; Other coding harnesses 1
Tools and edits (2)Which tools; how a change to a file is writtenExact-string replace (Claude Code), patches (Codex), search-and-replace blocks (Aider), bash only (mini-SWE-agent)Building a harness 5, 6; Other coding harnesses 3
Context (3)What goes into each request, and what leaves when the window fillsFixed prefix size, memory files (CLAUDE.md, AGENTS.md, GEMINI.md), compaction thresholds, Aider's repository mapContext engineering; Other coding harnesses 5
Control (4)When the loop stops; planning; delegatingTurn, token and time caps, loop guards, hooks, plan mode, subagentsBuilding a harness 8, 10; Claude Code 4, 7, 8
Safety (5)What a tool call may touchAsk before acting, an OS sandbox on by default, or a disposable machine per taskAgent security; Guardrails (classifiers on requests and replies); Other coding harnesses 4
Where it runs (6)Where you watch, steer and review the workTerminal, editor, cloud machine that returns a pull request, resident daemon on your messaging appsOther coding harnesses 7; Personal agents
Measurement and training (7)What a score or a rollout is a property ofThe same weights score and cost differently in each harness, before and after trainingHarnesses for training and evaluation; Building a harness 12

Numbers in brackets are this page's sections; numbers after a page name are that page's sections. Building a harness from scratch, decision by decision with a default for each, is Building a harness; this page's Loop lab builds one in seven recorded steps.

Same task, same model: one call fixed one bug, the loop fixed both

Real recordings, Claude Haiku 4.5 (claude-haiku-4-5-20251001) both times. Loop: Claude Code 2.1.289, claude -p, tools Read, Edit, Write, Bash, Grep, Glob, permission mode acceptEdits (trace std_haiku_1). One call: the Loop lab's step 0 (s0_haiku). The window bar shows each call's input: the part read from the prompt cache, the part newly written to it, and fresh input. Tool results are cut to a few lines here; the full trace is in the Trace and context lab.

1. The loop: a model call, a tool call, repeat

A model call. A language model is a function from text to text. The text goes in as tokens (word pieces, about four characters of English each), and the model generates new tokens one at a time until it decides to stop. It keeps no memory between calls: to "continue a conversation", the caller sends the whole conversation again every time. The maximum it can read in one call is its context window (200,000 tokens for Claude Haiku 4.5, as the CLI's own result record reports MEASURED).

A tool call. A tool is a function the harness offers the model, described by a name, a sentence of description and a JSON schema for its arguments, for example Bash {command} or Read {file_path}. Instead of answering in prose, the model can reply with a structured tool call: on the Anthropic API a tool_use block with stop_reason: "tool_use"; on OpenAI's, a function_call item. The harness runs the function and sends the output back as a tool result in the next request. Put the call in a loop and you have an agent:

messages = [system prompt, task]
while True:
  reply = model(messages, tools)
  if reply has no tool call: break   # the model says it is done
  result = run(reply.tool_call)   # after a permission check
  messages += [reply, result]

That is the whole core; what makes a harness good is everything around those six lines. The one rule the loop cannot do without is the action boundary: the model's turn must end at its action, or the model writes the tool's result itself, as Haiku did in the Loop lab when nothing stopped it. A provider's tool-calling API enforces the boundary; a text protocol must enforce it with a stop sequence (Building a harness section 2).

The replay (right). Predict before it plays: which of the two bugs can a model fix without ever running the tests? The buttons switch between the loop and one call; the step list follows the run.

Claude Code's loop, 12 model calls in seven stretches

  1. Enter. The harness sends the system prompt, six tool definitions and the task. The window already holds 13,242 tokens on the first call, before the model has read a single file: the fixed cost of this harness (section 3).
  2. Calls 1 to 6: looking around. find, ls, the test file, the package, __init__.py, core.py. Reading a file puts its whole text into the history: by call 6 the request is 14,775 tokens.
  3. Call 7: an error, returned as is. python tests/test_core.py gets command not found: python back as an ordinary error result, and the model reads it like any other result.
  4. Call 8: the tests run. python3 shows both failures, 2 failed: the information the single call never had.
  5. Calls 9 and 10: two exact-string edits to the library: one keeps apostrophes inside words, one breaks ties alphabetically.
  6. Call 11: the tests again. 0 failed.
  7. Call 12: done. No tool call: the model answers in text, so the loop ends. Twelve model calls, 31 seconds, about $0.039 at list prices; both bugs fixed, verified by the tests MEASURED.

Nothing was wrong with the model: it was missing information that only running the code could give it. The loop spent six calls finding its way around, recovered from one error and fixed both bugs in two edits.

Where the loop and tool calling came from
ReAct (Yao et al., October 2022) interleaved free-text thoughts with actions and observations in one prompted loop, and beat reasoning-only and acting-only baselines; every modern agent loop descends from it (ReAct paper page). Toolformer (Schick et al., February 2023) showed a model teaching itself API calls from a few demonstrations, and OpenAI announced on 13 June 2023 (archived post) that its 0613 models "have been fine-tuned" to detect when a function should be called and to answer with JSON matching its signature SOURCE. Models call tools reliably because they are trained to. Both request shapes, Anthropic Messages and OpenAI Responses, are laid side by side in the Loop lab's API section.
Go deeper: the Loop lab builds this loop from zero in seven recorded steps (its final step is 240 lines of Python, 190 of them code MEASURED); Building a harness goes one layer down: a tool call on the wire token by token, the action boundary measured, parallel calls, streaming and interrupts (its sections 1 to 4).

2. Tools: the agent's only hands and eyes

The model can only act through the tools it is given, and it only learns about the world through what those tools return. A coding harness therefore needs, at minimum, a way to look (read, list, search), a way to change things (edit or write a file) and a way to check (run a command, above all the tests); Claude Code's docs group its built-in tools into file operations, search, execution, web and code intelligence, plus tools for subagents and questions to the user (docs); our recorded runs passed six: Read, Edit, Write, Bash, Grep, Glob. The SWE-agent paper (Yang et al., May 2024) named the tool set the agent-computer interface (ACI): the same model scored differently depending on how its file viewer, search and edit commands were shaped, and with an interface designed for it reached 12.5% on SWE-bench, then the state of the art (arXiv 2405.15793) SOURCE.

Where harnesses differ. At one end, mini-SWE-agent's only tool is bash, it does not use the model's tool-calling interface at all, and its README reports more than 74% on SWE-bench Verified with a strong model behind it (README, read 5 Oct 2026) SOURCE. At the other, Claude Code ships dozens of dedicated tools. With a strong model a shell is a universal tool; dedicated tools earn their place by being cheaper, safer to gate, or easier to verify. And every definition is input the model reads on every call: Claude Code's first call on Haiku 4.5 measured 6,653 tokens with no tools, 13,219 with the six above and 21,140 with its default set MEASURED (the Trace and context lab, Context lab 1). Tools from outside the harness arrive through MCP, the protocol by which a harness discovers and calls external tool servers (MCP page); Claude Code defers their definitions behind a tool search (Claude Code section 10).

Go deeper: Building a harness owns tool and error design (section 5), edit formats measured with eight appliers (section 6 and its Edit format bench tab) and error recovery (section 7); Claude Code, taken apart records what every built-in tool returns and where it stops (section 2); Other coding harnesses compares six harnesses' action formats and edit matchers (sections 1 and 3); the Harness atlas shows one fix in six edit formats.

3. Context: what the model sees on each call

The model knows only what is in the request. Each call, the harness assembles it from four kinds of material, in this order: the system prompt, the tool definitions, memory files loaded at start (Claude Code reads CLAUDE.md, and also AGENTS.md, the cross-vendor convention other harnesses use), and the history: the task, every earlier reply, every tool call and every tool result. The first three are a fixed prefix; the history grows by one reply and one result per turn. Fig. 2 measures each piece on the running example.

Fig. 2, step by step (Claude Haiku 4.5 in Claude Code)

  1. System prompt and environment: 6,653 tokens, measured by a one-call run with no tools at all (Trace and context lab, Context lab 1): the harness before it can act.
  2. Six tool definitions: +6,566. Names, descriptions and JSON schemas, read on every call: 13,219 tokens with the six tools of the task runs, 21,140 with every default tool (the outline).
  3. Memory files. A four-line CLAUDE.md that states the test command added 184 tokens of startup context in another run; the replayed run had none.
  4. The history grows. Each call resends everything before it plus one reply and one result: 13,242 tokens of prefix on call 1, 17,155 tokens by call 12 MEASURED, the window bar of section 1's replay drawn for every call at once.
  5. Almost all of it is a cache read. Everything but the newest piece repeats byte for byte, so the provider reads it from its prompt cache: 177,132 of 181,145 input tokens in the replayed run.
  6. The bill. A cache read on Haiku 4.5 costs $0.10 per million tokens against $1 for fresh input, so the columns shrink to what was billed: about $0.039 for the run; billed as fresh input the same run would have cost about $0.195 instead of $0.039 (derived: same tokens, list prices) MEASURED.

Anthropic calls the work context engineering, "the set of strategies for curating and maintaining the optimal set of tokens (information) during LLM inference", because as the window fills the model's ability to recall what is in it decreases (29 Sep 2025). The levers, cheapest first, each owned by a section of Context engineering: prompt caching and the order of the request (2), clipping tool output (3), compaction (4), memory files and skills loaded on demand (5), subagents with their own window (6), notes outside the window (7), memory layers such as Mem0, Graphiti and Letta (8), and context rot as the window fills (9).

The one lever every harness comparison needs: prompt caching (steps 5 and 6). The prefix repeats on every call, so providers cache it. Caching works only if the prefix stays byte-identical, which is why a home-made harness that resends its transcript as one growing block of text got 0 cache reads in the Loop lab and, in section 7, cost twice what Claude Code cost for the same result.

Research on memory that this root only points to: read-time memory curation (Just-in-Time Memory), a second model that reminds the agent of what it dropped (Proactive Memory Agent), and why skills help and when they misfire (Demystifying Agent Skills). Retrieval is rag-and-retrieval.

Go deeper: Context engineering for every lever with its own recordings (forced and automatic compactions with the summaries verbatim, cache placement, a needle grid); Claude Code, taken apart section 9 for what fills Claude Code's window and what survives its compaction; the Trace and context lab for the running example's startup context, caching on and off, and a budget model checked against the recordings.

4. Control: stopping, planning, delegating

In the loop of section 1 the model stops by replying without a tool call (the API marks it end_turn). A harness adds hard limits the model cannot talk its way past: a maximum number of turns, a token or dollar budget, a wall-clock timeout, and the user's interrupt. The two classic failures are opposites: stopping too early (declaring victory without checking) and never stopping (looping on the same failing approach). Four mechanisms recur across harnesses, each defined in a sentence here and owned elsewhere:

Hooks

A hook is the harness running your code at a fixed point in the loop. Claude Code documents 33 hook events; a PreToolUse hook that exits with code 2 blocks the call whatever the model wanted. A rule that must hold every time belongs in a hook, not in the prompt. Claude Code section 4.

Planning

A plan mode lets the model read but not change anything until a person approves a plan; a todo list is a tool whose only effect is a visible checklist in the context. Building a harness section 8; Claude Code's plan mode, and the Sonnet model that answers it when you asked for Haiku, in Claude Code section 8.

Subagents

A subagent is a second loop with its own fresh window: it does the reading, and only its summary comes back. It isolates context; it does not save tokens. Context engineering section 6; when several agents help or hurt, Multi-agent patterns.

Long-running agents

Past one context window the agent needs state outside it: Anthropic's long-running harness has an initializer agent write a progress log and a feature list that each later session reads. Cloud and background agents are the same idea on a managed machine, returning a branch or pull request. Building a harness section 8; Context engineering section 7.

Go deeper: Building a harness section 10 runs one task under three stop rules and records Claude Code's turn and budget limits; Other coding harnesses section 2 compares what stops each harness's loop; the Loop lab's step 2 adds a finish action, step 5 a subagent with its own transcript.

5. Safety: permissions, sandboxes, injection

Every tool call runs with the harness's rights, which on a laptop are yours. Two things can go wrong: the model can simply be wrong (delete the wrong directory, push to the wrong branch), and it can be steered by text it reads. Prompt injection is an instruction planted in a file, web page, issue or tool result that the model follows as if the user had written it. Neither can be fixed inside the model with certainty, so the harness puts controls around it, in layers, each owned by a section of Agent security:

Fig. 3, the layers one at a time

  1. Permission gate. Before each call, rules decide allow, deny or ask a person, and anything unknown fails closed. A gate decides which commands start; an allowed command still runs with your rights. Agent security section 4 runs the Loop lab's gate on eleven actions; Claude Code's rules and modes are Claude Code section 3.
  2. Sandbox. An operating-system boundary around what does run: which files it may write and which hosts it may reach. Agent security section 6; how namespaces, seccomp and Seatbelt work, Containers and isolation.
  3. A machine you can throw away. Containers and cloud VMs, where full autonomy is acceptable because the blast radius is the box.
  4. Egress and secrets. The one path out, written over destinations rather than tools, and credentials the model never sees, added outside the box. Agent security sections 7 and 8.
  5. The lethal trifecta. Untrusted content comes in, private data sits inside and a way out is open: an injected instruction can send the data out. Remove one leg; here the way out goes.

The lethal trifecta. Simon Willison's framing (16 Jun 2025): an agent that has access to private data, exposure to untrusted content and a way to communicate externally can be made to send your data to an attacker, and no current filter reliably prevents it; the defence is to never combine all three. Agent security section 1 turns it into a design tool: tick the controls your agent has and see which leg goes.

Two limits sit around these layers. A classifier that judges each action before it runs (Claude Code's auto mode, Codex's Guardian) catches an over-eager model's mistakes, but in Anthropic's red-team study an agent working to get past the production monitors succeeded in more than 55% of attacks; and the harness's own dependencies are attack surface, since a LiteLLM release built and signed by its own hijacked pipeline was made to steal every token on the machines that installed it (Agent security sections 9 and 3).

Go deeper: Agent security for the threat model, injection, the supply chain of tools and MCP servers, approval design, detection and red-teaming; Other coding harnesses section 4 for each harness's default containment; Personal agents for an agent that reads messages from other people. Protocol-level auth for tools and agents is on Auth and MCP.

6. The products, and how they differ

Every coding harness runs the loop of section 1. They differ in the choices around it, and five questions place any of them:

Where does it run?

Your terminal (Claude Code, Codex CLI, Gemini CLI, opencode, Aider), your editor (Cursor, GitHub Copilot's agent mode, Cline), a cloud machine that returns a pull request (Devin, Codex cloud, Claude Code on the web), a resident daemon that listens on your messaging apps (OpenClaw, Hermes Agent), or a vendor-run cloud computer that works for you and messages you back (Meta's Muse, Claude Duet). Where it runs decides what you can still check: an edit as it lands, a pull request afterwards, or an action already taken.

Which models?

Tied to one vendor's models, or model-agnostic through a gateway. Tied harnesses can tune prompts and tools to their models; agnostic ones carry an edit format and prompt per model.

How contained by default?

Ask-before-acting, an OS sandbox on by default, or a disposable VM per task (section 5).

How extensible?

Memory files, skills, hooks, subagents, MCP servers, plugins: which exist, and which are code rather than prompts.

Can you read it?

Open-source harnesses (OpenHands, Aider, opencode, Codex CLI, Gemini CLI, SWE-agent and mini-SWE-agent) are the only ones whose loop you can read line by line; Claude Code's behaviour is visible through its recorded streams, which is how the labs on this page study it.

Versions, licences, defaults and dates change monthly, so they live in one place, checked against primary sources: the Harness atlas (23 harnesses on nine axes, with a side-by-side compare and a chooser). Three child pages take products apart: Claude Code, taken apart; Other coding harnesses (Codex, Gemini CLI, opencode, Aider, OpenHands and mini-SWE-agent compared by design choice, read from source and run on the same task); Personal agents (resident and computer-use agents, OpenClaw and Hermes Agent).

7. Measuring and training: the score belongs to the pair

An agent benchmark scores a system: the model, the harness, its settings (reasoning effort, turn and time limits) and the environment. Change the harness and the same weights score differently, and, more often, cost differently. On published runs (the Harness atlas's "The harness changes the score", from Agentic benchmarks): Arena's HarnessTax study moved success by about 2 points on SWE-bench Lite and 5 on Terminal-Bench 2.0 across three harnesses, while Claude Code cost about twice the minimal four-tool harness Pi per attempt on SWE-bench Lite SOURCE. In a controlled run on Harnesses for training and evaluation, the harness moved Qwen3-4B by +50 points and Claude Haiku 4.5 by none MEASURED: a small model is far more sensitive to its harness than a strong one; the bill is sensitive for both.

What this page's own runs show MEASURED, all on the running example:

ComparisonHeld fixedWhat changedResult

The last row is a harness effect with no change in outcome: the Loop lab's harness resends its transcript as one growing text block, so it never hits the prompt cache (section 3), and paid $0.0738 against Claude Code's $0.0384 for the same passing tests on Sonnet 5.5. Three identical Haiku runs differed in calls and cost, which is why a harness claim needs several runs (Trace and context lab, "Same task, same settings, different runs").

The same loop trains models. A trajectory, the recorded stream of every request, tool call, result and token count, is what you grade when the final answer is not enough (Agent and trajectory evaluation). In reinforcement learning terms the task and its repository are the starting state, tool calls are actions, tool results are observations, and a verifier such as the test suite gives the reward: a harness is an RL environment, and a model learns the tools, formats and context habits of the harness it was trained in. If the harness moves the score and the bill, a loop can also search over harnesses; the catch is that a loop tuned on the score it reports overfits it. Nor does the harness's gain fold neatly back into the weights: a same-size model trained on a search harness's traces stays measurably behind the harness, and a complexity argument says a fixed-depth model with only a short chain of thought cannot catch up (Harnesses for training section 6).

Go deeper: Harnesses for training and evaluation owns all of this with its own 240 rollouts: the controlled scaffold experiment (section 1 and its Scaffold experiment tab), an RL environment and verifier from zero (sections 2 and 3, its Environment lab tab), groups and advantages (4), which tokens get loss (5), trajectories as data (6), self-improving harnesses (7) and the published systems at scale (8). Building a harness section 12 for measuring your own harness against the model; Coding benchmarks for why "% resolved" needs a scaffold column; Topic: llm-training-and-post-training for where agentic RL sits among the training stages.

8. Child pages

Eight pages own the depth, each built from its own recordings and primary sources (October 2026). Reading times are each page's own measurement.

Claude Code, taken apart: loop, tools, permissions, hooks, memory, subagents, headless runsThe reference harness mechanism by mechanism in 23 recorded runs: loop, tools, permissions with a recorded 12 by 8 decision grid, hooks, memory files, skills, subagents, plan mode, context and compaction, MCP configuration, headless runs, settings. Reading 42 min, plus 24 in closed details.
Building a harness: the loop, tool calling, edit formats, stop conditionsA harness from scratch, decision by decision: a tool call down to tokens, the action boundary, parallel calls, streaming, tool and error design, edit formats measured, planning, the execution environment, stop rules, cost, and measuring a harness. Reading 41 min, plus 20 in closed details.
Context engineering: window budgets, caching, compaction, memory files, subagentsEvery lever on the window with its own recordings: budget, cache placement, tool-output policies, real compactions, memory files and skills, subagents, notes, memory layers (Mem0, Graphiti, Letta) and context rot. Reading 39 min, plus 25 in closed details.
Agent security: permissions, sandboxes, prompt injection, egressThe threat model (the lethal trifecta), injection, the supply chain, the permission gate, human approval, sandboxes, egress, credentials, detection and red-teaming, defensive evidence only. Reading 31 min, plus 6 in closed details.
Guardrails: staged runtime safety for LLM systemsThe classifiers in the request path, stage by stage: input, dialog and tool, and output rails, what each catches and wrongly blocks, the same 450 conversations with and without each stage, guard models read by metric, latency and cost, and how to evaluate a rail. Reading 40 min, plus 9 in closed details.
Other coding harnesses: Codex, Gemini CLI, opencode, Aider, OpenHands, mini-SWE-agentSix harnesses compared by design choice (action format, stop rules, edit matchers, containment, context, extension, where the loop runs), read from source at pinned commits and run on the same task. Reading 30 min, plus 22 in closed details.
Personal agents: OpenClaw, Hermes Agent, and how they differ from coding harnessesResident and computer-use agents: triggers and the gateway, screenshots against accessibility trees, a failure map, mid-run messages, memory, the gate by undo class, the products as published. Reading 32 min, plus 29 in closed details.
Harnesses for training and evaluation: scaffold sensitivity, RL environments, trajectories, self-improving harnessesThe harness as ruler and gym, on 240 recorded rollouts: a controlled scaffold experiment, an RL environment and verifier, groups, loss masks, trajectories as data, harness search, and the systems at scale. Reading 36 min, plus 24 in closed details.

Depth

Interview rehearsal: ten questions on the whole topic (answer each aloud before reading on)

What is an agent harness, in one sentence, and what does it own? The program around a model that runs the loop: it assembles the context for each call, offers and executes tools, gates them with permissions and a sandbox, decides when to stop, and presents the work to a person. The model only chooses the next action.

Walk through one iteration of the agent loop at the API level. Send system prompt, tool definitions and messages; the reply has stop_reason: "tool_use" and a tool_use block (id, name, input); the harness checks permission, runs it, appends the reply and a tool_result with the same id; call again. Stop when the reply has no tool call or a limit is hit.

Your agent's bill doubled after a refactor of the prompt builder. What do you check first? Cache reads per call. If the prefix is no longer byte-identical (timestamps, reordered tools, one rebuilt string) every call pays full input price or cache-write price instead of the cache-read price.

How would you design tools for a coding agent? Few tools matching real tasks (read, search, exact-replace edit, run), clear names and descriptions with examples, results that lead with the verdict, actionable errors, size caps with a note, and an eval loop over real tasks to tune them.

The context window is filling on a long task. Options, cheapest first? Clip or clear old tool results; load skills and tool definitions on demand; move exploration into subagents; write state to files; compact (summarise and restart). Each later option risks losing more.

An agent reads untrusted web pages and has repo secrets. How do you make it safe? Break the trifecta: remove the exfiltration path (network allowlist by destination, no arbitrary URL fetch), keep secrets outside the agent (proxy-injected credentials), run in a sandbox, and gate consequential actions on what they do, not where the text came from.

Why can two papers report the same model at very different scores on the same benchmark? Different harnesses, effort settings, turn and time budgets, attempts, or splits. Ask for all of them, plus cost and the number of runs.

How would you use a harness to generate RL training data? Wrap tasks with a verifier in sandboxes, run the policy in the same harness you will deploy, keep full trajectories with rewards, redact them, train on passing or advantage-weighted ones, and evaluate on held-out tasks and a second harness to catch overfitting to the scaffold.

When is a subagent worth it? When a subtask needs a lot of reading but returns a small answer and does not need the parent's decisions. Not when parallel workers must agree on choices they each make.

Build or buy: when write your own harness? When you need control over the loop (custom tools, training-time use, unusual environments, auditing) or must run where a product cannot. Otherwise use a product or the Agent SDK and spend the effort on tools and verification.

Sources are linked where each fact is used. Recordings: Claude Code CLI 2.1.289 and the Loop lab's own harness, run on 5 October 2026 on a Claude subscription; costs are API-price equivalents at the list prices of that day. Corrections to the old Notion pages are listed in this page's source (src/read/coverage.md).