Back to Microsandbox

Introduction

docs/getting-started/introduction.mdx

0.6.104.3 KB
Original Source

microsandbox is a local-first 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. Start one locally with the msb CLI or an SDK, or run it on microsandbox cloud with an API key. From there, what you do inside the sandbox is up to you.

It keeps the familiar workflow of OCI images and command execution, while moving risky work out of the host process.

<CodeGroup> ```bash npx npx microsandbox run debian ```
bash
curl -fsSL https://install.microsandbox.dev | sh
msb run debian
powershell
irm https://install.microsandbox.dev/windows | iex
msb run debian
</CodeGroup>

Why microsandbox

  • Hardware isolation. Each sandbox is a VM, not a container namespace on the host kernel.
  • Local runtime. The SDK starts the sandbox process directly. No daemon, remote service, or infrastructure setup.
  • Cloud when you want it. The same SDK and CLI run sandboxes on hosted infrastructure; an API key is the only change.
  • Fast startup. Sandboxes are lightweight enough to create from application code.
  • Docker-like inputs. Use familiar OCI images from Docker Hub, GHCR, ECR, GCR, or another registry.
  • Programmable controls. Configure resources, volumes, secrets, networking, and lifecycle from the CLI or SDK.
  • Multi-language SDKs. Rust, TypeScript, Python, and Go expose the same core model.

Example use cases

  • AI agents. Give coding agents and tool-using assistants a dedicated machine for commands, files, package installs, and generated code.
  • User code execution. Run submitted scripts, notebooks, plugins, and extensions away from the host.
  • CI/CD and builds. Isolate test jobs, compilers, package managers, and build tools.
  • Dev environments. Create disposable Linux machines without touching your laptop or host Docker daemon.
  • Scrapers and automation. Allow internet access while blocking private networks and metadata services.
  • Secure tool execution. Run CLIs and dependencies that should not see host secrets or ambient credentials.
<a className="msb-examples-cta" href="/examples/overview"> <span className="msb-examples-cta-icon"><Icon icon="book-open" size={18} /></span> <span className="msb-examples-cta-copy"> <span className="msb-examples-cta-label">Examples</span> <span className="msb-examples-cta-title">See microsandbox in practice</span> <span>Tested workflows for agents, CI/CD, Docker, automation, and more.</span> </span> <span className="msb-examples-cta-action">Browse all <Icon icon="arrow-right" size={12} /></span> </a>

Minimal example

<CodeGroup> ```rust Rust use microsandbox::Sandbox;

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());
python
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()
go
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())
</CodeGroup>

Next steps

<CardGroup cols={2}> <Card title="Quickstart" icon="bolt" href="/getting-started/quickstart"> Install microsandbox and run your first sandbox. </Card> <Card title="microsandbox cloud" icon="cloud" href="/cloud/overview"> Run the same sandboxes on hosted infrastructure. </Card> <Card title="CLI overview" icon="terminal" href="/cli/overview"> Manage sandboxes from the terminal. </Card> <Card title="SDK reference" icon="code" href="/sdk/overview"> Choose a language and look up the API surface. </Card> </CardGroup>