AI Agent Cost Per Task: The Benchmark Nobody Publishes
How much does a single AI agent task actually cost? A breakdown of token economics, model tiering, and infrastructure overhead for production agent deployments, with real numbers from Tacavar's 12-agent stack.
Every vendor selling AI agent frameworks quotes you a per-token price and a theoretical throughput number. None of them tell you what a single completed task actually costs in production. The gap between the API price sheet and your monthly bill is where budgets die. We tracked every token, every retry, every routing decision, and every infrastructure overhead line across Tacavar's 12-agent production stack for 90 days. Here is what we found.
Why Per-Token Pricing Hides Real Costs
When a model provider says a token costs $0.0001, that is the price of one token entering or leaving the model. It is not the cost of a task. A task is a multi-turn conversation between an agent and its tools, often involving 5 to 15 model calls, context windows that grow with each turn, and failed attempts that retry with fresh context. The token count for a single "write a blog post" task can easily exceed 50,000 input tokens and 5,000 output tokens across the full conversation.
The industry-standard framing of "cost per 1M tokens" is a procurement artifact. It makes sense when you are comparing model providers for a single-call use case like summarization or classification. It breaks down completely when you are running autonomous agents that chain calls, maintain context, and retry on failure. For agent infrastructure, the only metric that matters is cost per completed task, and almost nobody publishes it.
This matters because the difference between $0.02 per task and $0.15 per task is the difference between a sustainable agent operation and one that quietly bleeds money until someone notices the cloud bill. At 10,000 tasks per month, that gap is $1,300. At 100,000 tasks, it is $13,000. Most teams never measure the per-task number until the bill forces them to.
The Four Cost Layers of an Agent Task
A completed agent task incurs costs across four distinct layers. Understanding each one is necessary to compute an honest per-task number.
Layer 1: Model Inference (Token Cost)
This is the cost everyone tracks and the one that matters least in isolation. It is the sum of all input and output token costs across every model call in the task. For a typical agent task using a mid-tier model at approximately $0.15 per 1M input tokens and $0.60 per 1M output tokens, a task with 30,000 input tokens and 3,000 output tokens costs roughly $0.0063 per call. But most tasks require 5 to 12 calls to complete, pushing the real inference cost to $0.03 to $0.08 per task.
Layer 2: Retries and Failed Attempts
Agents fail. They produce invalid output, call the wrong tool, exceed context limits, or hit rate limits that force a retry with a different model. Each retry consumes tokens. In Tacavar's stack, approximately 12 percent of tasks require at least one retry, and 3 percent require two or more. The retry overhead adds roughly 8 to 15 percent to the base inference cost. Teams that do not instrument retries are flying blind on this layer.
Layer 3: Context Accumulation
As an agent works through a multi-step task, each subsequent call includes the full conversation history plus any retrieved context (RAG chunks, tool outputs, prior reasoning). A task that starts with a 2,000-token prompt can balloon to 15,000 tokens by the fifth call as history accumulates. This is the most underestimated cost layer because it compounds: call 1 is cheap, call 5 is 5x more expensive than call 1 in input tokens alone. Context window management (summarization, truncation, selective retention) is the single highest-leverage cost optimization available.
Layer 4: Infrastructure Overhead
The compute that runs the agent orchestration layer (the framework itself, tool execution, vector databases for RAG, logging and observability pipelines) has a cost even when no model calls are being made. For a small deployment, this may be a single server at $40-80/month. For a production stack with multiple agents, cron schedulers, and monitoring, infrastructure overhead can represent 20-40 percent of total agent cost at low task volumes, diminishing to 5-10 percent as task volume scales and inference dominates.
Real Numbers: Tacavar's 12-Agent Stack
Tacavar runs 12 production agents handling content generation, research, SEO, infrastructure monitoring, and business intelligence. Over a 90-day measurement window, the average cost breakdown per completed task was:
- Model inference: $0.04 to $0.07 per task (varies by task type)
- Retry overhead: +8 to 12 percent of inference cost
- Context accumulation: Adds 20-30 percent to naive single-call estimates
- Infrastructure overhead: $0.005 to $0.01 per task at current volume
- Effective cost per task: $0.05 to $0.09, depending on task complexity
The total monthly cost for all 12 agents combined averages $50-65/month. That is not a typo. Twelve production agents, running daily across content pipelines, research, monitoring, and operations, for less than the cost of a single SaaS subscription. The key is not a secret model or a hidden API discount. It is aggressive model tiering.
Model Tiering: The 80/20 of Agent Cost Control
The single biggest cost lever in agent infrastructure is routing tasks to the cheapest model that can handle them. Most teams default to a single model (usually the strongest available) for every call. This is the equivalent of hiring a senior engineer to write every line of code, including boilerplate. It works, but it is 5-10x more expensive than necessary.
Tacavar's routing strategy uses three tiers:
- Tier 1 (Frontier models): Used for tasks requiring complex reasoning, code generation, or multi-step planning. Accounts for approximately 15 percent of calls but 50 percent of inference cost.
- Tier 2 (Mid-tier models): Used for standard content generation, summarization, and structured output. Accounts for 60 percent of calls and 35 percent of inference cost.
- Tier 3 (Small/fast models): Used for classification, routing decisions, format validation, and simple extraction. Accounts for 25 percent of calls but only 15 percent of inference cost.
Without tiering, routing all tasks to Tier 1 would increase total inference cost by roughly 4-5x. Routing all tasks to Tier 2 or Tier 3 would degrade output quality on complex tasks. The tiered approach captures 90+ percent of the quality at 20-30 percent of the cost of a frontier-only stack.
CrewAI vs LangGraph vs Custom: Deployment Cost Comparison
The framework you choose affects your per-task cost in ways that extend beyond the model API. Each framework adds overhead in the form of orchestration complexity, retry handling, and context management.
CrewAI provides a clean abstraction for multi-agent workflows but adds overhead in its default context passing mechanism. Each crew member receives the full prior conversation context by default, which inflates token usage on multi-agent tasks. For a 4-agent crew executing a 6-step task, CrewAI's default context handling can use 30-40 percent more tokens than a custom implementation with explicit context scoping. This translates to roughly $0.02-0.03 more per task compared to an optimized setup. CrewAI's retry mechanism is also less granular: when an agent fails, the entire step often re-executes rather than just the failed tool call.
LangGraph offers more control over state management and context flow, which makes it easier to implement per-call context scoping and selective retry. The trade-off is implementation complexity. LangGraph's graph-based execution model requires explicit definition of state transitions, which increases development time but pays off in production cost efficiency. For teams willing to invest in the initial setup, LangGraph typically achieves 15-25 percent lower per-task cost than CrewAI for equivalent workflows.
Custom orchestration (direct API calls with a thin coordination layer) gives maximum control and minimum overhead, but shifts all the operational burden (retry logic, state management, observability) to your team. This approach makes sense when you have a small number of well-understood task types and want zero framework overhead. Tacavar uses a custom orchestration layer because the agent tasks are repetitive enough that framework abstractions add cost without adding value.
The Context Window Trap
The most expensive bug in agent infrastructure is also the easiest to introduce: unbounded context growth. When an agent accumulates context without summarization or truncation, the cost of each subsequent call grows linearly. A 10-step task where context doubles each step (from tool outputs and reasoning chains) can end up costing 10x more than the same task with disciplined context management.
The countermeasures are straightforward but require deliberate implementation. First, summarize prior turns rather than passing full history. A 3,000-token summary of a 15,000-token conversation preserves the essential information at 20 percent of the cost. Second, scope context to the current tool: if an agent is calling a search tool, it does not need the full history of a prior code generation step. Third, set hard token limits per call and fail fast when they are exceeded, rather than letting context grow silently.
At Tacavar, implementing these three measures reduced average input tokens per call by 45 percent and reduced overall per-task cost by approximately 30 percent. The quality impact was negligible because most accumulated context is redundant after the first few turns.
How to Measure Your Own Cost Per Task
If you are running agents in production and cannot answer the question "what does one completed task cost," you are operating without cost observability. Here is the minimum instrumentation needed:
- Token logging per call: Log input tokens, output tokens, and model name for every API call. Group calls by task ID.
- Retry tracking: Flag calls that are retries. Track the retry rate per task type.
- Task-level cost aggregation: Sum all token costs (including retries) per task ID. Divide total monthly cost by completed task count.
- Infrastructure amortization: Divide monthly server/container cost by total tasks. Add to the per-task model cost.
- Context growth monitoring: Track input token count per call position (call 1, call 2, call N) to detect unbounded context growth.
Once you have these five data points, you can compute your effective cost per task and identify which layer is driving cost. Most teams find that context accumulation and retries are the two areas with the most room for optimization.
The Bottom Line
Cost per task is the metric that separates agent experiments from agent operations. The teams that measure it, optimize it, and keep it under $0.10 per task can run production agent stacks for less than the cost of a single SaaS tool. The teams that do not measure it discover the cost when the bill arrives, and by then the architecture decisions that drove the cost are baked into the codebase.
The framework matters less than the discipline. CrewAI, LangGraph, and custom orchestration can all achieve efficient per-task cost with proper context management, retry handling, and model tiering. The framework matters more for developer velocity than for production cost. Pick the one that lets your team ship fastest, then invest in cost observability from day one.
Tacavar's 12 agents run for under $65/month because every cost layer is instrumented and optimized. That is not a marketing claim. It is a measurement. Start measuring yours.