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.

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.