Why does a looping agent’s bill grow quadratically?
If each retry appends the previous error and output, the input at step i is T + (i − 1) × (T + O). Total input over N steps is N × T + (T + O) × N(N − 1) / 2: the second term is quadratic. At 2,000 input and 800 output tokens, 50 steps send 3.53M input tokens instead of 100k. This is the doom loop pattern: a failed tool call, a retry with the error appended, and no external stop.