
๐ธ Your AI Agent Is More Expensive Than You Think
One AI agent request can trigger multiple model calls, tool calls, and thousands of tokens. See where the hidden costs come from and how to cut them with better retrieval, routing, caching, and loop control.
Your agent answered one question. It made 3 model calls, retrieved 12 chunks, called 2 tools, and reprocessed the same system prompt every time.The user sees one answer. Your AWS bill sees everything. ๐
An agent isn't priced like a chatbot. 1 user request โ 1 model inference.
๏ปฟ
The hidden pipeline

๏ปฟ
๏ปฟ
Where the tokens go
One question. The agent retrieves 12 chunks (~9,600 tokens) and needs 3 LLM calls to reason, call a tool, and answer. Most agent frameworks resend everything โ retrieved context, system prompt, tool defs โ on every call:

๏ปฟ
38,900 input tokens for one question. Bad retrieval isn't just an accuracy problem โ it multiplies with every loop.
๏ปฟ
What that costs, in real dollars
Real Claude Sonnet 5 Bedrock pricing: $2/1M input, $10/1M output.
Before โ 38,900 input tokens (the 3-call chain above) + ~3,000 output tokens (final answer included):
text
38,900 ร $2 / 1M = $0.07783,000 ร $10 / 1M = $0.0300โโโโโโโโ$0.108๏ปฟ
After โ tighter retrieval, one fewer call: 14,000 input + 1,500 output tokens:
text
14,000 ร $2 / 1M = $0.02801,500 ร $10 / 1M = $0.0150โโโโโโโโ$0.043๏ปฟ
Same task, 60% cheaper. At 50,000 requests/day (30-day month), that's the difference between ~$161,700 and ~$64,500 โ for the exact same feature:

๏ปฟ
๏ปฟ
The tool-call trap
A tool call isn't just its own fee โ its result becomes more input tokens on the next call:
text
User โ LLM โ Tool โ Result โ LLM (re-reads everything) โ Answer๏ปฟ
Real cost = tool fee + tool-result tokens + another model invocation.
๏ปฟ
Five fixes that actually work
- Retrieve less, rerank harder โ 20 chunks in, 4โ6 sent to the model. Cheaper and better grounded.
- Route small questions to small models โ Bedrock Intelligent Prompt Routing can cut costs by up to 30% (official); AWS reported 56% in one internal Anthropic-family test that matched the stronger model's response quality.
- Cache what doesn't change โ system prompts, tool defs, reference docs. Bedrock prompt caching: up to 90% lower inference cost and 85% lower latency for supported workloads. GPT-5.6 on Bedrock bills cached input at a flat 90% discount.
- Cap the loop โ ย
max_iterationsย, ยmax_tool_callsย, ยmax_output_tokensย, ยtimeoutย. Unlimited reasoning is an unlimited bill.
- Trace the request, not just the endpoint โ LLM calls, input/output tokens, cache hit rate, and cost per request, not just per second.
๏ปฟ
This isn't theoretical
AWS's GenAIIC rebuilt two production agents with Works Human Intelligence โ caching, tighter prompts, better model routing. Reported result: up to 97% cost reduction, same task.

๏ปฟ
These are stacked techniques on real workloads, not one universal switch โ but the direction holds: most of the waste isn't the model. It's how many times you make it work.
๏ปฟ
The cost equation
text
AI COST โ ฮฃ(input tokens ร input price)+ ฮฃ(output tokens ร output price)+ tool/API costs+ infrastructure costs๏ปฟ
And the multiplier is the loop itself:
text
More agent loops โ more LLM calls โ more tokens processed โ ๐ธ higher cost๏ปฟ
Every term above can repeat inside one request:
text
โโ RAGโโ ToolsUSER โ AGENT โ LLM โโ Memoryโโ Retriesโโ Loops๏ปฟ
Before you swap models to cut costs, trace the whole request first. The savings are usually in the loop, not the model card.
Don't optimize the model before you understand the request.
๏ปฟ
Cost example uses live Claude Sonnet 5 Bedrock pricing with the stated token assumptions (38,900 in / 3,000 out โ 14,000 in / 1,500 out). Token counts are an illustrative but realistic 3-call agent trace. Percentages are as reported by AWS in the linked posts.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article