Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
| `crates/spawn-egress` | Network egress policy enforcement |
| `crates/spawn-proto` | Shared protocol definitions |
| `crates/spawn-bench` | Sandbox benchmarks |
| `crates/spawnbox` | Official async Rust SDK (`spawnbox` crate on crates.io) |
| `crates/spawnbox-cli` | CLI client |
| `guest/`, `templates/` | Guest rootfs/kernel setup and sandbox templates |
| `deploy/`, `scripts/` | Deployment manifests and helper scripts |
Expand Down
49 changes: 46 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@

[Website](https://spawnbox.tulipfarm.ai) ·
[Get started](#getting-started) ·
[Rust SDK](#use-the-rust-sdk) ·
[API reference](#api-reference) ·
[Releases](https://github.com/TulipFarm/spawnbox/releases) ·
[How it works](ARCHITECTURE.md) ·
[TulipFarm](https://tulipfarm.ai)

[![License: Apache-2.0](https://img.shields.io/badge/license-Apache--2.0-1d4ed8?style=flat-square)](LICENSE)
[![crates.io](https://img.shields.io/crates/v/spawnbox?style=flat-square&color=1d4ed8)](https://crates.io/crates/spawnbox)
[![Latest release](https://img.shields.io/github/v/release/TulipFarm/spawnbox?style=flat-square&color=1d4ed8&label=release)](https://github.com/TulipFarm/spawnbox/releases)
[![GitHub stars](https://img.shields.io/github/stars/TulipFarm/spawnbox?style=flat-square&color=1d4ed8)](https://github.com/TulipFarm/spawnbox/stargazers)
[![Built with Rust](https://img.shields.io/badge/built_with-Rust-0a1f4d?style=flat-square&logo=rust)](Cargo.toml)
Expand Down Expand Up @@ -93,6 +95,7 @@ come from the suite's published run of 3 Oct 2026 on their own hardware.
- [Features](#features)
- [Getting started](#getting-started)
- [Use the CLI](#use-the-cli)
- [Use the Rust SDK](#use-the-rust-sdk)
- [How to use Spawnbox](#how-to-use-spawnbox)
- [Use more than one host](#use-more-than-one-host)
- [Back up and restore](#back-up-and-restore)
Expand Down Expand Up @@ -137,7 +140,7 @@ These functions operate now:
| Terminals | Open an interactive shell through a WebSocket. |
| Browser sessions | Give a browser a short token for one sandbox. The token opens its terminal and its private preview URLs, without an API key. |
| Git | Clone `https://` repositories. Use a secret for private repositories. |
| Templates | Make your own sandbox image with `setup` and `warmup` commands. Start from the Debian base, which has Node.js 26 and Python 3.15, a container image such as `node:22`, or an image-based `devcontainer.json`. |
| Templates | Make your own sandbox image with `setup` and `warmup` commands. Start from the Debian base, which has Node.js 26 and Python 3.15, a container image such as `node:26-bookworm-slim`, or an image-based `devcontainer.json`. Ready-to-customize examples live in [`templates/examples/`](templates/examples/README.md). |
| Warm pools | Keep VMs ready with paused vCPUs, so that a create takes approximately 8 ms. The pool size follows the number of creates. |
| More than one host | Add worker hosts to one primary host. Clients use only the primary. The primary puts each sandbox on the host that has the most free space. Drain a worker to move its sandboxes to other hosts. Add an edge that sends commands, terminals, files and previews directly to the correct host. |
| Build store | Keep template builds in an S3-compatible object store. Get a build from the store instead of building it again. Build each template on one host only: the other hosts wait and get it from the store. Set a limit for the disk that builds use. On a Firecracker host, start a sandbox before all of its memory is on the host. |
Expand All @@ -156,15 +159,17 @@ These functions operate now:
| Backups | Back up the database and keys each day into one encrypted file, in a directory or S3, and restore them with a check that every secret decrypts. |
| Usage | Measure vCPU, memory, disk and network use for each tenant and sandbox, each hour. |
| CLI | Use the `spawnbox` command for sandboxes, commands, terminals, files, templates, volumes, secrets, tenants, events and usage. |
| Rust SDK | Use the [`spawnbox`](https://crates.io/crates/spawnbox) crate (`SpawnboxClient` and `ForwardClient`) for async Rust applications, with automatic retries, tenant/secret/template helpers, and HTTP/SSE forwarding. |
| Operation | Install with one script as a systemd service. Use HTTPS. Recover after a crash. |

These functions are not available yet:

- TypeScript and Python SDKs and an MCP server
- Disk speed limits

Until the SDKs are available, use the `spawnbox` CLI, or use the HTTP API
with `curl` or a different HTTP client.
For Rust, use the [`spawnbox`](https://crates.io/crates/spawnbox) crate. For
other languages, use the `spawnbox` CLI, or use the HTTP API with `curl` or
a different HTTP client.

## Getting started

Expand Down Expand Up @@ -430,6 +435,43 @@ step 7.
You can also set the server address and the key with the environment
variables `SPAWNBOX_URL` and `SPAWNBOX_API_KEY`.

## Use the Rust SDK

Install the official [`spawnbox`](https://crates.io/crates/spawnbox) crate
from crates.io:

```sh
cargo add spawnbox
```

```rust
use std::time::Duration;
use serde_json::json;
use spawnbox::{ForwardClient, Method, SpawnboxClient};

let client = SpawnboxClient::new("http://127.0.0.1:8080", "sbx_api_key")?;
client.ensure_tenant("default", None).await?;
client
.ensure_template(
"python-data",
&json!({ "name": "python-data", "base": "python:3.12-slim-bookworm" }),
Duration::from_secs(2),
60,
)
.await?;

let sandbox = client.create_sandbox(&json!({ "template": "python-data" })).await?;
let sandbox_id = sandbox["id"].as_str().unwrap();
let result = client.exec(sandbox_id, &json!({ "cmd": ["python3", "--version"] })).await?;

let forward = ForwardClient::new("http://127.0.0.1:8082", Some("fwd_key".into()))?;
let resp = forward.request(Method::GET, sandbox_id, 8000, "/health").send().await?;
```

The `0.1.x` crate targets the Spawnbox `v0.1.x` (`/v1`) API. See
[`crates/spawnbox/README.md`](crates/spawnbox/README.md) and
[docs.rs/spawnbox](https://docs.rs/spawnbox) for details.

## How to use Spawnbox

Type these commands on the host, or on your computer with the SSH tunnel
Expand Down Expand Up @@ -3086,6 +3128,7 @@ hosted service and no paid plan.
## Links

- Website: [spawnbox.tulipfarm.ai](https://spawnbox.tulipfarm.ai)
- Rust SDK: [crates.io/crates/spawnbox](https://crates.io/crates/spawnbox) · [docs.rs/spawnbox](https://docs.rs/spawnbox)
- Source: [github.com/TulipFarm/spawnbox](https://github.com/TulipFarm/spawnbox)
- Releases: [github.com/TulipFarm/spawnbox/releases](https://github.com/TulipFarm/spawnbox/releases)
- Issues: [github.com/TulipFarm/spawnbox/issues](https://github.com/TulipFarm/spawnbox/issues)
Expand Down
Loading