Agent Harnesses Explained

Agent Harnesses Explained

What sits between a model and the world.

An interactive guide to the agent harness: the loop, the tools, permissions and context management around a model, animated by a tested simulator.

  1. turn 1
    505
  2. turn 2
    561
  3. turn 3
    689
  4. turn 4
    777
  5. turn 5
    871
  6. turn 6
    939
  • System prompt
  • Tool definitions
  • Task
  • Reply header
  • Model's messages
  • Tool results
The context sent to the model on each turn of the scripted run, in tokens, to scale. The whole conversation goes every time.

How this is checkedAgent_Loop_Sim's Python reference and the TypeScript port in your browser produce the same events, token for token and float for float, and three recorded runs of a small open-weights model are replayed token for token. How it is tested →

What you'll learn

A chat model only writes text. The harness around it turns that into an agent: it runs the loop, describes the tools, parses the calls, decides which ones may run, keeps the context inside the window and the prompt cache warm. To fix one failing test, a scripted agent here makes 6 model calls and sends the model 4,342 tokens to write 197 tokens.

Each chapter takes one of the harness's choices apart, built around an animation. Every frame comes from Agent_Loop_Sim, a deterministic simulator with a real tokenizer, tested against its Python reference. Nothing here calls a live model: the scripted runs are reproducible, and three runs of a small open-weights model were recorded once and are replayed token for token, failures and all.

Reading order for the Agents track

Six sites, one engine. Each builds on the ones before it, but each also stands alone: start anywhere and follow the links back.

  1. 1Harnesses (this site): the loop, tools, context budget, prompt cache and permissions around one model; assumes nothing.
  2. 2Protocols: how tools and other agents are reached on the wire (MCP, A2A); assumes the loop.
  3. 3Context: what goes into the window: retrieval, packing, compaction, memory; assumes the context budget.
  4. 4Orchestration: many steps and many agents as a graph: state, checkpoints, durable runs, fan-out.
  5. 5Evals: is the agent good, and how sure are you: pass@k, intervals, graders, the harness effect.
  6. 6Security: defences by design: trust labels, least privilege, sandboxes, approvals; reads best last.

New to the Agents track? Start here: the six sites in reading order, what you need first, and a glossary of the terms they define.

Part of a family of sixteen companion sites in four tracks, all in the site menu above: Foundations (Decoder, Training), Hardware (Kernels, Systolic, Accelerators, Racks), Inference (Serving, Architectures, Numerics, Trade-offs) and Agents (Harnesses, Protocols, Context, Orchestration, Evals, Security). It is the first of the six agent sites. How this one was built, and how to check it: about.