---
title: Overview
"og:title": Microsandbox SDKs for TypeScript, Rust, Python, Go, and Ruby
description: Install a microsandbox SDK, create your first microVM sandbox, and find API references for TypeScript, Rust, Python, Go, and Ruby.
keywords: ["microsandbox SDK", "Python SDK", "TypeScript SDK", "Rust SDK", "Go SDK"]
icon: "play"
---

The SDK runs microsandbox directly from your application. Running locally, creating a sandbox spawns a VM as a child process; there is no daemon to install and no server to connect to. With an API key set, the same SDK runs sandboxes on [microsandbox cloud](/cloud/overview) instead.

## Installation

<CodeGroup>
```bash TypeScript
npm install microsandbox
```

```bash Rust
cargo add microsandbox
```

```bash Python
pip install microsandbox
```

```bash Go
go get github.com/superradcompany/microsandbox/sdk/go
```

```bash Ruby
gem install microsandbox
```
</CodeGroup>

<Accordion title="Provisioning the runtime separately">

All five SDKs can use a separately provisioned runtime. See [Runtime setup](/sdk/setup#bring-your-own-runtime) for code tabs covering each SDK’s packaging and setup requirements.

</Accordion>

## Small example

Create a sandbox from a container image, run a command, print the output, and remove it.

<CodeGroup>
```typescript TypeScript
import { Sandbox } from "microsandbox";

const sb = await Sandbox.builder("hello")
    .image("python")
    .create();

try {
    const output = await sb.exec("python", ["-c", "print('Hello, World!')"]);
    console.log("Output:", output.stdout());
} finally {
    await sb.stop();
    await Sandbox.remove("hello");
}
```

```rust Rust
use std::error::Error;

use microsandbox::Sandbox;

#[tokio::main]
async fn main() -> Result<(), Box<dyn 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?;
    Sandbox::remove("hello").await?;
    Ok(())
}
```

```python Python
import asyncio
from microsandbox import Sandbox

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

    output = await sb.exec("python", ["-c", "print('Hello, World!')"])
    print("Output:", output.stdout_text)

    await sb.stop()
    await Sandbox.remove("hello")

asyncio.run(main())
```

```go Go
package main

import (
    "context"
    "fmt"
    "log"

    m "github.com/superradcompany/microsandbox/sdk/go"
)

func main() {
    if err := run(); err != nil {
        log.Fatal(err)
    }
}

func run() error {
    ctx := context.Background()

    if _, err := m.EnsureRuntime(ctx, m.RuntimeConfig{}, m.InstallOptions{}); err != nil {
        return err
    }

    sb, err := m.CreateSandbox(ctx, "hello", m.WithImage("python"))
    if err != nil {
        return err
    }
    defer func() {
        _ = sb.Stop(context.Background())
        _ = sb.Close()
        _ = m.RemoveSandbox(context.Background(), "hello")
    }()

    out, err := sb.Exec(ctx, "python", []string{"-c", "print('Hello, World!')"})
    if err != nil {
        return err
    }
    fmt.Println("Output:", out.Stdout())
    return nil
}
```

```ruby Ruby
require "microsandbox"

Microsandbox.install unless Microsandbox.installed?

Microsandbox::Sandbox.with("hello", image: "python") do |sandbox|
  output = sandbox.exec("python", ["-c", "print('Hello, World!')"])
  puts "Output: #{output.stdout}"
end
Microsandbox::Sandbox.remove("hello")
```

</CodeGroup>

## Reference

Choose the SDK for your language:

- [TypeScript SDK](/sdk/typescript/sandbox)
- [Rust SDK](/sdk/rust/sandbox)
- [Python SDK](/sdk/python/sandbox)
- [Go SDK](/sdk/go/sandbox)
- [Ruby SDK](/sdk/ruby/sandbox)

For low-level protocol integrations, see the Agent Client references for [TypeScript](/sdk/typescript/agent-client), [Rust](/sdk/rust/agent-client), [Python](/sdk/python/agent-client), and [Go](/sdk/go/agent-client). See also [error handling](/sdk/errors).
