How Many Kubernetes Sandboxes Should Stay Warm?
Measure time from SandboxClaim submission to verified application readiness on the selected RuntimeClass. Replay burst sizes against each warm-pool size and price the smallest pool that meets your latency target under those measurements.
Price readiness using the runtime you will deploy
The Agent Sandbox warm-pool example ties a SandboxWarmPool and user-facing SandboxClaims to a SandboxTemplate. A useful benchmark starts at claim submission and ends when a small probe returns the expected response through the application path. Keep the image, resource requests, persistent storage setup, and runtime fixed across warm and cold trials. Time both paths under representative bursts and record whether each request consumed a prestarted sandbox. A fast claim followed by a slow storage attach or probe belongs in the startup measurement. Price each additional ready slot using its measured incremental reservation or billing cost. If your node bill changes only when a new node is needed, run the estimate at each node-count step and compare the actual bills for the candidate pool sizes.
agent-sandbox/examples/warmpool-quickstart at v1.0.11 · kubernetes-sigs/agent-sandbox · GitHubCheck policy enforcement during the readiness window
Kubernetes NetworkPolicy enforcement depends on the network plugin, and a new pod can temporarily have isolation applied before allow rules are ready. In a staging namespace, send a benign request to a test service that should be reachable and to another test service that should be blocked. Use the scheduled sandbox pod, confirm its expected RuntimeClass, and keep a timestamped record through the first successful allowed response. A blocked-path success fails the isolation check even if the next attempt is blocked. An allowed-path timeout extends the measured startup interval and warrants inspecting policy, DNS, and service readiness. Keep the two results distinct in the rollout record. If warm claims are fast but fail the isolation check, revisit the template and enforcement before using their latency to choose the pool size.
Network Policies | KubernetesSeparate Orchestration from Isolation
Agent Sandbox is a Sandbox CRD and controller for Kubernetes under SIG Apps, and it explicitly delegates low-level container isolation to sandbox runtimes such as gVisor or Kata Containers through RuntimeClass. That means naming an object Sandbox does not harden it; the isolation comes from the runtime installed on your nodes and selected in the pod template. Keep the service that requests sandboxes outside the environment running untrusted code.
RuntimeClass itself only selects a container runtime configuration; the CRI implementation must first be configured on nodes. Kubernetes docs also note RuntimeClass assumes homogeneous node configuration by default, so any node running a Kata or gVisor workload must actually have that runtime ready. Plan the boundary before you write templates, because a YAML field cannot install a runtime or add hardware features a node lacks.
GitHub - kubernetes-sigs/agent-sandbox: agent-sandbox enables easy management of isolated, stateful, singleton workloads, ideal for use cases like AI agent runtimes and reinforcement learning (RL). · GitHubProve One Workload Before Scaling
Start on a disposable cluster. The v1.0.11 quickstart defaults to a KIND cluster without container isolation and tells you to branch to gVisor or Kata if you want stronger isolation, so treat the default as a fast functional loop, not a security posture. Its stated prerequisites include Docker 20.10 or later, kubectl 1.28 or later, KIND 0.20 or later, Python 3.9 or later, and Git; image references for the sandbox router are set through environment variables in the walkthrough.
Define your success signal as the full task path, not a successful create call: dependencies install, an output file is written, a test runs, and the result is retrieved. Separately confirm the backing pod uses the intended runtime class, then deliberately exceed a CPU or memory limit and interrupt a session mid-task. Record both handling paths before raising concurrency, since controller readiness and application readiness are distinct checks.
agent-sandbox/examples/quickstart at v1.0.11 · kubernetes-sigs/agent-sandbox · GitHubDecide Whether You Need a Warm Pool
Three extension CRDs support pooled allocation. SandboxTemplate is the admin-owned blueprint, SandboxWarmPool pre-warms N sandboxes to avoid cold-start costs, and SandboxClaim is the user-facing request that adopts a sandbox from the pool. The reference template carries persistent storage through volumeClaimTemplates. If your agent sessions need files across several tool calls with fast starts, the warm-pool path matches that need; if sessions are rare or short, a direct sandbox may be simpler to operate and reason about.
The warm-pool examples also show hardened patterns worth copying deliberately: a secure template with a gVisor runtime and tight NetworkPolicy using DNS-only egress with ingress locked to the Istio ingress gateway, plus an LLM template granting access to a private endpoint via hostAliases and a scoped egress policy. These are reference YAML, not guarantees for your cluster; you still confirm that your networking plugin enforces the policies.
agent-sandbox/examples/warmpool-quickstart at v1.0.11 · kubernetes-sigs/agent-sandbox · GitHubTreat Network Policy as a Timing Risk
NetworkPolicy requires a network plugin that supports enforcement. A Kubernetes note warns that when a new NetworkPolicy object is created, the plugin may take time to handle it, and a pod created before that handling completes may start unprotected until the rules apply. For agent code, that gap matters: a compromised process could reach an endpoint before egress restrictions take effect.
Mitigate by applying policy before creating the sandbox, waiting for enforcement to converge, and keeping credentials out of the sandbox except what the current task needs. Test with an actual egress attempt to a disallowed host rather than assuming the policy object suffices. Sandbox isolation and network policy are complementary: neither substitutes for resource limits or least-privilege identities. For a comparison of runtime approaches, evaluate gVisor for ordinary Linux processes and Kata for a dedicated guest kernel, then verify the selected backend's requirements on your actual node type.
Network Policies | KubernetesSources
- agent-sandbox/examples/warmpool-quickstart at v1.0.11 · kubernetes-sigs/agent-sandbox · GitHub
- Network Policies | Kubernetes
- GitHub - kubernetes-sigs/agent-sandbox: agent-sandbox enables easy management of isolated, stateful, singleton workloads, ideal for use cases like AI agent runtimes and reinforcement learning (RL). · GitHub
- agent-sandbox/examples/quickstart at v1.0.11 · kubernetes-sigs/agent-sandbox · GitHub