Tokenomics: the unit economics of AI agents
Token prices are the easy part. What decides whether an agent is affordable at enterprise scale is how many tokens each task really uses. A practical way to estimate, measure and reduce cost per task.
Price per token is not cost per task
Where the tokens go
System instruction and policies, sent on every call. Tool declarations. Every tool the agent could use is described in the prompt, whether it is used or not. Retrieved context from search, documents or a lakehouse query. Conversation history, which grows each turn because every call resends what came before. Reasoning tokens on models that think before answering, usually billed as output. The answer itself.
A simple model
cost per task = sum over calls of (
uncached input tokens x input price
+ cached input tokens x cached input price
+ output tokens x output price )
+ tool and retrieval costs
monthly cost = cost per task x tasks per monthA worked example
| Call | Input tokens | Output tokens |
|---|---|---|
| 1 | 7,500 | 400 |
| 2 | 9,400 | 400 |
| 3 | 11,300 | 400 |
| 4 | 13,200 | 400 |
| Total | 41,400 | 1,600 |
Levers that move the number
Route by difficulty. Send routine steps to a smaller, faster model and keep the largest models for the steps that need them. Cache the stable prefix. See Prompt caching. Load only the tools a step needs. Group tools by task so the agent is not sent every declaration on every call. Manage history. Summarise or drop old turns and tool outputs the agent no longer needs. Cap output. Set a maximum output length and ask for concise, structured answers; output is the most expensive token. Batch what can wait. Batch inference is priced below online requests for work such as nightly classification or document extraction. Match capacity to traffic. Pay-as-you-go suits variable demand; Provisioned Throughput suits steady, high volume that needs guaranteed capacity.
Measure cost per task in production
The takeaway
More articles
Prompt caching: stop paying full price for the context you send every time
Most agent and RAG prompts repeat the same long prefix on every call. Context caching on Google Cloud lets you pay for it once. How implicit and explicit caching work, and how to design prompts that hit the cache.