Documentation Index
Fetch the complete documentation index at: https://docs.microsandbox.dev/llms.txt
Use this file to discover all available pages before exploring further.
The SDK embeds the microsandbox runtime directly into whatever application uses it. Sandbox.builder(name).create() spawns the VM as a child process. No daemon to install, no server to connect to.
Installation
Quick start
Create a sandbox from a container image, run a command, print the output, and stop it.
use microsandbox::{Sandbox, NetworkPolicy};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let sb = Sandbox::builder("my-sandbox")
.image("python")
.memory(512)
.cpus(2)
.env("PYTHONDONTWRITEBYTECODE", "1")
.volume("/app/src", |v| v.bind("./src").readonly())
.network(|n| n.policy(NetworkPolicy::public_only()))
.create()
.await?;
let output = sb.exec("python", ["-c", "print('Hello, World!')"]).await?;
println!("{}", output.stdout()?);
sb.stop().await?;
Ok(())
}
The SDK reference is split by language - choose Rust SDK, TypeScript SDK, Python SDK, or Go SDK for the full API. See also error handling.