Skip to content

TypeScript Reference

A simple sandbox API on Chainguard Workspaces, shaped like the E2B, Vercel Sandbox and Modal Sandbox SDKs: create a sandbox, run commands, move files in and out, delete it.

import { Sandbox } from "chainguard-sandbox-sdk";
await using sbx = await Sandbox.create({ packages: ["python-3.13"] });
const r = await sbx.commands.run("python3 -c 'print(2+2)'");
console.log(r.stdout); // 4
await sbx.files.write("data/input.txt", "hello");

A sandbox is a Workspaces session created from an empty workspace with an environment document listing your packages. Commands run one at a time per sandbox; there are no exposed ports. Durations are in milliseconds.