Skip to main content
The SDK embeds the microsandbox runtime directly into your application. Creating a sandbox spawns a local VM as a child process; there is no daemon to install and no server to connect to.

Installation

cargo add microsandbox

Small example

Create a sandbox from a container image, run a command, print the output, and stop it.
use microsandbox::Sandbox;

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

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

    sb.stop().await?;
    Ok(())
}

Reference

Choose the SDK for your language: For low-level protocol integrations, see the Agent Client references for Rust, TypeScript, Python, and Go. See also error handling.