Anatomy of an AI agent's costs
Every AI agent task has two cost components: compute (the sandbox, browser containers, GPU time) and model inference (Claude, GPT, or other LLM API calls). Understanding the ratio is critical for budgeting.
| Component | What it covers | Typical cost | You control it via |
|---|---|---|---|
| Compute | Sandbox VMs, browser containers, desktop containers, GPU instances | $0.001–0.50 per task | Instance type, auto-stop, idle timeout |
| Model inference | Claude/GPT API calls for reasoning, vision, code generation | $0.01–5.00 per task | Model choice (Sonnet vs Opus), prompt length, number of steps |
A typical task costs $0.02 in sandbox compute and $0.15 in Claude API calls. Optimizing compute (smaller instances, shorter runtimes) saves pennies. Optimizing model usage (Sonnet instead of Opus, fewer vision steps, shorter prompts) saves dollars. Focus your cost optimization on the model layer.
Per-task cost tracking
Tag every sandbox and container with a run_id, task_type, and department in the metadata field. The platform tracks compute costs per container automatically. Combine with your model provider's usage data to get full per-task costs.
# Tag every resource with cost allocation metadata curl -s -X POST "$SANDBOX_URL/api/sandboxes" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "weekly-ap-run", "instance_type": "ab0t.micro", "auto_stop_minutes": 15, "metadata": { "department": "finance", "task_type": "accounts-payable", "run_id": "ap-2026-03-27", "cost_center": "CC-4200" } }'
# Get cost report for a user curl -s "$SANDBOX_URL/api/costs/user/$USER_ID" \ -H "Authorization: Bearer $API_KEY" | jq . # Get organization-wide costs curl -s "$SANDBOX_URL/api/costs/organization" \ -H "Authorization: Bearer $API_KEY" | jq . # Check quota usage curl -s "$SANDBOX_URL/api/quotas/usage" \ -H "Authorization: Bearer $API_KEY" | jq .
Auto-stop: the #1 cost control lever
The single most effective cost control is auto_stop_minutes. Set it on every sandbox. When the sandbox is idle (no active SSH session, no running commands) for longer than the timeout, it stops automatically. Billing pauses. Files persist.
| Task type | Recommended auto_stop | Why |
|---|---|---|
| Event-driven (PR review, webhook) | 10–15 min | Task completes quickly; stop fast if cleanup fails |
| Interactive session (Claude Code) | 60–120 min | Agent may pause between tasks; don't kill mid-thought |
| Overnight batch job | 0 (disabled) or 240 min | Long-running; but set a ceiling for safety |
| Persistent / always-on | 120–240 min | Catches forgotten sandboxes; agent can restart when needed |
A sandbox created with auto_stop_minutes: 0 (never auto-stop) that nobody remembers to stop. A ab0t.medium running 24/7 for a month costs $30. Set auto-stop on everything. Even persistent sandboxes should have a 4-hour timeout as a safety net.
Hard spending caps
Set monthly cost limits per user or per organization. When the limit is reached, new sandbox creation is blocked and the API returns a 402 (Payment Required) response. Existing sandboxes continue running until they auto-stop.
# Set a $50/month limit for a user curl -s -X POST "$SANDBOX_URL/api/costs/limits/user/$USER_ID" \ -H "Authorization: Bearer $API_KEY" \ -H "Content-Type: application/json" \ -d '{"monthly_limit": 50.00}' # Check remaining budget before creating a sandbox curl -s "$SANDBOX_URL/api/quotas/check/sandboxes" \ -H "Authorization: Bearer $API_KEY" | jq .
Right-sizing instances
Most tasks don't need a ab0t.medium. Here's the decision matrix:
| Instance | Specs | Cost/hour | Best for |
|---|---|---|---|
ab0t.micro | 2 vCPU, 1 GB | $0.0104 | Orchestration, light scripts, API calls, small data processing |
ab0t.small | 2 vCPU, 2 GB | $0.0208 | npm install, medium datasets, test suites |
ab0t.medium | 2 vCPU, 4 GB | $0.0416 | Large codebases, heavy builds, pandas on >100MB files |
ab0t.large | 2 vCPU, 8 GB | $0.0832 | Java builds, large test suites, memory-heavy processing |
ab0t.gpu | 4 vCPU, 16 GB, T4 GPU | $0.526 | ML inference only — stop immediately after job completes |
If you're not sure which instance to use, start with ab0t.micro. If the task runs out of memory (the sandbox gets killed), retry on ab0t.small. Most orchestration, API calls, and light data processing runs fine on 1 GB RAM. Only upgrade when you hit a concrete limit.
Browser and desktop container costs
Browser and desktop containers run in the cloud. They're billed per-second at approximately $0.03/hour. The key cost controls:
- Idle timeout. Set
idle_timeout_minutesto 10–15 for browser containers. If the agent finishes extraction but forgets to release the container, the idle timeout catches it. - Release, don't delete.
POST /api/containers/{id}/releasereturns the container to the warm pool. The next request claims it instantly.DELETEterminates the cloud container. Release is cheaper because it avoids cold-start costs on the next use. - Warm pool sizing. Don't over-provision the warm pool. Each idle pool container costs ~$0.03/hour. If you run research once daily, a pool of 5 is wasteful. Match pool size to your burst demand.
Controlling model inference costs
Model costs dominate. Here's how to keep them in check:
Use Sonnet for everything except deep reasoning
Claude Sonnet 4.6 costs ~3x less than Opus 4.6 per token and is fast enough for 95% of agent tasks: code review, data extraction, vision analysis, report generation. Reserve Opus for tasks that require deep multi-step reasoning or architectural decisions.
Minimize vision calls
Each screenshot sent to Claude's vision model costs ~$0.005. For a QA run with 30 screenshots, that's $0.15. For a competitive intel sweep with 60 screenshots and 60 comparison pairs, it's $1.20. Optimize by only comparing pages that changed at the text layer first (free), then use vision only for pages with detected text changes.
Cap output tokens
Set max_tokens explicitly on every API call. An extraction task that needs 200 tokens of structured JSON doesn't need a 4096-token budget. Lower limits mean lower costs and faster responses.
Batch where possible
Instead of 50 separate Claude calls (one per competitor page), batch extracted text from 5 pages into a single call. Fewer calls = fewer overhead tokens = lower cost.
The monthly cost report
Pull cost data from the platform API and your model provider. Here's the report template your finance team wants:
# AI Workforce Cost Report — March 2026 ## Summary | Category | Amount | |----------|--------| | Sandbox compute (EC2) | $18.40 | | Browser containers (cloud) | $6.20 | | Desktop containers (cloud) | $1.80 | | GPU instances | $4.50 | | **Compute subtotal** | **$30.90** | | Claude API (Sonnet) | $142.00 | | Claude API (Opus) | $38.00 | | **Model subtotal** | **$180.00** | | **Total** | **$210.90** | ## By department | Department | Compute | Model | Total | Tasks | |------------|---------|-------|-------|-------| | Engineering (PR review, QA) | $12.40 | $85.00 | $97.40 | 520 | | Finance (AP, reconciliation) | $4.20 | $32.00 | $36.20 | 52 | | Strategy (competitive intel) | $3.80 | $28.00 | $31.80 | 30 | | Product (research, data) | $8.50 | $25.00 | $33.50 | 45 | | Ops (desktop, monitoring) | $2.00 | $10.00 | $12.00 | 18 | ## Top 5 agents by cost 1. QA on deploy — $65.40 (100 deploys × $0.15 compute + model) 2. PR reviewer — $48.20 (100 PRs × $0.05 compute + model) 3. Competitive intel — $31.80 (30 daily runs) 4. Monthly data pipeline — $18.50 (4 reconciliation runs + ad-hoc) 5. AP vendor portals — $12.40 (4 weekly runs) ## vs human cost equivalent | Agent | Monthly AI cost | Human equivalent | Savings | |-------|----------------|-----------------|---------| | QA on deploy | $65.40 | $8,300 (QA engineer) | 99.2% | | PR reviewer | $48.20 | $2,500 (1 hr/day senior eng) | 98.1% | | Competitive intel | $31.80 | $2,000 (part-time analyst) | 98.4% | | AP vendor portals | $12.40 | $1,500 (AP clerk time) | 99.2% | | **Total** | **$210.90** | **$14,300** | **98.5%** |
The math: 50 AI agents at scale
50 AI agents, each running 4 hours/day on ab0t.micro instances, processing tasks that use Claude Sonnet for reasoning. The compute is $120/month. The model inference (assuming ~100 API calls/day across all agents at ~$0.40/day) is ~$1,200/month. Total: $1,320/month for 50 AI employees.
The human equivalent for the same work: 5–10 FTEs at $5,000–12,000/month each = $25,000–120,000/month. The AI workforce costs 1–5% of the human cost.
Cost optimization checklist
- Set auto_stop_minutes on every sandbox. No exceptions. Default to 15 for event-driven, 120 for interactive.
- Default to ab0t.micro. Upgrade only when you hit memory limits.
- Use Sonnet, not Opus. Save Opus for tasks that demonstrably produce better results.
- Release browser containers, don't delete them. Warm pool reuse saves cold-start costs.
- Set idle_timeout_minutes on all containers. 10–15 min for browsers, 30 min for desktops.
- Tag everything with department and task_type. You can't optimize what you can't measure.
- Set spending caps per user. Prevents runaway costs from misconfigured agents.
- Review the monthly report. Identify which agents cost the most and whether they're providing proportional value.
- Stop GPU instances immediately after inference. A forgotten ab0t.gpu costs $12.62/day.
- Batch model calls where possible. 1 call with 5 pages of context < 5 calls with 1 page each.
What's next
50 AI employees. $1,320/month.
Per-agent tracking. Per-department budgets. Auto-stop. Spending caps. The AI workforce that finance approves.
Get Started Free