Sandbox or VPS: where should your coding agents run?
Developers are arguing about it every day: throwaway sandboxes, or a machine that stays put. Both sides are right about something. Here's how to pick for the work you actually do.
Published
Since mid-October we’ve followed this argument on X every day: more than 230 posts that take a side or give a reason. About four in ten favor a persistent VM or VPS, about one in five favors sandboxes, and a quarter say they use both. The loudest single post is on the sandbox side: “if you’re using persistent VMs with agents you’re doing it wrong” (David Cramer, Sentry, about 107,000 views).
The two options
- A sandbox is a short-lived, isolated machine (often a microVM) that a platform starts for one task and throws away, or snapshots, when it’s done. Examples include E2B, Daytona, Modal, Docker Cloud Sandboxes and Railway’s agent VMs.
- A VPS or persistent VM is a machine that stays yours: same disk, same logins, same tools, day after day. Examples include a Hetzner or DigitalOcean server, a Mac mini at home, or a cloud computer made for agents.
Why people choose a persistent machine
- Logins and setup stay put. “I’ve tried both and prefer the persistent VM; it’s much easier to deal with stuff like config and CLI logins” (Jarrod Watts). On a fresh sandbox, every agent signs in and installs from scratch.
- Agents can see each other’s work. Theo: ephemeral is “good for sandboxes, bad for real work. I love seeing my agents spying on other work in other threads/worktrees” (post).
- It’s always on. Long tasks, nightly loops and agents you check from your phone need a machine that’s still there in the morning. Home servers lose to power cuts and dropped connections, a common reason people give for moving to a hosted machine.
- Cost for steady work. Agents that run most of the day cost less on one machine priced by the month than on sandboxes priced by the hour.
- No rewrite. A project that runs on your laptop runs the same way on a VM. Ephemeral setups need images, setup scripts and a harness first.
Why people choose sandboxes
- Many isolated environments at once. “If your happy with a VPS then stick with it. I need to be able to create a lot of secure environments for agents. I can’t do that with a cheap VPS” (Darren Shepherd). Evals, CI and agent products that serve many users need hundreds of clean machines.
- Persistent machines rot. State piles up until nobody knows why a run worked yesterday. A sandbox starts from a known image every time.
- Security and blast radius. An agent with full permissions in a throwaway box can only damage that box. Keep secrets out, give it one task’s credentials, and delete it afterwards.
- You pay only while it runs. Bursty work, like 50 runs in an hour and nothing overnight, is cheaper on per-second billing.
Pick by workload
| Your situation | Better fit |
|---|---|
| You use Claude Code or Codex every day on your own repos | A persistent machine |
| Tasks run for hours, overnight or on a loop | A persistent machine |
| Several agents work on the same project and share tools and logins | A persistent machine, with a worktree per agent |
| You run hundreds of short jobs: evals, CI, tests of agent output | Sandboxes |
| You run code you don’t trust, or give an agent full permissions on something risky | A sandbox, or a second machine you can throw away |
| You’re building a product that gives each of your users an agent | Sandboxes |
Where it’s converging
The argument is ending in the middle. Most experienced users run a persistent workspace (disk, logins, memory) with compute that can pause, fork or reset:
- one long-lived machine where the agents live, plus disposable environments for the risky or massively parallel jobs;
- or a persistent machine that pauses when idle, so it isn’t billed like an always-on server.
The vendors are moving the same way. E2B’s co-founder posted “Sandboxes are dead… Agents soon will need their whole private clouds”, Archil’s founder argued “sandboxes are on their way out” (post), and Taylor Otwell asked “why mess with worktrees when every thread can get its own computer?” (post).
What to check before you choose
- What survives a pause, a restart or running out of credit? See what each kind of machine keeps.
- What does it cost to leave it on for a month, not per hour?
- Where do your keys and logins live, and who can reach them?
- How long until it’s ready? Setting up a VPS takes an evening; a sandbox or a cloud computer takes minutes.
- Can you reset it to a clean state, or spin up a second one for risky work?
Where Cube fits
Cube sits on the persistent side, without the server work: your own Linux computer in the cloud, ready in about two minutes, with your repos, a worktree per task and every agent session in one place.
- Persistent: logins, tools and files stay on its disk. Closing your laptop never pauses it.
- Pay for what you use: from $12 a month running all the time, or $4 paused, billed per second from credit.
- Isolated from your laptop: agents with full permissions work on the Cube, not on your Mac.
- Not a sandbox platform: if you need hundreds of throwaway environments for evals or a product, use a sandbox service for that part. Many people pair one with a persistent machine.
Questions
Should I run Claude Code on a VPS or in a sandbox?
If your agents work on the same repos every day, run long tasks and need your logins and tools in place, a persistent machine (a VPS or a cloud computer) is simpler. If you need many short, isolated runs that start clean each time, like evals, CI jobs or untrusted code, sandboxes fit better.
Why do people say persistent VMs rot?
A machine that lives for months collects state: packages, config, caches, half-finished experiments. Eventually nobody can say why a run worked yesterday and not today. The fixes are to keep setup in a script or repository, commit work often, and be able to reset the machine to a known state.
Are agent sandboxes cheaper than a VPS?
For short bursts, usually, because you pay only while they run. For agents that run most of the day, an always-on machine is usually cheaper, since sandbox prices are set per hour or per second and add up over a full month.
Sources
- David Cramer (Sentry): "if you're using persistent VMs with agents you're doing it wrong"
- Hunter Leath (Archil): "sandboxes are on their way out"
- Theo: "Good for sandboxes, bad for real work"
- Jarrod Watts: "I've tried both and prefer the persistent VM"
- Darren Shepherd: "I need to be able to create a lot of secure environments for agents"
- Taylor Otwell (Laravel): "every thread can get its own computer"
- Vasek Mlejnsky (E2B): "Sandboxes are dead"