Experiment · complete

Agent cost scales with the square of steps, not linearly

A cost-model experiment showing why a multi-step AI agent is far more expensive than the same number of independent calls — because each step re-sends the whole growing transcript as input.

Question

A ten-step agent task feels like ten quick model calls. Why does it cost so much more, and how does the cost grow as tasks get longer?

Method

This is a model-based experiment. An agent step is a fresh call that re-sends the accumulated conversation as input, so step N carries the context of steps one through N minus one.

Summing input across a task gives base tokens times the sum one plus two up to the step count — which is proportional to steps squared, not steps. Output stays linear. I vary the step count and read total input tokens, holding per-step tokens fixed.

You can reproduce the curve in the AI agent cost estimator by increasing the steps-per-task field and watching total input tokens and cost per task climb faster than the step count.

Observations

Doubling the step count roughly quadruples the input token bill, because the compounding transcript dominates. The later steps of a long task are far more expensive than the early ones.

Prompt caching flattens the curve substantially, because the repeated prefix is exactly what caching discounts — the same lever that helps single calls helps agents even more.

Trimming or summarizing context changes the growth from near-quadratic toward linear, which is why context management, not model choice, is usually the biggest cost lever for agents.

Reproduce this with the related tool: /tools/ai-agent-cost-estimator

Limitations

Real agents have variable step counts and failure-and-retry loops; a fixed per-step assumption understates the tail. The model prices successful, average runs.

It is a demonstration of the cost algebra, not a benchmark of any specific agent framework or model.

Agents that aggressively summarize context grow more slowly than the naive model; the square-law is the worst case, not a universal constant.