How This Multi-Step Agent Cost Model Works
Estimating an AI agent budget by multiplying a single prompt by an average token price almost always undercounts real production bills by 3x to 8x. Unlike a single-turn chat completion, an autonomous or semi-autonomous agent operates inside an iterative loop: it reads instructions and tool schemas, chooses a tool, ingests the returned payload, and calls the model again until the task completes or hits a stop condition.
Because stateless LLM APIs do not hold conversation memory on your behalf between turns, your orchestrator resends the base context plus every preceding step's tool output on step two, step three, and beyond. Read our full breakdown in How AI Agent Costs Work to see how step count dominates total spend, or jump straight to How to Reduce AI Agent Costs for practical optimization tactics.
-
Base Context sent on every step
System Prompt + Tool Definitions + User Task -
Step i Input Tokens accumulates tool results
Base Context + (i − 1) × Tool-Result Tokens Added per Step -
LLM Cost (with Retries) summed across steps
(Σ Step Cost(i)) × (1 + Retry Rate) -
Budgeted Cost per Successful Task 1.00 P50 · 1.35 P90
((LLM Cost + External API Cost) / Success Rate) × Variance Multiplier
Worked Example: 5-Step Production Workflow
Using the default General Workflow settings loaded above on GPT-5 mini ($0.25/1M input, $0.025/1M cached input, $2.00/1M output), assume your agent loads a 1,800-token system prompt, 1,200 tokens of tool JSON schemas, and a 600-token user request. That yields a 3,600-token base context at Step 1.
Each tool call appends 900 tokens of structured results to the conversation history, so Step 2 sends 4,500 input tokens, Step 3 sends 5,400 tokens, Step 4 sends 6,300 tokens, and Step 5 sends 7,200 tokens—a peak context of 7,550 tokens (including 350 output tokens) and 27,000 total input tokens across the 5 calls before retries. With 70% prompt cache hits, an 8% retry overhead, 3 external API calls at $0.002 each ($0.0060 total), and a 92% task success rate at 500 tasks per day, every number in the table above updates deterministically from the exact formula documented on our Cost Model & Methodology page.
Choosing the Right Specialized Calculator
Different agent workloads fail and scale in distinct ways. A high-volume support agent handles short tickets with high cache-hit ratios, while a coding agent replays large repository diffs over a dozen steps. Use our pre-configured workload calculators to start from realistic engineering baselines:
- Customer Support Agent Cost Calculator: Models 2,500 daily tickets, 80% prompt caching across static policy docs, and ticket escalation rates.
- Research Agent Cost Calculator: Models 10-step search and synthesis loops, heavy retrieval payloads, paid search API calls, and P90 variance reserves.
- Coding Agent Cost Calculator: Models 12-step repo inspection, test-failure retries, model routing to economy models, and larger code diffs.
- Agent Framework Picker: Answer 8 engineering questions to compare LangGraph, CrewAI, Microsoft Agent Framework, OpenAI Agents SDK, Google ADK, Claude Agent SDK, LlamaIndex, and direct API loops.
Essential Cost & Architecture Reading
Before locking in a model contract or orchestration stack, review how tokenization interacts with context window thresholds in Tokens and Context Windows Explained. If you are planning machine-to-machine paid tool calls, see our technical breakdown of the x402 payment protocol for AI agents, or examine how US enterprises govern production agents in 12 Real Agentic AI Examples Across US Industries.