Agentic AI
How Much Does an Agentic Claude Workflow Actually Cost? (Real Numbers)
Every agent post in this series has shown you how to build the thing. None of them told you what running it actually costs. That's on purpose — it deserves its own post, because the answer surprises most people the first time they actually do the math instead of guessing.
The pricing, as of this post
Anthropic bills per token, input and output priced separately, and it changes often enough that you should verify current numbers before trusting anything below for a real budget:
| Model | Input ($ / MTok) | Output ($ / MTok) |
|---|---|---|
| Claude Haiku 4.5 | $1.00 | $5.00 |
| Claude Sonnet 5 | $2.00* | $10.00* |
| Claude Opus 4.8 | $5.00 | $25.00 |
*Sonnet 5 is on introductory pricing through August 31, 2026, moving to 15.00 after. Check platform.claude.com/docs/en/about-claude/pricing for current rates before budgeting anything real.
The detail that catches people off guard: every turn of an agent loop re-sends the entire conversation so far. Turn 6 of a 6-turn loop doesn't just pay for turn 6's new content — it pays input tokens for everything said and done in turns 1 through 5, every single time, because the API is stateless and you're resending the full history each call.
A worked example: the test-fixing agent from post #5
Let's price out something like the Claude Code transcript from earlier in this series — reading failing tests, finding the cause, editing files, re-running tests. Rough token counts for a task like that:
def estimate_agent_cost(
turns: list[dict], # each: {"input_tokens": int, "output_tokens": int}
input_price_per_mtok: float,
output_price_per_mtok: float,
) -> float:
total_input = sum(t["input_tokens"] for t in turns)
total_output = sum(t["output_tokens"] for t in turns)
cost = (total_input / 1_000_000 * input_price_per_mtok) + \
(total_output / 1_000_000 * output_price_per_mtok)
return cost
# A 6-turn agent loop, tokens growing each turn because history accumulates
turns = [
{"input_tokens": 1200, "output_tokens": 300}, # turn 1: initial task + tool description
{"input_tokens": 1600, "output_tokens": 250}, # turn 2: + first tool result
{"input_tokens": 2000, "output_tokens": 400}, # turn 3: + second tool result
{"input_tokens": 2600, "output_tokens": 350}, # turn 4: + edit result
{"input_tokens": 3100, "output_tokens": 200}, # turn 5: + test re-run result
{"input_tokens": 3500, "output_tokens": 150}, # turn 6: final answer
]
cost = estimate_agent_cost(turns, input_price_per_mtok=2.00, output_price_per_mtok=10.00)
print(f"${cost:.4f} per run") # roughly $0.045 on Sonnet 5That's under 5 cents for a real multi-step coding task. Run that same shape of task 500 times a month — one active developer, roughly 25 agent tasks a day — and you're at about **15–$40/month range.
Where the real money goes: scale and model choice, not single runs
The math above looks cheap because it is, for one run on Sonnet. Two things change that fast:
Model choice matters more than turn count. The same 6-turn loop on Opus 4.8 (2.5x the input price, 2.5x the output price of Sonnet 5) costs roughly **0.045 — over double, for the same task, because Opus is priced for harder reasoning, not simple tool orchestration. Most agentic tasks — the kind in this entire series — don't need Opus-level reasoning. Reserve it for genuinely hard judgment calls, and default to Sonnet or even Haiku for routine tool orchestration.
Volume is where costs actually escalate. A single engineer doing light agent work lands around 40/month. A team automating a real production workload — a multi-step agent processing thousands of tasks — can push into hundreds or low thousands of dollars per month, purely on token volume, even with cheap per-run economics.
Two levers that meaningfully cut this down
- Prompt caching. If your system prompt and tool definitions are long and repeated every turn (which they are — that's the whole nature of an agent loop), caching them cuts the cost of that repeated context by roughly 90% on cache hits. For a loop that resends growing history every turn, this is usually the single biggest lever available.
- Route by task difficulty. Not every tool call needs your most capable model deciding it. Simple, well-defined steps can often run on Haiku; save Sonnet or Opus for the turns that involve real judgment.
A cost guardrail worth adding to every agent
Tie this back to the guardrails post: cap spend per run, not just turns.
def run_agent_with_budget(task: str, max_cost_usd: float = 0.50):
spent = 0.0
for turn in run_agent_loop(task):
spent += estimate_agent_cost([turn], 2.00, 10.00)
if spent > max_cost_usd:
return f"Stopped: exceeded ${max_cost_usd} budget for this task."
return "done"A turn limit protects you from an agent looping forever. A cost limit protects you from an agent looping forever expensively — same failure mode, priced in dollars instead of iterations.
Reference links
- Official pricing (verify before budgeting): platform.claude.com/docs/en/about-claude/pricing
- Prompt caching: platform.claude.com/docs/en/build-with-claude/prompt-caching
- Token counting: platform.claude.com/docs/en/build-with-claude/token-counting
Next in this series: "5 Agent Mistakes I Made So You Don't Have To."
Related articles
Agentic AI
5 Agent Mistakes I Made So You Don't Have To
Every one of these cost me real debugging time. Each has a one-line fix — here they are, with the code.
- #claude
- #agentic-ai
- #python
- #debugging
- #best-practices
Agentic AI
I Connected Claude to My Terminal and Broke My Laptop (Lessons on Agent Guardrails)
A weekend project, a bash tool with no restrictions, and the exact three mistakes that let it happen — plus the guardrails that would have stopped every one of them.
- #claude
- #agentic-ai
- #safety
- #guardrails
- #python
Agentic AI
I Gave Claude Hands: My First Tool-Use Agent in 20 Lines
Agents sound complicated until you see the actual request-response loop underneath. Here's the whole thing, stripped down to one tool and 20 lines of Python.
- #claude
- #agentic-ai
- #tool-use
- #python
- #anthropic