Quadratic Cost from Multi-Turn Loops

Naive agent loops rebill the entire accumulated conversation history, including previous prompts and tool outputs, on every LLM call, causing input token cost to grow quadratically rather than linearly, with a 20-step loop potentially consuming over 10x the tokens of a simple per-step estimate.

Sources

Open the full topic