Bound the reason → act → observe cycle: name every exit, cap every budget, and detect a loop that has stopped learning.
Deciding when the agent is allowed to stop. Not 'when it feels done' — a hard step count, a token budget, and a rule for what to do when it runs out.
Almost every agent incident — runaway cost, infinite retries, a task that never finishes — is a missing loop bound.
An agent is a loop, not a prompt. It reasons about what it is missing, takes one action, observes the result, and goes round again — and nothing about that path is scripted. That freedom is exactly why the loop is the first thing you must engineer: an unbounded loop is an unbounded bill, and a loop with no progress check will happily spend your entire budget re-running the same failing search. Loop engineering is four concrete decisions: what one lap is allowed to do, which conditions terminate it, what hard ceilings sit around it (iterations, wall-clock, spend), and how you detect that the loop is spinning rather than working. Everything else in agent engineering assumes this is already solid.
An agent is a loop: reason about what's missing, take one action, observe, repeat. Loop engineering is bounding it. I enumerate the termination conditions explicitly — goal satisfied, no tool call emitted, stop marker seen — and put hard ceilings on iterations, wall-clock and spend, because the whole context is re-sent every lap so cost grows super-linearly. Then I add a no-progress detector: hash the action, its arguments and its result, and if that fingerprint repeats, break out and re-plan or escalate rather than burning the rest of the budget. When a ceiling fires I return the partial result and the reason, never a silent hang.
AI agents explained: Build your first agent in 8 minutes — Google Cloud Tech, 8:29