Skip to content
FossShelf
Home / Categories / For Cloud Engineers

Agent Sandbox

Kubernetes sandboxes for AI agents and untrusted code

Replaces —

4.63K starsApache-2.0last commit 13 Nov 2026
Screenshot of Agent Sandbox

Who it's for

AI code interpreter

A platform running an LLM-based code assistant creates a short-lived sandbox per session via SandboxClaim, executes user-submitted Python or shell commands inside gVisor isolation, streams stdout back to the client, and terminates the sandbox on session end — all through the Python SDK in a few lines.

Autonomous coding agent

An autonomous agent that writes, debugs, and refactors code needs a persistent environment with a full dev toolchain. Agent Sandbox provides a medium-lived sandbox with stable hostname, persistent storage, and a Kata Containers runtime for hardware-level isolation between tenants.

The agent runs only stateless, ephemeral tasks with no need for persistent storage or a stable identity.

RL and evaluation pipelines

Reinforcement learning frameworks like Ray or RLlib and benchmarks like SWE-bench need high-throughput, low-latency isolated environments. A SandboxWarmPool keeps dozens of pre-warmed sandboxes ready; evaluation workers claim one per episode and return it to the pool on completion.

Workloads are fully stateless and can run in standard Kubernetes Pods without a stable identity or warm-pool claim latency requirements.

Computer use AI agent

An agent that drives a graphical desktop or browser on behalf of a user needs an isolated environment with a full GUI stack. Agent Sandbox runs a medium-lived sandbox with a desktop image and gVisor or Kata Containers isolation, preventing host compromise if the agent is manipulated.

The problem

Kubernetes provides Deployments for stateless replicated workloads and StatefulSets for numbered stable pods, but neither fits the pattern of AI agent runtimes: a single, stateful, isolated container that must execute untrusted LLM-generated code, persist state across restarts, and be claimed quickly from a pool. Approximating this with a size-1 StatefulSet plus a Service and PVC is cumbersome, lacks hibernation support, and provides no standardized API for switching between isolation backends like gVisor or Kata Containers.

How it works

Sandbox CRD with stable identity

Each Sandbox gets a stable hostname and network identity, persistent storage that survives restarts, and lifecycle management including creation, pausing, resuming, and scheduled deletion — all through a declarative Kubernetes API.

Warm pool for low-latency claims

SandboxWarmPool maintains a pool of pre-warmed sandboxes. When a SandboxClaim is created, it adopts an already-running sandbox from the pool, eliminating cold-start delay for latency-sensitive workloads like RL evaluation loops.

Pluggable isolation backends

The orchestration layer is fully decoupled from isolation technology via Kubernetes RuntimeClass. gVisor intercepts system calls in userspace; Kata Containers provides a dedicated kernel per sandbox via QEMU. Switching backends requires no changes to the Sandbox API.

Python and Go SDKs

Official SDKs let agents create sandboxes, run commands, and clean up in a few lines. The Python package is `k8s-agent-sandbox`; the Go module is `sigs.k8s.io/agent-sandbox/clients/go/sandbox`. Both support warm pool claims and automatic cleanup via defer/finally patterns.

Sandbox Router for proxied access

An optional HTTP reverse proxy routes traffic from SDKs and external clients to sandbox pods, useful when runtime environments like Kata Containers or gVisor make direct pod port-forwarding unavailable.

Reusable templates

SandboxTemplate defines a reusable configuration blueprint. SandboxWarmPool references a template, making it straightforward to manage large fleets of similarly configured sandboxes without repeating pod spec details.

Features

  • Sandbox CRD with stable identity
  • Warm pool for low-latency claims
  • Pluggable isolation backends
  • Python and Go SDKs
  • Sandbox Router for proxied access
  • Reusable templates

How to install

kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/latest/download/sandbox-with-extensions.yaml

Recommended for this setup

Strengths

  • Purpose-built for agentic workloads: The CRD design targets AI agent runtimes, RL evaluation, and code interpreters specifically — use cases that StatefulSets and Deployments handle poorly. Lifecycle features like hibernation and automatic resume on network connection are designed for these patterns.
  • Strong isolation without vendor lock-in: Decoupling sandbox orchestration from isolation runtime means teams can choose gVisor for syscall interception or Kata Containers for hardware-level VM isolation, and switch later without rewriting application code or Sandbox manifests.
  • Kubernetes-native and ecosystem-compatible: Agent Sandbox is a Kubernetes SIG Apps project, ships as standard CRDs and a controller, and integrates with existing RBAC, namespaces, PersistentVolumes, and RuntimeClass resources. No external control plane is required.
  • Warm pools reduce claim latency at scale: Pre-warmed sandbox pools allow high-throughput workloads — such as SWE-bench evaluation or CI pipelines — to claim a ready sandbox with minimal latency rather than waiting for pod scheduling and image pull on every request.

Trade-offs

  • Requires an existing Kubernetes cluster: Agent Sandbox is a Kubernetes controller and cannot run standalone. Teams without an existing cluster need to provision one before deployment; there is no hosted or managed Agent Sandbox service.
  • Isolation backends must be separately installed: gVisor and Kata Containers are not bundled with Agent Sandbox. Each requires its own installation and a compatible Kubernetes node configuration before RuntimeClass-based isolation is available.
  • Project is in active development: The CRD API version is `v1beta1` and several roadmap items — deep hibernation with state archiving, memory sharing across sandboxes, and dual user/sandbox identities — are not yet implemented. Production adopters should review the roadmap before committing.

Tech stack

Languages
Go, Python, TypeScript, Shell, HTML, JavaScript, SCSS, Makefile, CSS, Go Template, Dockerfile
Frameworks
—
Databases
—
Tooling
Kubernetes

FAQ

How is Agent Sandbox different from a standard Kubernetes Pod or StatefulSet?

A StatefulSet manages numbered, replicated pods with indexed storage. Agent Sandbox's Sandbox CRD targets singleton workloads — one container, stable hostname, persistent storage, and lifecycle operations like hibernation and automatic resume on network connection — that StatefulSets were not designed for.

Which isolation runtimes are supported?

Agent Sandbox currently supports gVisor (userspace kernel that intercepts system calls) and Kata Containers (hardware virtualization with a dedicated kernel per sandbox via QEMU). Both are configured via Kubernetes RuntimeClass and must be installed separately on cluster nodes.

How do I install Agent Sandbox?

Apply the combined manifest with `kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/latest/download/sandbox-with-extensions.yaml`. For production, pin to a specific release version. Core and extensions can also be installed separately.

What are warm pools and when should I use them?

A SandboxWarmPool keeps a configurable number of pre-warmed sandboxes running. When a SandboxClaim is created, it adopts one of these ready sandboxes instead of waiting for pod scheduling and image pull. Use warm pools for latency-sensitive workloads like RL evaluation loops or interactive coding agents.

Is there SDK support for languages other than Go and Python?

Official SDKs currently exist for Go (`sigs.k8s.io/agent-sandbox/clients/go/sandbox`) and Python (`k8s-agent-sandbox`). Other languages can interact with sandboxes directly via the Kubernetes API or through the optional Sandbox Router HTTP proxy.

Similar tools

More in Cloud Engineers