Agent loop
Plan, call a tool, read the result, decide again. The cycle an agent repeats until it finishes or is stopped.
Also written: agentic loop, ReAct loop.
Every agent framework is a variation on four steps: decide what to do, call a tool, observe what came back, and decide again with that result added to the context.
Two consequences follow from the loop, and both are about cost. The context grows on every iteration, because each observation is appended — so turn twenty is far more expensive than turn one. And because the context changes each time, the prompt cache (Paying a reduced rate for a prefix the vendor has already processed, instead of full price for sending it again.) is repeatedly invalidated and rewritten, which is why agentic workloads are dominated by cache-write (The charge for putting a prefix into the prompt cache. Usually more than the input rate, not less.) charges rather than by output.