concept

Agent Loop

The cycle in which a model observes state, selects an action, executes a tool and observes the result, repeating until a goal or a limit is reached.

The structure that distinguishes an agent from a single model call: observe → decide → act → observe, with the model choosing each step rather than following a fixed sequence.

That flexibility is the capability and the risk. Three properties follow directly:

Cost and latency are unbounded by default. Each iteration is a model call with the accumulated history as context, so cost grows super-linearly with loop length. A hard iteration limit is mandatory, not a safeguard.

Errors compound. A wrong step produces observations that make the next step worse. Agents fail by drifting, not by crashing, and a drifting agent can consume its whole budget looking productive.

Non-determinism is inherent. The same input can produce different trajectories, which makes testing, debugging and reproduction genuinely harder than for conventional software.

What makes agents operable: limits on iterations, tokens, wall-clock time and tool calls; full trajectory logging — every prompt, decision, tool call and result — because a failure cannot be diagnosed from the final output; idempotent, permission-scoped tools, since the agent will retry and will attempt things nobody anticipated; and human approval for consequential actions.

The judgement worth applying: a fixed workflow is better than an agent wherever the steps are known. Agents are for genuinely open-ended tasks, and they are frequently chosen for problems a pipeline would solve more cheaply and more reliably.