Why Is My AI Agent So Expensive to Run?
Your AI agent doesn't have a pricing problem. It has a multiplication problem. Every "step" an agent takes — every plan, tool call, and retry — is a full API call, and agents take dozens of them per task. A $0.02 API call repeated 50 times, twice a minute, all month, is how a side project turns into a four-figure invoice.
This is a tutorial-style breakdown: the five cost drivers that make agents expensive, each with concrete math on real October 2026 rates, and the fixes that cut each one. We'll price a realistic support-ticket agent throughout — 25 steps per ticket, 2,000 tickets a month — so every number below is checkable.
The Reference Agent: $820/Month
Meet our example: a customer-support agent running on Claude Sonnet 5.5 ($2.00 input / $0.20 cached / $10.00 output per 1M tokens). Each of its 25 steps sends 15K input tokens (3K fresh, 12K cached) and generates 800 output tokens:
| Token type | Per step | Rate | Cost/step |
|---|---|---|---|
| Fresh input | 3,000 | $2.00/1M | $0.0060 |
| Cached input | 12,000 | $0.20/1M | $0.0024 |
| Output | 800 | $10.00/1M | $0.0080 |
Per step: $0.0164. Per ticket (25 steps): $0.41. Per month (2,000 tickets): $820. Now let's see where that $820 leaks.
Driver 1: Every Step Is a Full API Call
A single chat message is one API call. An agent that plans, calls tools, reads results, re-plans, and answers can easily make 25 of them to resolve one ticket. Step count is a straight multiplier on your bill — a 25-step agent costs 25x what its per-call price suggests.
The fix is embarrassingly mechanical: cap max steps (12–15 is plenty for most tasks) and log the step distribution. Teams that add a step cap typically find 10–30% of their agent spend was coming from tasks that looped 40+ steps and still failed. Those tasks should have failed fast and cheap.
Driver 2: Context Regrowth
Here's the subtle one. At step 25, the agent re-sends the conversation from steps 1–24 as input — the prompt grows linearly with every step. Our reference agent's 15K input per step is mostly history, not new information.
Without prompt caching, those 15K tokens bill at full price: 15,000 x $2.00/1M = $0.0300 of input per step instead of $0.0084 — the per-ticket cost jumps from $0.41 to $0.95, and the monthly bill from $820 to $1,900. Caching alone saves over $1,000/month on this workload. The trick is ordering your prompt with the stable content first — system prompt, tool definitions, then history — so the growing prefix hits the cache. Our prompt caching guide walks through the exact setup.
Driver 3: Output Costs 5x — and Agents Love to Narrate
Output tokens cost roughly five times input tokens on every major provider. And agents are chatty: they narrate their reasoning, restate tool results, and write long explanations — the 800 output tokens in our example are already the single biggest cost line per step ($0.0080 of $0.0164).
Worse, there's a double-pay loop: verbose output from step N becomes input at step N+1. You pay 5x to generate the tokens, then pay again to re-read them. Two fixes compound here:
1. Set max_tokens per step. Most agent steps need a tool call or a short decision, not an essay. Capping step output at 300–500 tokens is a config change that cuts the output line immediately.
2. Suppress narration in the system prompt. "Output only the tool call or a one-line status" is worth real money at agent scale. Every 800-token explanation that could have been a 50-token status is $0.0075 burned — plus its re-read cost on every subsequent step.
Also watch reasoning tokens: on reasoning models, the model's internal thinking bills as output tokens even though you never see it. A step that returns 200 visible tokens may have burned 2,000 reasoning tokens behind the scenes at the 5x rate. Match reasoning effort to the task.
Driver 4: Retries and Runaway Loops
A retry is a full re-run of the failed steps — and agents fail in the most expensive way possible, near the end, after accumulating maximum context. The math:
If 5% of tickets hit a 4-retry spiral (4 extra full 25-step runs), that's 0.05 x 4 x $0.41 = $0.082 of dead spend per ticket on average — a 20% tax on the whole workload, buying zero resolutions. And a truly stuck agent with no step cap can burn 100 steps on one ticket: 100 x $0.0164 = $1.64 with nothing to show for it.
The fixes: step caps (driver 1), circuit breakers (abort when the same tool fails twice with the same error — the third try never works), and retry budgets per task. Log retries separately from first attempts so you can see the tax line.
Driver 5: Flagship-by-Default
The biggest lever of all. Our reference agent runs every step on Sonnet 5.5 at $0.0164/step. But not every step needs the workhorse model — classifying intent, formatting a response, and summarizing a tool result are budget-model jobs. Route the 18 easy steps to Claude Haiku 5.5 ($0.10 / $0.50 per 1M, cache reads $0.01) and keep 7 hard steps on Sonnet 5.5:
| Routing | Cost per ticket | Cost per month |
|---|---|---|
| All 25 steps on Sonnet 5.5 | $0.410 | $820 |
| All 25 steps on Opus 5.5 (flagship default) | $0.760 | $1,520 |
| 7 hard steps Sonnet + 18 easy steps Haiku | $0.130 | $260 |
Routing cuts the bill 68% — and going flagship-by-default nearly doubles it for no measured gain. The honest version from our bill-shock checklist: most teams find 60–80% of agent steps don't need the premium model once they actually measure per-step quality. Start every step on the cheap model; promote only the steps that fail.
The Fix Stack, Ranked
| Fix | What it kills | Typical savings |
|---|---|---|
| Route steps by difficulty | Flagship-by-default | 40–70% |
| Prompt caching, stable prefix first | Context regrowth | 50–70% of input cost |
| Step caps + circuit breakers | Runaway loops, retry spirals | 10–30% |
| Max tokens per step + no narration | Output bloat, double-pay loop | 20–40% of output cost |
| Batch offline agent runs | Full-rate pricing | ~50% on eligible work |
| Per-step cost logging + billing alerts | Invisible leaks | Priceless (finds the rest) |
Apply routing, caching, and step caps together and our $820/month reference agent drops to roughly $150–200/month — same ticket volume, same resolution quality, 75% less spend. Batch mode (50% off for work that can wait) stacks on top for anything that isn't interactive.
Price It With Your Numbers
These are illustrative numbers on published rates — your agent's step count, context size, and cache ratio will differ. Plug your own per-step token mix into the AI API Cost Calculator: enter your steps as "tasks," your average input/output per step, and your cache ratio, and it prices the month across providers.
FAQ
Why is my AI agent so expensive compared to a chatbot?
Because one agent task equals dozens of API calls. A chatbot sends one request per message; an agent sends one per step — planning, tool calls, retries — and each step re-sends the growing conversation history. Step count and context regrowth are the two multipliers chatbots don't have.
What's the single biggest cost driver in agents?
Usually flagship-by-default: running every step on the most expensive model. Routing easy steps to a budget model (like Haiku 5.5 or GPT-6 Luna at $0.10/$0.50) routinely cuts agent bills 40–70% with no quality loss on the simple steps.
Does prompt caching really matter that much for agents?
Yes — agents are caching's best case, because every step re-sends nearly the same prefix. On our reference workload, caching saved over $1,000/month (from $1,900 to $820). You need the stable content ordered first and byte-identical across steps, or the hit rate collapses.
How do I stop runaway agent loops?
Three layers: a hard max-steps cap (12–15), a circuit breaker that aborts when the same tool fails twice identically, and a per-task retry budget. Log retries separately so the dead spend is visible.
Should I just use a subscription instead of the API for agents?
Subscriptions are priced for humans, not loops — an agent burns through "generous" caps before lunch. Our rule of thumb: subscriptions win under ~$200/month of usage; production agents almost always belong on metered API pricing with caching and routing. The full reasoning is in our subscriptions vs API crossover guide.
Workload numbers are illustrative examples computed from published October 2026 rate cards (Claude Sonnet 5.5, Opus 5.5, Haiku 5.5); your agent's step count and token mix will differ. Rates change — confirm on the provider's pricing page before committing.