SubscribeSign In
Agent to Product

Guide

Kubernetes Agent Sandbox, Explained for Teams Giving Every Customer an Agent

The open-source Sandbox resource gives each agent its own isolated, stateful pod. Here is how it works, how it maps to one agent per customer, and which jobs stay on your plate.

Agent to Product Editors · Checked against the sources on

The short answer

  • Agent Sandbox is an open-source Kubernetes project under SIG Apps. It adds a Sandbox custom resource and a controller that manage one long-running, stateful pod with a stable identity and persistent storage: roughly a lightweight VM built from Kubernetes primitives.
  • It is an orchestrator, not an isolation layer. The isolation comes from the runtime you pick (gVisor or Kata Containers, through a RuntimeClass). Without one, a sandbox is an ordinary pod.
  • Its extensions (SandboxTemplate, SandboxWarmPool, SandboxClaim) are what make it usable for one agent per customer: a reusable blueprint, a pool of pre-started sandboxes, and a claim your signup flow creates for each new customer.
  • It fits teams that already run Kubernetes. You still own the cluster, controller upgrades, idle detection, per-customer credentials, network rules and cost attribution.

What Agent Sandbox is

Agent Sandbox lives at kubernetes-sigs/agent-sandbox and is developed under the umbrella of Kubernetes SIG Apps, under the Apache-2.0 license. Its core is a Sandbox Custom Resource Definition (CRD) and a controller that manages a single, stateful pod for each Sandbox you create.

The project exists because none of Kubernetes' built-in workloads fit an agent runtime well. Deployments assume stateless, interchangeable replicas. StatefulSets assume a numbered set of pods. An agent that belongs to one customer needs one pod that keeps its name, its network identity and its files across restarts. The project's README notes that you can approximate this with a StatefulSet of size 1, a Service and a PersistentVolumeClaim, and calls that approach cumbersome and short on lifecycle features like hibernation.

What each Sandbox gives you, per the project:

  • Stable identity: a stable hostname and network identity for the pod.
  • Persistent storage: volumes that survive restarts.
  • Lifecycle management: the controller handles creation, scheduled deletion, pausing and resuming.

The project names AI agent runtimes that execute untrusted, LLM-generated code as a main use case, next to development environments, notebooks, reinforcement-learning evaluation loops and single-pod services.

Isolation comes from the runtime, not the CRD

The README is explicit about scope: Agent Sandbox is a sandbox orchestrator. It delegates low-level isolation to secure sandbox runtimes such as gVisor or Kata Containers, which a pod selects through its runtimeClassName. That choice is what puts a kernel boundary between one customer's agent and the node, and so between one customer and the next.

Google's GKE documentation says the same thing in plainer terms: if you don't specify a sandbox runtime, your pods run without kernel isolation, so don't use them to run untrusted code. For a product where every customer's agent runs code the model wrote, the runtime is not optional. This site's piece on how shared agent runtimes leak context covers why that boundary matters once agents touch customer data.

The four resources, and what each one does

The core install gives you Sandbox. The extensions add three more resources that build on it. The GKE install guide uses the standard manifest, which installs all four.

ResourceAPI groupWhat it does
Sandboxagents.x-k8s.ioOne stateful pod with a stable hostname, network identity and optional persistent storage. The unit everything else creates.
SandboxTemplateextensions.agents.x-k8s.ioA reusable blueprint: the pod spec (image, runtime class, limits, security settings) every customer's sandbox starts from.
SandboxWarmPoolextensions.agents.x-k8s.ioKeeps a set number of sandboxes from a template running and ready, so a new customer doesn't wait for image pulls and pod startup.
SandboxClaimextensions.agents.x-k8s.ioA request for a sandbox. The controller hands the claim a ready sandbox from the pool, or creates one from the template when none is ready.

The claim is the piece that matters for a product. It separates "this customer needs an agent" from how and where that agent is provisioned, so your application asks for a sandbox without managing pods or storage directly.

