Chapter 17: Many agents

Runaway loops

Also called cost runaway

A loop that keeps spending because nothing told it to stop, or a growing session where each turn resends everything before it. Spend rises with every turn, and if nobody is watching, the first sign is the bill.

A bug in ordinary code wastes CPU. A bug in a loop wastes money and carries on doing it, since a confused agent often does more work, not less. Set the cap before you leave. A cap you add afterwards helps nobody.

Say it to your agent

“Run this headless with --max-turns 30 and --max-budget-usd 5. If either limit stops it, write what is left to do into PROGRESS.md so I can decide whether to carry on.”

The workshop

Name a word, or describe what you mean in everyday language.