Blog 11 min read
Estimate AI agent sandbox cost per task
Method for teams pricing a coding, data-analysis or computer-use agent feature: cost one sandbox-second from vCPU and GiB rates, measure real seconds per task including start-up and idle-before-kill, multiply by tasks per month, add plan fees and concurrency add-ons, subtract free credits, and add LLM tokens for the full per-task bill, with dated E2B and Daytona examples.
Coding agents, data-analysis agents and computer-use agents usually run each task inside an isolated sandbox: a small VM or container that executes code, installs packages and touches files. When a B2B team prices such a feature, the LLM tokens get modeled first. The sandbox bill is often guessed, and the guess is usually wrong in the same direction: it ignores the seconds a sandbox sits idle before it is killed.
This is a method article. It shows how to cost one sandbox-second, measure real seconds per task, scale to monthly volume, add plan fees and subtract free credits, and then add LLM tokens for the full per-task bill. No vendor is recommended. All dollar figures are illustrative, based on public list prices seen on 2026-11-01 (E2B's and Daytona's pricing pages). Prices, limits and plan names change often, so re-check each vendor's current pricing page before you decide.
1. Step 1: cost one sandbox-second
Most sandbox providers bill compute per second, by size:
Cost per second = vCPUs × vCPU rate + GiB RAM × memory rate
Dated list rates (2026-11-01, illustrative): E2B and Daytona price compute at effectively the same rates: vCPU $0.000014/s (= $0.0504 per vCPU-hour) and RAM $0.0000045/s per GiB (= $0.0162 per GiB-hour).
Worked example: a 2 vCPU + 4 GiB sandbox costs 2 × $0.000014 + 4 × $0.0000045 = $0.000028 + $0.000018 = $0.000046 per second ≈ $0.166 per hour.
Size matters linearly. Doubling to 4 vCPU + 8 GiB doubles the rate. Pick the smallest size your typical task completes on, and measure it, rather than defaulting to a large template.
2. Step 2: measure real seconds per task
Billed seconds are not the seconds your agent spends working. They run from sandbox create to sandbox kill:
Billed seconds = start-up + active work + idle before kill
- Start-up: creating or resuming the sandbox, plus installing dependencies if they are not baked into the template.
- Active work: code runs, tool calls, and the wall-clock time the sandbox waits while the LLM thinks between steps. The sandbox is billed while the model generates.
- Idle before kill: the time after the task ends until a timeout or explicit kill call. This is often the biggest leak. A 5-minute idle timeout on a 2-minute task more than triples the bill.
Illustrative task: 5 s start-up + 120 s active = 125 s. At $0.000046/s that is ≈ $0.0058 per task. Leave a 300 s idle timeout and the same task bills 425 s, ≈ $0.0196 per task. Log create and kill timestamps on a sample of real tasks, use the p50 and p90, and kill sandboxes explicitly when a task finishes.
3. Step 3: multiply by tasks per month
Monthly usage = cost per task × tasks per month
At 50,000 tasks/month: the tight version (125 s) is ≈ $288; the idle-leak version (425 s) is ≈ $978. Count retries, multi-sandbox tasks and long-lived sessions (for example a notebook kept open for an hour) separately; an hour-long session at this size is ≈ $0.166 on its own.
4. Step 4: add plan fees and add-ons, subtract free credits
Usage is only part of the bill. Dated plan shapes (2026-11-01, illustrative; re-check vendor pages):
| Plan | Price shape | Key limits |
|---|---|---|
| E2B Hobby | Free + usage, $100 one-time credit | Sessions up to 1 h; about 20 concurrent sandboxes |
| E2B Pro | $150/mo + usage | Sessions up to 24 h; about 100 concurrent; paid concurrency add-ons for higher limits |
| E2B Enterprise | Custom commit | Higher concurrency, custom terms |
| Daytona pay-as-you-go | Usage per second, $200 free compute | Storage billed after the first 5 GiB (about $0.000108/GiB-h) |
Monthly bill = usage + plan base + concurrency add-ons + storage − remaining free credits
Applied to the tight 50,000-task example (≈ $288 usage): on E2B Pro, ≈ $438/month; on a pay-as-you-go plan with no base fee, ≈ $288 plus any storage above the free allowance. One-time credits only matter at the start: $100 covers about 17,000 tight tasks, $200 about 35,000. Check concurrency too: peak simultaneous tasks, not monthly volume, decides whether you need an add-on tier.
5. Step 5: break-even when compute rates match
When per-vCPU and per-GiB rates are the same across vendors, usage cancels out. The comparison is about everything else:
- Plan base fee: a $150/mo base is pure overhead versus a no-base plan, unless you need what it unlocks.
- Session length: if tasks or sessions can run past 1 h, a plan with a 1 h cap does not fit, whatever the price.
- Concurrency: peak parallel tasks above a plan's cap force an upgrade or add-on.
- Storage: persistent sandboxes with large disks add a per-GiB-hour line; idle stopped sandboxes may still bill storage.
- Free credits: one-time credits shift the first months only.
A simple break-even: a base-fee plan is worth it only if the features it unlocks (longer sessions, higher concurrency, support) are worth more than the fee, since usage costs the same. If you need neither, the pay-as-you-go option is cheaper on list price at any volume.
6. Step 6: add LLM tokens for the full per-task bill
Cost per task = sandbox seconds × rate + input tokens × input price + output tokens × output price (+ other tools)
| Line item | How to estimate | Illustrative per task |
|---|---|---|
| Sandbox | Steps 1–2 | $0.006 (tight) to $0.020 (idle leak) |
| LLM tokens | Agent steps × context tokens; output tokens | 30,000 in + 3,000 out at assumed $3/$15 per M ≈ $0.135 |
| Other tools | Browser sessions, web search, storage | Workload-dependent |
| Plan overhead | Base fee ÷ tasks per month | $150 ÷ 50,000 = $0.003 |
In this example tokens dominate and the sandbox is small. The ratio flips for long-running sessions, large sandbox sizes, short prompts, or idle timeouts left at the default. Multiply cost per task by tasks per customer to get cost per customer, then compare with what the feature earns.
7. Checklist before you commit
- Pick the smallest sandbox size that completes typical tasks.
- Compute cost per second: vCPUs × rate + GiB × rate.
- Log create-to-kill seconds on real tasks, including start-up and idle.
- Set short idle timeouts and kill sandboxes explicitly.
- Multiply by tasks per month; add retries and long sessions.
- Add plan base, concurrency add-ons and storage; subtract free credits.
- Check session-length and concurrency caps against your p90 task and peak load.
- Add LLM tokens and other tools for the full per-task bill.
- Re-check every list price on the vendor's current pricing page.
8. Calculators and related reading
Use these calculators to check current sandbox and agent prices before you set a per-task budget.
- E2B sandbox cost calculator: usage, plan base and cost per task
- Daytona sandbox cost calculator: per-second compute and storage
- AI agent sandbox cost comparison: one workload across plans
- OpenAI code interpreter cost calculator: hosted code-execution sessions
- AI agent cost calculator: tokens and tools per agent task
- Browserbase cost calculator: browser sessions for computer-use agents
- Claude managed agents cost calculator: managed agent runtime
Several vendors are listed on purpose. The aim is to compare billing shapes, not to pick a vendor in advance.
Related: LLM API cost modeling for B2B features covers per-token modeling. Web search API costs for B2B AI agents covers another agent tool line. Serverless GPU vs hourly GPU rental applies the same per-second and idle-time thinking to GPUs.
Put AI features to work on your site
AI features pay off when they support clear product pages and buyer inquiries. If you want help with that, contact us or see how the platform fits.
Next step
Want a crawlable inquiry site for that topic?
Tell us the product, target market, and how many sites you need. We build English inquiry pages search engines and AI crawlers can read—then route buyer messages into one admin.
See how Yizhan builds crawlable inquiry sites on the platform page, or leave a request.