> ## 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.

# Overview

> Install the SDK and create your first sandbox

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

<CodeGroup>
  ```bash Rust theme={null}
  cargo add microsandbox
  ```

  ```bash TypeScript theme={null}
  npm install microsandbox
  ```

  ```bash Python theme={null}
  pip install microsandbox
  ```

  ```bash Go theme={null}
  go get github.com/superradcompany/microsandbox/sdk/go
  ```
</CodeGroup>

## Small example

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

<CodeGroup>
  ```rust Rust theme={null}
  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(())
  }
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "microsandbox";

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

  const output = await sb.exec("python", ["-c", "print('Hello, World!')"]);
  console.log("Output:", output.stdout());
  ```

  ```python Python theme={null}
  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()

  asyncio.run(main())
  ```

  ```go Go theme={null}
  package main

  import (
      "context"
      "fmt"
      "log"

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

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

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

## Reference

Choose the SDK for your language:

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

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