Getting Started
BoxLite
BoxLite is a local-first micro-VM sandbox — no cloud account needed. See BoxLite docs for platform requirements (KVM on Linux, Apple Silicon on macOS).
Prerequisites
Section titled “Prerequisites”@boxlite-ai/boxliteinstalled (requires KVM or Apple Hypervisor)- Docker (to build the base image)
ANTHROPIC_API_KEYorOPENAI_API_KEY
Base image
Section titled “Base image”Build a Docker image with Sandbox Agent pre-installed, then export it as an OCI layout that BoxLite can load directly (BoxLite has its own image store separate from Docker):
FROM node:22-bookworm-slimRUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*RUN curl -fsSL https://releases.rivet.dev/sandbox-agent/0.4.x/install.sh | shRUN sandbox-agent install-agent claudeRUN sandbox-agent install-agent codexdocker build -t sandbox-agent-boxlite .mkdir -p oci-imagedocker save sandbox-agent-boxlite | tar -xf - -C oci-imageTypeScript example
Section titled “TypeScript example”import { SimpleBox } from "@boxlite-ai/boxlite";import { SandboxAgent } from "sandbox-agent";
const env: Record<string, string> = {};if (process.env.ANTHROPIC_API_KEY) env.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;if (process.env.OPENAI_API_KEY) env.OPENAI_API_KEY = process.env.OPENAI_API_KEY;
const box = new SimpleBox({ rootfsPath: "./oci-image", env, ports: [{ hostPort: 3000, guestPort: 3000 }], diskSizeGb: 4,});
await box.exec("sh", "-c", "nohup sandbox-agent server --no-token --host 0.0.0.0 --port 3000 >/tmp/sandbox-agent.log 2>&1 &");
const baseUrl = "http://localhost:3000";const sdk = await SandboxAgent.connect({ baseUrl });
const session = await sdk.createSession({ agent: "claude" });const off = session.onEvent((event) => { console.log(event.sender, event.payload);});
await session.prompt([{ type: "text", text: "Summarize this repository" }]);off();
await box.stop();