At the centre of an agent is a small loop.
- The harness builds the context: instructions, the task, descriptions of the tools on offer, and everything that has happened so far.
- The model reads that context and outputs text. Either it is a final answer, or it is a tool call.
- If it is a tool call, the harness checks it against its rules, runs the tool and appends the result to the context.
- Back to step 1, unless a stop condition says the run is over.
The ReAct paper describes this pattern of actions and observations taking turns, and many agent systems are built around it.
Two things follow from the loop. First, the context grows on every turn, and the model reads all of it again each time. A run of a few steps can process many times more tokens than the final context holds. Caching the part of the context that has not changed, much like a KV cache, saves some of that work, but the new results still have to be read.
Second, nothing in the loop ends it by itself. A model can keep outputting tool calls, repeat one that failed, or wander off the task. That is why every harness needs stop conditions: a final answer, a step limit, a full context window, or an error.
The explainer runs a scripted loop you can pause at any step and shows how many tokens each turn reads.