How it maps to one agent per customer

If your product gives each customer their own agent, the resources line up with the customer lifecycle like this:

  1. Define the agent once as a SandboxTemplate: the agent image, the gVisor or Kata runtime class, CPU and memory limits, and the security context.
  2. Keep a warm pool sized to your signup rate, so most new customers are handed a sandbox that is already running.
  3. Create a `SandboxClaim` at signup, from the same webhook that creates the customer's account. That is the provisioning step this site's guide to wiring provisioning into your signup webhook walks through; the claim name becomes the customer's agent ID.
  4. Suspend when idle and resume on return. On GKE you set the Sandbox's spec.operatingMode to Suspended; the controller deletes the pod but keeps the Sandbox and its persistent volumes. Setting it back to Running resumes it.
  5. Delete the claim when the customer leaves, and decide what happens to their volumes first (see teardown and cleanup flows).

Your application doesn't have to write YAML for each customer. The project ships a Go SDK (sigs.k8s.io/agent-sandbox/clients/go/sandbox) and a Python SDK (pip install k8s-agent-sandbox); Google's docs describe the Python SDK creating the SandboxClaim for you against a warm pool you define. A TypeScript SDK is listed as in progress on the project roadmap.

Agent Sandbox on GKE: what Google adds

Agent Sandbox runs on any conformant cluster that meets its version requirements, and Google documents it as "Agent Sandbox on GKE". On GKE you still install the open-source controller yourself, and Google states that you are responsible for upgrading it. What GKE adds around it:

  • GKE Sandbox runtimes: gVisor or microVMs for kernel isolation. Autopilot clusters enable gVisor automatically; on Standard clusters you create a node pool with gVisor enabled.
  • Pod snapshots: save and restore a sandbox's full state, so a suspended agent can come back with what was in memory. Google lists GKE 1.35.3-gke.1234000 or later as the requirement, gVisor only (not microVMs), and no E2 machine types.
  • Default-deny networking from templates: for each SandboxTemplate, the controller creates a NetworkPolicy that blocks access to internal networks and the GKE control plane. Sandboxes you create directly, without a template, get no NetworkPolicy; you write your own.
  • A recommended admission policy: Google publishes a ValidatingAdmissionPolicy that rejects sandboxes that don't run under gVisor, run as root, keep Linux capabilities, mount the service-account token or lack CPU and memory limits.
  • Warm pools at under a second: Google's docs say warm pools typically provide a pod in less than one second.

One caveat in Google's own docs: for most agent workloads Google now points to Agent Substrate on GKE, which it says can run more agents on the same nodes, and recommends Agent Sandbox when each agent needs a dedicated pod, GPUs or TPUs, a full Kubernetes PodSpec, or an Autopilot cluster. If you are choosing on GKE, read Google's architecture planning page for agent workloads before you commit.

Agent Sandbox itself costs nothing extra. GKE pricing applies to the cluster and the compute your sandboxes and the controller use; check GKE's pricing page for current rates in your region.

A minimal install

From the project README: the controller requires Kubernetes 1.25 or later with CRD CEL validation enabled, and 1.29 or later is recommended. Pin a version for production rather than installing latest; check the releases page for the current one.

export VERSION="<release tag from the releases page>"
kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/${VERSION}/sandbox-with-extensions.yaml

# Check it is there
kubectl get crd sandboxes.agents.x-k8s.io
kubectl get deploy agent-sandbox-controller -n agent-sandbox-system
Install the controller with its extensions, pinned to a release
apiVersion: agents.x-k8s.io/v1beta1
kind: Sandbox
metadata:
  name: my-sandbox
spec:
  podTemplate:
    spec:
      containers:
      - name: my-container
        image: <IMAGE>
The smallest Sandbox, from the README (add a runtimeClassName before running untrusted code)

