01 / 04
A 20-step agent burns about 840,000 tokens, and the reason is that every step re-sends all the steps before it. Step 1 sends about one page of context, step 2 sends two, step 10 sends ten, so by step 20 the agent is paying to re-read a stack twenty pages deep. Add up all twenty of those growing reads and you get roughly 840,000 tokens, about ten times the 80,000 you would expect if each step cost the same. So the running total does not climb in a straight line, but rather curves upward and keeps growing.
02 / 04
About nine-tenths of that bill is the agent re-reading its own past, not doing new work. If you split the area under the curve, the sliver along the bottom is the new work each step adds, a steady amount every time. Everything above it is the history the agent re-sends to the model on every single step. So most of what you pay for is the model reading the same tokens again and again. This is why input tokens primarily drive an agent's cost.
03 / 04
The history re-sent grows by one step each turn, so the total grows with the square of the steps, and doubling the steps roughly quadruples the bill. If you lay a straight line under the curve for a task that never re-read anything, the gap between the line and the curve is the re-reading. Ten steps cost about 220,000 tokens and twenty cost about 840,000, close to four times the cost for twice the work. The steps doubled and the bill quadrupled.
04 / 04
So, what is the solution? You need to bend the curve back toward the straight line. But how? Well, cache the part of the history that does not change so the model is not charged full price to read it again, prune the context down to what the next step needs, and cap how many steps an agent may take before it checks in. I think the number to engineer is how much context each step re-reads and definitely not the price of a token.