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):

PlanPrice shapeKey limits
E2B HobbyFree + usage, $100 one-time creditSessions up to 1 h; about 20 concurrent sandboxes
E2B Pro$150/mo + usageSessions up to 24 h; about 100 concurrent; paid concurrency add-ons for higher limits
E2B EnterpriseCustom commitHigher concurrency, custom terms
Daytona pay-as-you-goUsage per second, $200 free computeStorage 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 itemHow to estimateIllustrative per task
SandboxSteps 1–2$0.006 (tight) to $0.020 (idle leak)
LLM tokensAgent steps × context tokens; output tokens30,000 in + 3,000 out at assumed $3/$15 per M ≈ $0.135
Other toolsBrowser sessions, web search, storageWorkload-dependent
Plan overheadBase 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

  1. Pick the smallest sandbox size that completes typical tasks.
  2. Compute cost per second: vCPUs × rate + GiB × rate.
  3. Log create-to-kill seconds on real tasks, including start-up and idle.
  4. Set short idle timeouts and kill sandboxes explicitly.
  5. Multiply by tasks per month; add retries and long sessions.
  6. Add plan base, concurrency add-ons and storage; subtract free credits.
  7. Check session-length and concurrency caps against your p90 task and peak load.
  8. Add LLM tokens and other tools for the full per-task bill.
  9. 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.

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.