Skip to content

Go · Python · TypeScript · Rust

Simple Chainguard Sandbox SDK

Create a sandbox on Chainguard Workspaces, run commands in it, move files in and out, and delete it. It's the same workflow as Vercel Sandbox, E2B or Modal, in Go, Python, TypeScript and Rust.

with Sandbox.create(
packages=["bash", "coreutils", "python-3.13"],
# instance="XXXXXX", # your organization ID; overrides $CHAINCTL_SANDBOX_INSTANCE and auto-detection
) as sbx: # deleted on exit
result = sbx.commands.run("""python3 -c "print('hello from', __import__('platform').node())" """)
print(result.stdout, end="")
sbx.files.write("notes/hello.txt", "hi")
print(sbx.files.read("notes/hello.txt"))
Language Import In chainguard-sandbox-sdk
Go github.com/sandboxing-dev/chainguard-sandbox-sdk/go/sandbox go/
Python from chainguard_sandbox import Sandbox python/ (distribution chainguard-sandbox-sdk)
TypeScript (Node.js, Bun) import { Sandbox } from "chainguard-sandbox-sdk" typescript/
Rust use chainguard_sandbox::Sandbox; rust/ (crate chainguard-sandbox-sdk)

Sandboxes With Your Toolchain

A Linux microVM (4 vCPU, 16 GB RAM) with the packages you list: Python, Node.js, Go, Bun and more. You’re root in /work. Sandboxes →

Commands

Shell strings or argv, with cwd, env, stdin, timeouts and live output. Background commands give you a handle to wait, poll and kill. Commands →

Files

Read, write (batched, any size), list, stat, move and remove. Upload and download files and whole directories. Files →

Network Control

An egress allowlist that is enforced (verified), on top of an always-on block of cloud metadata, loopback and private ranges. Environments →

Pause and Resume

A paused sandbox is a memory and disk snapshot; its processes continue on the next call. Lifecycle →

Login and Organization

A browser login once, saved and refreshed. Your organization is detected automatically when you have one. Authentication →

Workspaces is built for long-lived developer sessions, not for spinning up thousands of short-lived sandboxes. The main constraints:

  • One sandbox per user at a time (a Workspaces beta limit).
  • One command at a time per sandbox; use background commands for concurrency.
  • No exposed ports or public URLs.
  • No custom container images: you get a package list.
  • No hard timeout: idle sandboxes park on their own.

Limits and differences has the full list, and Coming from Vercel, E2B or Modal maps their APIs to this one.