Two warnings from the docs before you build on it. Uninstalling deletes the CRDs, which cascade-deletes every Sandbox, template, claim and warm pool in every namespace. And version 1.0.0 removed the old v1alpha1 API, so clusters on an earlier release must migrate to v1beta1 before upgrading.

What you still run yourself

Agent Sandbox standardizes the per-agent pod. It doesn't turn a cluster into a product. When the agent belongs to a paying customer, these jobs stay with your team:

  • The cluster and the controller. Node pools, the sandbox runtime, Kubernetes upgrades, and controller upgrades on the project's release cadence.
  • Deciding when an agent is idle. Google's docs state that Agent Sandbox on GKE doesn't detect idle agents; your application decides when to suspend. Automatic suspend and resume is listed as planned on the project roadmap. This site's piece on idle agent cost control covers the policy side.
  • Per-customer credentials. The sandbox isolates compute and files. The OAuth tokens your agent uses for each customer's Gmail, Slack or GitHub still need their own storage, refresh and revocation; see OAuth credential management for hundreds of agent users. Associating a pod's identity with the user who made the claim is listed as planned on the roadmap.
  • Egress rules per customer. Template-level default-deny is a start; attaching network policies at claim time is a roadmap item, so per-customer allowlists are yours to build today.
  • Cost per customer. Kubernetes bills you for nodes, not for customers. Mapping pod usage back to the account that generated it, for pricing and margin, is your work (see per-user agent cost breakdown).
  • Health and stuck sessions. The controller exports Prometheus metrics about sandboxes and claims; knowing whether a customer's agent is making progress is a separate signal you define.

Agent Sandbox compared with a managed per-user agent platform

The real decision for most teams is whether to run this layer at all. Here is how the self-run Kubernetes route compares with a platform that hosts one isolated agent per user for you, such as Agent37, whose Cloud API creates an isolated, persistent per-user sandbox with one API call.

Agent Sandbox on your clusterManaged per-user agent platform
Who runs the infrastructureYou: cluster, node pools, runtime, controllerThe platform
IsolationgVisor or Kata, if you set the runtime class; plain pods otherwiseSet by the platform; check its security documentation
Provisioning a customer's agentCreate a SandboxClaim (directly or through the Go or Python SDK)One API call to the platform
Startup timeDepends on your warm pool and nodes; Google cites under a second with warm pools on GKECheck the platform's documentation
Idle suspend and resumeYou set operatingMode; idle detection is yoursCheck what the platform does by default
UpgradesYou apply each controller release and migrate APIsThe platform
CostFree software; you pay for the cluster and compute (see your cloud's pricing page)The platform's price; see its pricing page
Best fitTeams already operating Kubernetes who want the primitive inside their own cluster, or need GPUs, TPUs or a full PodSpecTeams that want each customer to have an agent without running a cluster

For the longer argument on both sides, read managed cloud hosting built for agents versus Kubernetes you operate yourself and what product teams give up when they self-host agents. If you want hosted microVM sandboxes without running the cluster, the site's guide to E2B sandboxes covers the same jobs on E2B.

Is Agent Sandbox the right call for you?

It is a good fit when most of these are true:

  • You already run production Kubernetes and have someone who owns it.
  • Your agents need a full PodSpec, GPUs or TPUs, or must stay inside your own cloud account.
  • You are prepared to build idle detection, per-customer credentials, egress policy and cost attribution on top.
  • You can track a young project that ships releases often and still lists core features, such as auto suspend, as planned.

If most of those are false, and the goal is that every customer has a working agent the moment they sign up, a managed per-user platform will usually get you there with less to operate. Either way, the requirements are the same ones laid out in what persistent per-customer context requires from your provisioning layer.

Sources

  1. kubernetes-sigs/agent-sandbox README
  2. Agent Sandbox roadmap
  3. Agent Sandbox releases
  4. About Agent Sandbox on GKE (Google Cloud)
  5. Install Agent Sandbox on GKE (Google Cloud)
  6. GKE pricing

Related reading