The same sandbox, on any provider

Build one environment. Run it on hosted sandboxes, your own servers or your laptop, and switch on demand.

curl -fsSL https://carton.sh/install | sh
$ carton create py-agent --provider modal
sandbox      sbx_7k2m  running  gvisor amd64
image        pulled  F3 same digest
fingerprint  python 3.12.4 · node 22.11.0
             uid 1000 · /workspace · 41 files
matches on   modal · e2b · daytona · my-mac

The fingerprint lines never change.

Every provider has its own idea of an environment

E2B builds templates. Modal pulls images. Daytona takes snapshots. Your laptop runs Docker. Moving an agent from one to another means rebuilding its machine by hand, and hoping it comes out the same.

carton builds one image from your Dockerfile or devcontainer.json, prepares it for every provider you use, and checks a fingerprint each time a sandbox starts.

Dockerfilecarton buildsha256:9f3c… amd64 + arm64modalpullF3 same digeste2btemplateF2 rebuiltdaytonasnapshotF2 rebuiltmy-macpullF3 same digestfingerprint at bootDockerfilecarton buildsha256:9f3c… amd64 + arm64modalpullF3e2btemplateF2daytonasnapshotF2my-macpullF3fingerprint checked at boot,on every provider

Honest about what can't be identical

The image can match exactly. The machine around it can't: the kernel, the CPU and the provider's own daemons differ. carton tells you how close each provider gets, and records any difference instead of hiding it.

levelwhat runsfor example
F3 same digestthe exact imageModal, Docker, Apple container
F2 rebuiltthe same definition, rebuilt by the providerE2B, Daytona, Firecracker
F1 provisionedthe provider's base image plus a setup scriptproviders without custom images
F0 hostno image; the host, narrowednono, bubblewrap

Need a guarantee? Ask for one: --min-fidelity F2 keeps a sandbox off any provider that can't meet it.

Switch on demand

Name a provider, or say what you need and let carton choose among the providers with a ready build. If one is down, carton tries the next.

$ carton create py-agent --provider e2b
$ carton create py-agent --prefer cheapest --needs pty
$ carton create py-agent --provider modal --fallback e2b
$ carton create py-agent --provider e2b
$ carton create py-agent \
    --prefer cheapest --needs pty
$ carton create py-agent \
    --provider modal --fallback e2b

Switching happens when a sandbox is created. A running sandbox never moves.

Commands and output on this page are examples.

Your machines are providers too

Run carton agent on a laptop, a server or a GPU box. It joins the same pool as your hosted providers and reports its real isolation boundary, so your policy can keep untrusted code off weak sandboxes.

$ carton agent join https://carton.internal
registered  my-mac      apple-container  vm  arm64
registered  gpu-box-01  firecracker      vm  amd64
$ carton agent join https://carton.internal
registered  my-mac      vm  arm64
registered  gpu-box-01  vm  amd64

Agents never see your provider keys

carton holds the keys for every provider account. Agents and CI jobs get carton tokens with limits on how many sandboxes they run, for how long, and at what estimated cost. One inventory covers every account, deadlines work the same way everywhere, and forgotten sandboxes get cleaned up.

$ carton ls
ID        PROVIDER  TOKEN         AGE  EXPIRES  STATE
sbx_7k2m  modal     agent-review  12m  in 48m   running
sbx_q91d  e2b       agent-review  3h   in 2m    running
sbx_r55p  my-mac    ci            1d   expired  orphan, cleaning up

$ carton spend --by token --since 7d
TOKEN         MODAL   E2B     MY-MAC  TOTAL (EST.)
agent-review  $41.20  $18.75  $0.00   $59.95
ci            $6.10   $0.00   $0.00   $6.10
$ carton ls
ID        PROVIDER  EXPIRES  STATE
sbx_7k2m  modal     in 48m   running
sbx_q91d  e2b       in 2m    running
sbx_r55p  my-mac    expired  orphan, reaping

$ carton spend --by token --since 7d
TOKEN         TOTAL (EST.)
agent-review  $59.95
ci            $6.10

Example output. Spend is estimated from what carton ran, and reconciled with the provider's own billing where it offers one.

Use it from anywhere

The CLI, a TypeScript SDK, an MCP server for agents, and a plain HTTP API. Adapters for agent frameworks mean your agent code doesn't change when the provider does.

import { Carton } from "carton";

const carton = new Carton({
  token: process.env.CARTON_TOKEN,
});

const box = await carton.sandboxes.create({
  template: "py-agent",
  provider: "modal",
});

const run = await box.run(["pytest", "-q"]);
await box.destroy();

Works with

providerhow carton prepares your imagebest
Modalpulls the imageF3
Vercel Sandboxpushes to its registryF3
Northflankpulls the imageF3
E2Bbuilds a templateF2
Daytonabuilds a snapshotF2
Runloopbuilds a blueprintF2
Docker, Podmanpulls the imageF3
Apple containerpulls the imageF3
Firecrackerconverts to a rootfsF2
nono, bubblewrapruns a setup script on the hostF0–F1

Something else? Write an adapter: seven operations, in any language. carton's adapter kit handles polling, retries and error mapping.

Open source. Cloud is coming.

Self-hosted

Free and open source. One binary for the server, the CLI and the agent. Your keys stay on your infrastructure.

Install carton

carton Cloud

The same API, hosted. Bring your own provider keys. Join the waitlist and we'll email you when it opens.

Questions

Is carton a sandbox provider?

No. carton runs on top of the providers you already use, and on your own machines. It builds environments for them, places sandboxes on them, and keeps track of what is running.

Do providers have to support carton?

No. carton talks to each provider through its own API, using an adapter. Adding a provider means writing an adapter: seven operations, in any language.

Can a running sandbox move to another provider?

No. Switching happens when you create a sandbox. You can copy files between sandboxes, but running processes and memory stay where they are.

Where do my provider keys live?

In carton, encrypted. Agents and CI jobs get carton tokens, which you can scope, limit and revoke without touching the provider account.

Is it safe to run untrusted code on my laptop?

carton reports the real isolation boundary of every provider: vm, gvisor, container, lsm or namespaces. Your policy decides which code may run where, for example "untrusted code needs a vm".