Skip to Content
AgentsEveReduce sandbox costs

How to reduce Eve’s Vercel Sandbox bill

Your Eve agent finished. Why is the sandbox still costing money? On the Vercel sandbox backend, provisioned memory is billed for the full time the VM stays up, including idle periods after work completes — not only when CPU is active. Start by checking whether compute is still running, whether a durable session kept the sandbox provisioned, and whether snapshots or extra subagent sandboxes are accumulating.

Next action: Open the Vercel Usage dashboard for Sandbox metrics, then estimate your sandbox cost with your episode count and idle hours.

Upstream:

Active CPU and provisioned memory are separate meters; memory uses 1-minute minimum increments.

Vercel Sandbox pricing

Last verified: 2026-09-10 (eve@0.52.5 docs). Source record: docs/eve-sources.md in this repository.

Execution-hosting costs here are Vercel Sandbox compute for Eve’s isolated bash environment. They do not include model tokens, AI Gateway, Vercel Functions, Workflows, or third-party APIs — those stay on the bill when you optimize sandboxes.

1. Idle time after the agent stops working

What to inspect: Sandbox session duration vs. when the model last ran a command. On vercel(), the VM times out after inactivity (default 30 minutes in Eve docs) while the filesystem persists for resume.

What to change: Call sandbox.stop() from authored code when a turn’s shell work is done. Narrow onSession timeouts where your backend supports them. Avoid leaving sandboxes provisioned while waiting on human approval unless you need instant resume.

Tradeoff: Stopping sooner cuts provisioned memory hours but adds resume latency on the next message.

Verify: Compare provisioned GB-hours week-over-week; episode count should stay flat while memory hours drop.

Upstream:

ctx.getSandbox().stop() ends compute without deleting the durable session; Vercel resumes on next I/O.

Eve sandbox lifecycle

2. Over-allocated vCPUs and memory

What to inspect: vercel({ resources: { vcpus: N } }) in agent/sandbox.ts. Each vCPU includes 2 GB provisioned memory on Vercel.

What to change: Start at 2 vCPUs; scale up only when builds or tests fail from CPU limits. Match subagent sandboxes to their task size instead of inheriting parent defaults.

Tradeoff: Smaller sandboxes fail on heavy npm install or parallel test runs.

Verify: Active CPU utilization in Usage — if Active CPU ≪ provisioned time × vCPUs, you are paying for idle allocation.

3. Repeated bootstrap and cold templates

What to inspect: Whether bootstrap runs every session. Template reuse requires stable sandbox source, seed files, revalidationKey, and backend options.

What to change: Move one-time installs to bootstrap; use revalidationKey only when external inputs change. Seed agent/sandbox/workspace/ instead of re-cloning large repos each turn.

Tradeoff: Aggressive caching can serve stale dependencies until revalidationKey bumps.

Verify: Creation count vs. episode count — spikes suggest templates not reusing.

4. Subagent and shared sandboxes

What to inspect: Each subagent gets its own sandbox unless explicitly sharing parent.sandbox. Concurrent subagents multiply provisioned memory.

What to change: Share the parent sandbox only when children need the same files and you accept the security boundary. Otherwise cap concurrent subagents in product logic.

Tradeoff: Sharing reduces cost but removes isolation between agents.

Verify: Concurrent sandbox count in the dashboard during peak agent runs.

5. Retries and duplicate episodes

What to inspect: Workflow retries, client double-submits, and channel redeliveries that each resume or create sandboxes.

What to change: Idempotency keys on session creation, dedupe webhook handlers, shorter tool timeouts to fail fast.

Tradeoff: Stricter dedupe can drop legitimate retries on flaky networks.

Verify: Creations/resumes per successful user task (should approach 1:1 for steady-state chats).

6. Snapshots and retained state

What to inspect: Snapshot storage GB-months; default persistence snapshots filesystem on stop.

What to change: Use keepLastSnapshots: { count: 1 } where appropriate; delete abandoned sandboxes; opt out of persistence (persistent: false) for ephemeral CI-style tasks.

Tradeoff: Fewer snapshots mean slower resume or full bootstrap on next run.

Verify: Snapshot storage line item flat or down after retention tuning.

Upstream:

Persistent sandboxes auto-snapshot on stop; snapshot storage is billed separately from compute.

Persistent sandboxes

Prioritized checklist

PrioritySymptomFirst lever
1Bill high while users idlestop() + shorter idle timeout
2Memory dominatesRight-size vCPUs
3Creations ≫ sessionsFix template/revalidationKey
4Spikes during agent delegationsSubagent sandbox policy
5Storage creepSnapshot retention + delete stale sandboxes

Next steps

Last updated on