Architecture

One substrate, many doors, bare-metal microVMs with their own kernels, a host agent that fences every guest command, and disk generations as the durability floor.


The substrate#

Every Linux sandbox, VM, runner, and Android device Sandal runs comes from the same substrate: bare-metal Linux machines running virtual machines. Every sandbox gets its own Firecracker or Cloud Hypervisor microVM with its own kernel; no kernel is shared with other tenants' guests. macOS VMs run on Apple silicon Macs, each leased to one customer at a time; iOS simulators, macOS runners and the Xcode builds API are not available yet.

We use two hypervisors depending on the job:

  • Firecracker for sandboxes and the code interpreter: a minimal device model built for many small, hostile-tenant VMs per host.
  • Cloud Hypervisor for full Linux VMs and desktops, which want more devices than Firecracker's minimal model exposes. Linux GitHub Actions runners run in Firecracker microVMs; Windows and arm64 runners (preview) run in rented VMs, one per job.

Different doors, same substrate: the scheduler, the image format, the network fencing, and the billing meter are shared. A runner and a sandal.sandboxes.create(...) call are provisioned by the same control plane, routed to different VMM backends.

Host agent + privileged split#

Every physical host runs a small host agent as the only privileged process. The host agent is the sole thing on the box permitted to:

  • launch or tear down a VMM process,
  • attach a TAP device / network namespace to a guest,
  • mount or unmount a disk generation's block device,
  • create or erase a persistent volume's encryption key.

Nothing else on the host (not the VMM, not the guest, not the API layer) holds those privileges. The agent inside the guest runs without host privileges and talks to the host agent over a narrow, versioned control channel. That channel is the trust boundary between code nobody reviewed, running on someone's behalf, and the thing that could touch other tenants' data.

Signed, fenced commands#

Nothing reaches a guest, and nothing a guest does reaches the host, without going through signed, fenced command paths:

  • Every control-plane instruction to a host (create, stop, fork, recover, delete) is a signed command tied to a specific VM identity. Replaying an old command against a rebuilt VM with the same name fails closed.
  • Guest-originated actions that need a privileged host operation (expose a port, take a snapshot) are checked against the workload's live grant before the host agent acts, not just authenticated once at connection time.
  • Commands carry a fence token per VM generation. A command stamped for generation N is rejected once the VM has moved to generation N+1.

The same idea shows up in the public API as revisions: every mutation carries the expectedRevision / expectedSandboxRevision it was based on, and a stale one is rejected with 409 revision_conflict instead of silently winning a race.

Durable operations#

Every lifecycle mutation is recorded as a durable operation before anything happens on a host. The API answers 202 with the operation; the work proceeds even if your client disconnects, and retrying with the same idempotency key returns the same operation instead of starting a second one. This is what makes create, fork and delete safe to retry from an agent that crashed halfway through.

Disk generations: durable#

A sandbox's disk is not a single mutable blob on one host. It is a chain of generations. Persistent volumes are encrypted with their own key; on the default template a sandbox's /workspace volume has its own key too, destroyed when the sandbox is deleted; the rest of a sandbox's own disk is not encrypted with a per-sandbox key, and it is wiped (blocks zeroed before reuse) when the sandbox is deleted.

  • Object storage is the durability floor. Snapshots, archives and forks are built from generations that live off-host, so a host failure doesn't take the data with it.
  • Local NVMe is the accelerator, not the store. Hosts cache recently used generations locally so start, recover and fork are faster, but that cache is disposable.
  • Snapshots and forks are generation operations, not raw disk copies. sandboxes.createSnapshot seals the current state; sandboxes.fork starts a new sandbox from it (copy-on-write).

Measured on the beta deployment at size s: snapshot 7-11 s, fork 10-15 s. Snapshots and forks are disk-level: running processes are not carried over. Pause/resume keeps memory and running processes on the same sandbox (pause about 0.7-1 s, resume about 1-2.5 s). There are no memory snapshots: stop/start keeps the disk, not memory.

The guest agent and the held-stream transport#

Inside every guest, an unprivileged agent is the only thing the host agent talks to. It turns processes.exec, files.write and sandboxes.exposePort calls into actual work inside the VM.

The transport between host agent and guest agent is a held stream: one long-lived, multiplexed channel for the life of the VM instead of a new connection per call. Commands are framed and fenced individually even though they share a transport, so a long-lived stream never becomes a long-lived trust grant.

One substrate, many doors#

DoorBackendWhat's different
Sandboxes (TypeScript, Python, Go SDKs; CLI)FirecrackerGeneral-purpose exec/files/ports, per-second billing
GitHub Actions runnersCloud HypervisorJIT-registered, runs-on: label swap
Full Linux VMsCloud Hypervisorsystemd, a full Linux userland
Android devices (preview)Bare-metal Linux hostsInteractive device sessions
macOS VMsApple silicon Macs, one customer per MacUp to 2 VMs per leased Mac
iOS SimulatorsApple silicon Macs that run only simulatorsInteractive simulator sessions, apps, logs
macOS runners (not available yet)Apple silicon MacsComing
Code interpreterFirecracker (inside a sandbox)Stateful contexts, rich results

Same scheduler, same generation format, same host agent, same fencing. New doors get added by pointing a new API surface at the existing substrate.

Evidence-gated capability matrix#

Every capability ships behind a qualification run against the real substrate. GET /sandbox-capabilities (or sandal capabilities) shows what your project has enabled; features that aren't qualified yet answer 422 capability_unavailable rather than half-working. Numbers in these docs come from measured runs on the beta deployment. If a number looks wrong, tell us at hello@sandal.dev.

Regions#

Sandal runs in the EU only today, on hosts in Germany, Finland and Luxembourg. There is no US region and no region choice in the API during the private beta. Sandal has no compliance certification (such as SOC 2) yet; see Security for the threat model and current status.