WASM Sandbox
WASM sandboxes run guest modules inside isolated worker processes on the host. They boot quickly, share the same toolbox and routing model as Docker sandboxes, and support optional checkpoint durability for daemon restarts and cluster failover.
Create a WASM sandbox
Section titled “Create a WASM sandbox”Pass runtime: "wasm" and a module_ref. The simplest module_ref is a
standard-module keyword your operator has staged on every node — e.g.
"python" or "javascript" — so you never reference a host path. A
module_ref can also be an oci:// registry ref (for your own modules, see
WASM modules) or, for self-managed hosts, a file path. Set
durability to passivatable or durable when you need restart survival.
import { MicroVM } from '@aerol-ai/aerolvm-sdk'
const client = new MicroVM({ apiUrl: process.env.SB_API_URL, patToken: process.env.SB_PAT_TOKEN,})
const sandbox = await client.create({ module_ref: 'python', runtime: 'wasm', cpu: 0.5, memoryMB: 256, durability: 'passivatable',})
console.log(sandbox.id)from microvm import MicroVM
client = MicroVM( api_url='https://sandbox.example.com', pat_token='your-token',)
sandbox = client.create({ 'module_ref': 'python', 'runtime': 'wasm', 'cpu': 0.5, 'memoryMB': 256, 'durability': 'passivatable',})
print(sandbox.id)import ( "context" "fmt" "log"
"github.com/aerol-ai/microvm/pkg/microvm" "github.com/aerol-ai/microvm/pkg/types")
client, err := microvm.New(microvm.Config{ APIURL: "https://sandbox.example.com", PATToken: "your-token",})if err != nil { log.Fatal(err)}
sb, err := client.Create(context.Background(), types.CreateSandboxRequest{ ModuleRef: "python", Runtime: types.RuntimeWasm, CPU: 0.5, MemoryMB: 256, Durability: types.DurabilityPassivatable,})if err != nil { log.Fatal(err)}fmt.Println(sb.ID)use aerolvm_sdk::{Client, CreateSandboxRequest};
#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Client::new("https://sandbox.example.com", "your-token")?; let sandbox = client .create(CreateSandboxRequest { module_ref: Some("python".into()), runtime: Some("wasm".into()), cpu: Some(0.5), memory_mb: Some(256), durability: Some("passivatable".into()), ..Default::default() }) .await?; println!("{}", sandbox.id); Ok(())}import ai.aerol.microvm.MicroVM;import ai.aerol.microvm.model.CreateSandboxRequest;
public class WasmExample { public static void main(String[] args) throws Exception { MicroVM client = new MicroVM("https://sandbox.example.com", "your-token"); CreateSandboxRequest req = new CreateSandboxRequest(); req.setModuleRef("python"); req.setRuntime("wasm"); req.setCpu(0.5); req.setMemoryMB(256); req.setDurability("passivatable"); var sandbox = client.create(req); System.out.println(sandbox.getId()); }}Durability
Section titled “Durability”durability is the same cross-runtime create field documented under
Durability and Failover — WASM just defaults to
ephemeral (worker processes die with the daemon) instead of passivatable,
and is the only runtime that currently implements durable. The values below
describe how WASM backs each class:
| Class | Behavior |
|---|---|
ephemeral | Default for WASM. Lost on daemon restart. |
passivatable | Checkpointed to local mem.snap on drain; rehydrates on start. |
durable | Local checkpoint plus AOCR push for cross-node failover. |
See also
Section titled “See also”- WASM networking —
expose_port, custom domains, and host-mediated HTTP ingress - WASM modules — catalogue and warm pool
- WASM architecture — worker model and checkpoints