Skip to main content
microsandbox requires glibc-based Linux with KVM, macOS with Apple Silicon (M-series chip), or Windows 11 with Windows Hypervisor Platform enabled. All local backends use hardware virtualization.
Boot a microVM in one command.
npx microsandbox run debian
1

Install microsandbox

Install the SDK for the language you are using, and install the msb CLI for terminal workflows such as managing images, volumes, and sandboxes. Both run microsandbox locally; there is no separate server or daemon to set up.
cargo add microsandbox
npm install microsandbox
pip install microsandbox
go get github.com/superradcompany/microsandbox/sdk/go
curl -fsSL https://install.microsandbox.dev | sh
irm https://install.microsandbox.dev/windows | iex
microsandbox uses hardware virtualization: Linux needs KVM, macOS needs Apple Silicon, and Windows needs Windows Hypervisor Platform. Check your local setup with:
msb doctor
For platform-specific setup notes, see Linux troubleshooting, macOS troubleshooting, or Windows troubleshooting.
2

Run code in a sandbox

Create a sandbox, execute code inside it, and get the result back.
use microsandbox::Sandbox;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let sb = Sandbox::builder("hello")
        .image("python")
        .memory(512)
        .create()
        .await?;

    let output = sb.exec("python", ["-c", "print('Hello from a microVM!')"]).await?;
    println!("{}", output.stdout()?); // Hello from a microVM!

    sb.stop().await?;
    Ok(())
}
import { Sandbox } from "microsandbox";

await using sb = await Sandbox.builder("hello")
    .image("python")
    .memory(512)
    .create();

const output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"]);
console.log(output.stdout()); // Hello from a microVM!
import asyncio
from microsandbox import Sandbox

async def main():
    sb = await Sandbox.create(
        "hello",
        image="python",
        memory=512,
    )

    output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"])
    print(output.stdout_text)  # Hello from a microVM!

    await sb.stop()

asyncio.run(main())
sb, err := m.CreateSandbox(ctx, "hello",
    m.WithImage("python"),
    m.WithMemory(512),
)
if err != nil {
    return err
}
defer sb.Stop(ctx)

output, err := sb.Exec(ctx, "python", []string{"-c", "print('Hello from a microVM!')"})
if err != nil {
    return err
}
fmt.Println(output.Stdout()) // Hello from a microVM!
msb run python -- python3 -c "print('Hello from a microVM!')"

What just happened?

Here’s what happened behind that Sandbox.builder(...).create() call:
  1. Pulled the image from Docker Hub, unless it was already cached.
  2. Assembled a copy-on-write filesystem so changes inside the sandbox do not modify the base image.
  3. Booted a microVM as a child process with the resource limits you configured.
  4. Started the guest agent so the SDK can run commands and move data in and out.
The exec call uses the host-guest command channel, not SSH and not the sandbox network.
Because exec doesn’t go through the network, it works even when a sandbox has networking disabled via .disable_network() and no network interfaces at all.

Next steps