┌─────────────────────────────────────────────────────────────────────────────┐
│ Your Application │
│ │
│ const client = new StateSetSandbox({ │
│ baseUrl: 'https://sandbox.stateset.com', │
│ authToken: 'sk-...' │
│ }); │
│ await client.create(); │
└─────────────────────────────────────────────────────────────────────────────┘
│
│ POST /api/sandbox/create
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ sandbox-controller │
│ │
│ 1. Receives request │
│ 2. Reads SANDBOX_IMAGE from env (ConfigMap) │
│ 3. Calls K8s API to create pod: │
│ ┌──────────────────────────────────────────────────────────────────┐ │
│ │ apiVersion: v1 │ │
│ │ kind: Pod │ │
│ │ metadata: │ │
│ │ name: sandbox-org_xxx-abc123 │ │
│ │ namespace: stateset-sandbox │ │
│ │ spec: │ │
│ │ containers: │ │
│ │ - image: YOUR_REGISTRY/sandbox:latest │ │
│ │ env: │ │
│ │ - name: ANTHROPIC_API_KEY │ │
│ │ valueFrom: secretKeyRef... │ │
│ └──────────────────────────────────────────────────────────────────┘ │
│ 4. Waits for pod to be ready │
│ 5. Returns sandbox_id to caller │
└─────────────────────────────────────────────────────────────────────────────┘
│
▼
┌─────────────────────────────────────────────────────────────────────────────┐
│ Sandbox Pod (ephemeral) │
│ ──────────────────────── │
│ Image: YOUR_REGISTRY/sandbox:latest │
│ │
│ Pre-installed: │
│ • Claude Code CLI (@anthropic-ai/claude-code) │
│ • Node.js 22, Python 3.12, Go 1.22, Rust │
│ • MCP servers (filesystem, github, puppeteer) │
│ • Git, GitHub CLI │
│ │
│ Ready to execute commands via kubectl exec │
└─────────────────────────────────────────────────────────────────────────────┘