Syed Tanveer Jishan.

Why doubling an agent's steps quadruples its bill

An AI agent re-sends its whole history to the model on every step. So, it pays to re-read its own past far more often than it pays to think. If you count the steps in a task you will still underestimate the bill, because the cost is hiding in something the step count does not show.

Published ·Updated

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.

Sources and method

The chart is arithmetic. Each step adds a roughly constant chunk of new context, and the agent re-sends the running history to the model on every step, so the tokens processed by step 20 are 1 plus 2 plus 3 all the way to 20, which is close to the square of the steps divided by two. The token counts are illustrative on that assumption, chosen to sit in the range reported for real agentic tasks. Caching charges the unchanged part of the history at a fraction of the normal input price, so reuse and a step cap bend the curve back down toward the no-re-read line rather than removing the cost entirely.