Safe Code Execution

Run untrusted code in its own machine.

Run user- or AI-generated code inside a microVM with its own kernel and outbound network switched off or allowlisted, and a disk that is wiped when the machine is deleted. Built for code you have every reason not to trust.

warm create
~2 s
warm create
exec median (SDK)
~155 ms
exec median (SDK)
kernel per exec
1
kernel per exec
egress policy
allow / deny
egress policy
The problem

Regular containers share one kernel.

A standard container runs on the host’s kernel next to everyone else’s. That shared kernel is an escape route you patch forever instead of removing. Running code you didn’t write, from a user or a model, right beside your own workload is a bet that eventually goes wrong.

  • Kernel isolation

    Shared kernel = shared blast radius

    One container escape reaches the host and its neighbours. A microVM has its own kernel, so there is nothing next door to escape into.

  • Secret handling

    Secrets leak through the filesystem

    A token written into the guest is a token the code can read. Injecting it at the edge keeps it out of the guest entirely.

  • Data deletion

    Deletion you have to trust

    A deleted machine’s disk is wiped: its blocks are zeroed before the space is reused. Persistent volumes are encrypted with their own key, and erasing one destroys that key.

How it works

A fresh, locked-down machine per run.

Boot in about two seconds, run the code behind its own kernel, take the result, and leave nothing behind.

interpreter.tsUntrusted input, contained
const key = () => crypto.randomUUID();
const rev = async (id) => (await sandal.sandboxes.get(id)).revision;
const { sandbox, operation } = await sandal.sandboxes.create({
idempotencyKey: key(), kind: "container", size: "xs",
templateId, templateDigest, architecture, lifecycle: { expiresAt },
networkPolicy: { allowInternet: false }, // reaches nothing
});
await sandal.sandboxes.waitForOperation(operation.id);
const run = await sandal.processes.execAndWait(sandbox.id, {
idempotencyKey: key(), command: ["sh", "-c", untrustedCode],
expectedSandboxRevision: await rev(sandbox.id),
});
// delete: the disk is wiped before reuse
await sandal.sandboxes.delete(sandbox.id, {
idempotencyKey: key(), expectedRevision: await rev(sandbox.id),
});
  1. 01

    Start with no access

    Create the microVM with outbound network off and its own isolated stack. It can reach nothing, not the host, not another customer, not the internet.

  2. 02

    Run the code

    Execute the untrusted code against its own kernel. The worst case is a wasted machine, not a compromised host or a leaked secret.

  3. 03

    Take the result

    Read stdout, stderr and the exit code, or pull a file off the disk. Outbound access opens only for the specific hosts you allow.

  4. 04

    Leave nothing behind

    Delete the machine and its disk is wiped before the space is reused. Erase any persistent volume you attached, and its encryption key is destroyed.

Capabilities

Isolation that doesn’t depend on the guest.

  • 01

    A kernel per run

    Hardware-isolated microVMs, each with its own kernel, not a shared-kernel container.

  • 02

    Network off, or allowlisted

    Switch outbound access off, or list the exact domains and CIDRs the code may reach.

  • 03

    Secrets stay outside

    Brokered keys are injected only into HTTPS requests to the hosts you allow, so a token is never a file the running code can read (preview, on hosts with an enrolled broker).

  • 04

    Wiped on delete

    Each run’s disk is zeroed before reuse; persistent volumes carry their own encryption key, destroyed when you erase them.

  • 05

    Fast starts

    A small sandbox comes from the warm pool in about 2 s, and repeated commands on one SDK handle return in about 150–160 ms (median).

  • 06

    Per-second billing

    A 400ms execution bills 400ms, no minimum, no per-invocation fee.

Built on Sandal

The products that power it.

Safe execution runs on the same microVM core as the rest of the platform.

Live desktop stream
CodeFileEditSelectionViewGoTerminalWindowHelpWed 16:45
agent.py · sandbox
Explorersandboxagent.pybrowser.pyvision.pytestsREADME.md

1from sandal import Sandbox

2

3# boot a desktop the agent can see

4vm = Sandbox.create(desktop=True)

5vm.screenshot("before.png")

6

7vm.click(x=412, y=280)

8vm.type("hello from the agent")

9vm.key("cmd+s")

10

11# read the screen back

12frame = vm.stream.latest()

13assert frame.contains("Saved")

zsh, sandal

➜ sandbox python3 agent.py

connecting to the desktop…

✓ computer use ready

screenshot → before.png

click(412, 280) · type · cmd+s

✓ saved

➜ sandbox

60fps
Get started

Run the code you didn’t write.

A sealed microVM per execution, gone on release.

Private beta · request access