Cubs

Guide 06

Agent sandbox or persistent VM? Pick by workload, not by fashion

The argument is not really about isolation. It is about where the setup cost lands — paid again on every task, or paid once and carried as drift.

Published 4 Dec 2026

Two products, one decision. A sandbox appears, runs the task and is destroyed; a machine keeps its disk and resumes. The posts arguing for each are usually arguing about different jobs, and both are right about their own.

The two arguments, stated fairly

For the sandbox. Every run starts from an image you control. Nothing a previous task installed can break the next one, and a compromised dependency dies with the container instead of sitting on disk. For code you did not write — generated snippets, a customer’s script, a model’s own output — the only safe leftover is none. Burst work of hundreds of parallel jobs also wants this: no per-job disk to keep, no per-job state to clean up.

For the persistent machine. A coding agent’s expensive work is setup, not thinking. Cloning a monorepo, npm ci, warming a build cache, migrating a database: that is ten to twenty minutes, and a persistent machine pays it once. It also keeps the things that make an agent useful tomorrow — the repo at the exact commit it was on, a dev server someone can open, notes the agent left itself. Fly.io’s write-up on the split puts it as lifecycle deciding how long a mistake lasts, not how easily one happens, and that framing is the honest one.

The cost of persistence is drift. The disk that still has your files tomorrow also still has last night’s interrupted install, and an agent will build on top of that rather than question it. A week in, nobody can tell whether a regression came from the code or the machine.

A table that decides it

Option Ephemeral sandbox Persistent VM Best for
Lifecycle Created per task, destroyed after Runs until you stop or delete it —
Setup cost Paid every run Paid once Both, asymmetrically
What survives Nothing unless exported Files, packages, repos, caches —
Idle cost Zero, the thing does not exist Whatever the provider charges paused Your budget
Untrusted code Good fit Poor fit — poisoning persists Sandbox
Overnight agent Poor fit — the run outlives the box Good fit Persistent
Preview someone opens later Poor fit Good fit Persistent
Grading or evals Good fit — identical starts Poor fit — state leaks between runs Sandbox
Debugging a live environment Poor — gone when you look Good — SSH in and poke at it Persistent

Note the two rows where the sandbox wins on engineering grounds rather than price: identical starting state, and untrusted code. Those are real, and a persistent machine cannot fake them. The fix for the second is not a different lifecycle, it is a route back to a known state: a snapshot, a reproducible image, and a way to throw the current disk away.

Where it is converging

The vendors are meeting in the middle, which is a good sign that neither pure form survives contact with real workloads.

  • Sandboxes grew persistence. Several now snapshot the filesystem when a session stops, and some default to persistent unless you pass an explicit flag.
  • Persistent machines grew disposability. Reset, restore-from-snapshot and re-provision are standard, because otherwise the drift problem is unmanageable.
  • Pause became the compromise everyone ships: stop the processes, keep the disk, charge less. It gets persistence’s cheap resume with a fraction of sandbox’s idle cost.

The practical consequence: the marketing label on the product tells you less than the lifecycle controls do. Ask what a stop does, what an idle timeout does, and what a reset does.

Six questions before you choose

Run these against any product, including a plain VPS. The answers matter more than the category.

  1. What does stopping do to the disk? Kept, wiped, or snapshotted. This is the only question that decides whether tomorrow’s session starts warm.
  2. Is there an idle timeout, and can you change it? A default of 30 minutes and a hard ceiling of 12 hours describe a different tool from one that runs until you stop it.
  3. What does a reset leave behind? A fresh image with the same name and price is recoverable. A new machine with a new address is a migration.
  4. Where does the isolation boundary actually sit? A container sharing the host kernel is not the same promise as a microVM, and neither is the same as a whole VM per user.
  5. What does idle cost? Per-second metering of a running box is not the same as a paused rate, and free-until-used is not the same as cheap-when-paused.
  6. Can you get the files out without the product? A tarball you can download is an exit; a proprietary snapshot format is a subscription.

That fifth question is where the bill surprise lives. An agent waiting on a model response is idle from the CPU’s point of view and fully billed from the wall clock’s. Four agents waiting most of the day cost the same as four agents compiling.

For the sixth, a git bundle is the smallest useful answer: one file, no product required to unpack it.

# Inside the sandbox or machine: every branch and tag in one file
git bundle create repo.bundle --all
# On the other side, months later, with nothing but git installed
git clone repo.bundle recovered

Two setups that work

Agency-shaped. One persistent machine per developer, repos cloned once, agents run in worktrees. Untrusted code — a generated script, a dependency you do not know — goes into a local container or a cloud sandbox, and nothing from it is mounted back. Cost is predictable because the machine is one line item.

CI-shaped. Every task gets a fresh sandbox from a prepared image with the dependencies baked in. Nothing carries between tasks, so the cache has to live in the image or in a registry. This scales horizontally and is the right shape for evals and for anything triggered by an event.

The hybrid is the one most people end up with: persistent for the repository the agent lives in, disposable for the code it runs.

Where Cubs fits

Cubs is on the persistent side and does not pretend otherwise: one machine you size once, a disk that survives a pause, and a reset you have to ask for. That suits a repository an agent returns to across days. It is not a sandbox platform for running untrusted code at volume, and if that is the workload, a disposable container is the better tool — run it on the machine, or don’t use the machine at all.

Sources

Third-party documentation, read on the date above. Vendor pages change; check them before quoting anything, including this page.

Questions

Questions

Is an ephemeral sandbox more secure than a persistent VM?
Not necessarily, because the two properties are independent. Isolation strength depends on the boundary underneath — a container sharing the host kernel is a weaker boundary than a microVM with its own kernel, whatever its lifecycle. An ephemeral container is still a container. Lifecycle decides how long a mistake lasts; the boundary decides how easily one happens.
When is a persistent machine the wrong choice?
When the task must start from an identical known state, when the code is untrusted, or when hundreds of short jobs run in parallel. A persistent disk carries yesterday's half-finished install forward, and an agent builds on a broken environment instead of noticing it. Grading, generated-code execution and customer-supplied scripts all want the disposable shape.
Do I have to choose one or the other?
No, and most mature setups do not. A persistent machine for the repositories an agent works on daily, plus a disposable container for running untrusted code, covers both. The mistake is buying a disposable product and then expecting a dev environment, which shows up as a cold start and a reinstall on every run.

Read next

A new home for your agents

A machine that stays on, with your coding agents on it. $25 of credit to start, no card.

Get the download link

Enter your email and we will send the download link when the signed build ships. Open it on a Mac with Apple Silicon.

One message when the build is signed. No newsletter.