Four budgets, one breaker: stopping the runaway agent

A controller that never calls finish() does not have to crash to hurt you. Step it forward and watch four gauges climb. With NO GUARDS the run only stops at a demo cap (RUNAWAY). With GUARDS ON the loop detector or the budget trips a circuit breaker that returns a graceful partial result. Drag a ceiling down to make a different dimension trip first.

The world: the same refund desk. Per step the meter charges 80 tokens, $0.0008, and ~1.2s simulated. Default ceilings: 4 steps, 600 tokens, $0.02, 12s. Loop threshold: 3 identical actions.
Guard mode
Which agent is misbehaving
The BudgetMeter: four dimensions, each checked before every step
steps 0 / 4 within
4 steps
tokens 0 / 600 within
600 tok
cost $0.0000 / $0.02 within
$0.0200
wall-clock (sim) ~0.0s / 12s within
12s
circuit breaker
closed tripped graceful finish
Step trace
Generalizes RAG Part 19. P19 had a single max_steps cap and an informal note ("if the agent runs the same search twice, stop"). Here that one number becomes a four-dimensional budget (steps, tokens, cost, time), the informal note becomes a real (action, args) loop detector, and "stop" becomes a graceful partial exit instead of a crash or a spin.
How we keep it honest: wall-clock is simulated (a fixed ~1.2s per step, not measured) so the run is reproducible; the cost numbers are illustrative per-token estimates, not a real price sheet. The runaway risk is general: there are documented incidents of unbounded agent loops burning a serious amount of money before anyone noticed.

steps   tokens   cost   time   tripped / runaway   within budget