docs/getting-started/introduction.mdx
microsandbox is a local microVM runtime for untrusted workloads: AI agents, user code, plugins, package installs, CI jobs, dev environments, scrapers, and automation.
Each sandbox is a lightweight VM with its own Linux kernel, filesystem, and network boundary. Your app or the msb CLI starts it locally, talks to it through a host-guest command channel, and controls what it can access.
It keeps the familiar workflow of OCI images and command execution, while moving risky work out of the host process.
<Tip> Boot a microVM in one command.npx microsandbox run debian
Instead of putting real credentials inside the VM, microsandbox injects placeholders and swaps them for real values only when traffic goes to an allowed host. Code inside the sandbox can run freely without ever receiving the secret value itself.
All sandbox traffic flows through a host-side network stack. You can allow public internet access, block private networks, publish ports, deny by default, pin DNS behavior, or inspect TLS traffic without relying on guest cooperation.
Use OCI images for disposable roots, bind mounts for host data, named volumes for persistent state, tmpfs for scratch space, and snapshots when you want to reuse prepared sandbox state.
let sb = Sandbox::builder("hello") .image("python") .create() .await?;
let output = sb.exec("python", ["-c", "print('Hello from a microVM!')"]).await?; println!("{}", output.stdout()?);
sb.stop().await?;
```typescript TypeScript
import { Sandbox } from "microsandbox";
await using sb = await Sandbox.builder("hello")
.image("python")
.create();
const output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"]);
console.log(output.stdout());
from microsandbox import Sandbox
sb = await Sandbox.create("hello", image="python")
output = await sb.exec("python", ["-c", "print('Hello from a microVM!')"])
print(output.stdout_text)
await sb.stop()
sb, err := m.CreateSandbox(ctx, "hello", m.WithImage("python"))
if err != nil {
return err
}
defer sb.Stop(ctx)
out, err := sb.Exec(ctx, "python", []string{"-c", "print('Hello from a microVM!')"})
if err != nil {
return err
}
fmt.Println(out.Stdout())