gke-sandboxes
BetaOpen SourceApache-2.0165 starsApache-2.0 TypeScript client and Terraform deployment for per-agent sandboxes on your own GKE cluster: each sandbox is a gVisor pod with snapshot sleep and wake, a warm pool and command and file access.
- Boot rank
- #74 / 119
- 38% of published starts are slower
- Idle billing
- Zero cost while idle
- 347 listings stay free while idle
- State kept on pause
- Disk only
- Resume: 447 ms median start with two sandboxes kept ready; about 2.7 s without one; 3.5 s median wake from a snapshot, slower with many files
Overview
gke-sandboxes is a small, focused deployment of the sandbox-shaped part of GKE: a TypeScript client, a Terraform stack and a few Kubernetes manifests that turn a Google Cloud project into a pool of per-agent workspaces. The isolation choice is explicit — each sandbox is a gVisor pod, so untrusted code gets a user-space kernel rather than the node's, while incoming traffic is blocked and the pod has no cloud credentials. The lifecycle is the interesting half: sleep turns the container's root filesystem into a Cloud Storage snapshot and releases the pod, waking recreates the files in a new pod, and a sweeper sleeps anything unused for five minutes. A warm pool keeps a couple of sandboxes ready so a new session starts in under half a second. It is young — the repository was created on 2026-11-17, the npm package was at 0.3.1 and there were no tagged GitHub releases when this entry was written — although the comparison docs draw their numbers from Energy's production cluster rather than a synthetic test. It comes with the trade-offs of self-hosting: you operate the cluster, capacity and recovery, and pay for machines even between jobs, which is why the README's per-hour estimate assumes hundreds of packed sandboxes. Sleep restores files, not running processes, and wake time grows with file count. Treat it as the reference implementation for running agent sandboxes inside your own GCP boundary rather than a managed service.
Key capabilities
- One gVisor pod per sandbox on your own GKE cluster
- Sleep and wake through filesystem snapshots in Cloud Storage
- Sweeper sleeps sandboxes idle for five minutes
- Warm pool for sub-second starts on a new session
- Command execution with timeouts, streamed output and a memory guard
- File upload and download over the TypeScript client
- Signed, expiring preview links to a sandbox's web server
- Terraform stack with a private network and Cloud NAT
- Sleep restores files only, not running processes
sandbox.ts
import { GkeSandboxes, KubernetesApi } from "@getenergy/gke-sandboxes";
const sandboxes = new GkeSandboxes(new KubernetesApi(clusterUrl, getGoogleAccessToken), {
namespace: "sandboxes",
serviceAccount: "sandbox",
image: "docker.io/library/debian:bookworm-slim",
});
// Creates the sandbox, returns the running one, or wakes it from its snapshot.
const { sandbox } = await sandboxes.acquire("session-42", AbortSignal.timeout(300_000));
const { exitCode, result } = await sandbox.process.executeCommand("echo hello");
await sandboxes.sleep(sandbox.id);Similar alternatives
Technical specifications
- Runtime architecture
- Each sandbox is its own gVisor pod (runsc) on a regional GKE Standard cluster
- Runtime notes
- Any container image with a POSIX shell; the OCI image supplies the userland
- A sleeping sandbox is a filesystem snapshot in Cloud Storage, restored into a new pod
- Terraform creates the cluster, two autoscaling node pools, a private network with Cloud NAT and the snapshot bucket
- Cold-start boot time
- 447 ms median first-shell time with two warm sandboxes ready, about 2.7 s cold, and 3.5 s to wake a small snapshot
- Max vCPU
- 0.25 vCPU requested and 2 vCPU limit by default; configurable per sandbox through resources
- Max memory
- 1 GiB requested and 4 GiB limit by default; configurable per sandbox
- Storage model
- 4 GiB ephemeral storage requested and 20 GiB limit by default; snapshots are stored in a Cloud Storage bucket
- Network isolation
- Network rules allow DNS and outgoing public internet traffic and block incoming pod traffic, and the workload identity metadata endpoint stays blocked. Your backend chooses the sandbox ID after checking the user's access and is trusted to execute commands and read files across its namespace; there is no per-sandbox egress allowlist. Snapshots are written by GKE's own service agent, so a sandbox's identity has no access to the snapshot bucket.
Lifecycle & capabilities
- Filesystem persistence
- Supported
- Memory / disk snapshot
- Supported
- Instant forking
- Not supported
- GPU acceleration
- Not supported
- GUI desktop / VNC
- Not supported
- Mobile / cloud phone
- Not supported
- Browser automation
- Not supported
- Network egress control
- Not supported
- Pause / auto-sleep
- Supported
- MCP protocol server
- Not supported
- REST API & SDKs
- Not supported
- Idle billing
- Zero cost while idle
- State kept on pause
- Disk only
- Resume latency
- 447 ms median start with two sandboxes kept ready; about 2.7 s without one; 3.5 s median wake from a snapshot, slower with many files
- Session limit
- Until deleted. A sweeper sleeps a sandbox after five minutes without use; sleep and checkpoint keep the container's root filesystem, not its processes or mounted volumes
- SDKs
- TypeScript
Pricing model
Pending AuditApache-2.0 and free to deploy; the bill is your Google Cloud project. The README estimates about 1.9 cents per awake hour for a 2 vCPU / 4 GB sandbox, but that figure is a whole-cluster estimate divided across 520 awake sandboxes at 56 to a machine, and it excludes the minimum machines a small cluster still pays for. No rate card is published, so the estimate is Pending audit.