TL;DR

Agent Sandbox là một Kubernetes-native open-source project do Google phối hợp cộng đồng K8s phát triển, launch chính thức tại KubeCon NA Atlanta 11/11/2025 và được demo tại Google Cloud Next 2026 với codelab sinh code trên GKE. Nó cung cấp một CRD Sandbox mới dưới SIG Apps để quản lý workload long-running, stateful, singleton — chính là hình dạng tự nhiên của một AI agent runtime.

Điểm quan trọng: nó thay thế cái hack kinh điển StatefulSet size 1 + headless Service + PVC bằng một resource duy nhất, hỗ trợ gVisor/Kata Containers, warm pool sub-second, hibernate/resume, và trên GKE có thêm Pod Snapshots rút cold start từ phút xuống giây.

Kiến trúc Agent Sandbox — orchestrator, executor, controller và warm pool

What’s new

Tại Google Cloud Next, Abdel Sghiouar (DevRel Google Cloud) trình diễn demo code-generation agent trên GKE, sử dụng Agent Sandbox để chạy code do mô hình sinh ra — thứ vốn không đáng tin — trong môi trường cô lập kernel-level. Demo đi kèm codelab chính thức và link thẳng sang repo kubernetes-sigs/agent-sandbox.

Phiên bản mới nhất là v0.4.2, repo đã chạm 1.9k stars, 213 forks, 63 contributors, code chủ yếu Go (59.5%) và Python (34.9% cho SDK). Bài blog chính thức Kubernetes.io (20/3/2026) và Google Cloud Blog đều đã cập nhật chi tiết design.

Why it matters

Agent không phải microservice. Nó là một singleton stateful: mỗi session một sandbox, phải cô lập vì LLM có thể sinh code rm -rf /, có thể idle nhiều giờ rồi bật dậy xử lý 30 giây. Kubernetes sinh ra để chạy Deployment nhiều bản sao hoặc StatefulSet có numbered identity — không fit với agent workload.

Trước Agent Sandbox, team phải tự ghép StatefulSet(replicas=1) + headless Service + PersistentVolumeClaim, không có pause/resume, không có warm pool, không có scheduled deletion. Agent Sandbox chuẩn hoá mô hình này thành một CRD duy nhất để platform engineer không còn phải reinvent.

Quan trọng hơn: vì là Kubernetes-native, bạn không khoá vendor. Cùng YAML chạy được trên GKE, EKS, AKS, Oracle K8s, CoreWeave, bare-metal, OpenShift — khác biệt với E2B/Modal/Cloudflare Sandbox vốn là API proprietary.

Technical facts

Bốn CRD chính thuộc API group agents.x-k8s.io/v1alpha1:

CRDVai trò
SandboxPod đơn với stable hostname, persistent storage, pause/resume, scheduled deletion
SandboxTemplateBlueprint tái sử dụng: image, resource limits, security policies
SandboxClaimTransactional request từ framework (LangChain, Google ADK)
SandboxWarmPoolPool pre-warmed pods, loại bỏ cold start

Isolation backend chọn qua Kubernetes runtimeClassName:

  • gVisor — userspace kernel intercept syscalls, kernel + network isolation, nhẹ
  • Kata Containers — VM nhẹ với dedicated kernel cho từng sandbox, an toàn hơn nhưng cold start cao hơn (bù bằng warm pool)

Benchmark:

  • Pod cold start thường thêm ~1 giây overhead
  • Với SandboxWarmPool: sub-second (<1s), cải thiện tới 90% so với cold start
  • GKE Pod Snapshots (limited preview): checkpoint/restore cả CPU + GPU memory, kéo start time từ minutes xuống seconds
  • Target scale: tens of thousands sandboxes parallel, thousands QPS

SDK Python dùng context manager, bỏ hết YAML cho AI engineer:

from agentic_sandbox import Sandbox

with Sandbox(template_name="python3-template", namespace="ai-agents") as sandbox:
    result = sandbox.run("print('Hello from inside the sandbox!')")

Comparison

Agent Sandbox so với các lựa chọn phổ biến khác:

Tiêu chíAgent SandboxStatefulSet hackManaged (E2B / Modal / Northflank)
Abstraction1 CRD3+ resourcesAPI proprietary
Pause / resumeNativeKhôngVendor-specific
Warm poolNative CRDKhôngVendor-specific
PortableMọi K8s conformantK8sLock vendor
IsolationgVisor + Kata pluggableShared kernelFirecracker / Kata / gVisor

Northflank (managed BYOC platform) cho tham chiếu kinh tế thực tế: end-to-end 1–2 giây, $0.01667/vCPU-hour, $0.00833/GB-hour, đã chạy production từ 2021, scale tới 30k+ users. Agent Sandbox là lớp nền open-source; managed là on-ramp nhanh cho team không muốn tự vận hành cluster.

Use cases

  • Code interpreter / data analysis: short-lived sandbox chạy Python untrusted từ ChatGPT-style tool
  • Coding agents: medium-lived, full dev tooling, agent tự viết-debug-refactor
  • Computer use / agentic browsing: agent điều khiển desktop hoặc browser trong sandbox cô lập
  • Multi-agent systems: stable identity cho agent discovery và peer-to-peer communication
  • CI/CD: isolated testing + automated validation
  • Dev environments & Jupyter notebooks: persistent, network-accessible workspace
  • Single-instance services: build agents, small databases cần stable identity nhưng nhẹ hơn StatefulSet

GKE Pod Snapshots kiến trúc checkpoint và restore sandbox

Limitations & pricing

Agent Sandbox không provision cluster cho bạn. Nó chỉ là controller + CRDs; bạn vẫn phải tự vận hành K8s hoặc dùng GKE/BYOC. Với scale lớn, phải tự tune API QPS + worker counts để tránh throttle.

Quan trọng hơn: sandbox không fix prompt injection hay tool-misuse. OWASP đã xếp “Agent Tool Interaction manipulation” vào top 10 AI threat. Sandbox giảm blast radius của RCE-style exploit (như các sự cố Cursor, Replit, langflow), nhưng không block malicious prompt ở input layer — vẫn cần guardrails + classifier ở tầng trên.

Pricing: project open-source Apache 2.0 miễn phí. Trên GKE không tính extra cho Agent Sandbox ngoài compute bình thường. Pod Snapshots đang ở limited preview, GA cho toàn GKE cuối 2026.

What’s next

Roadmap công khai trên repo hé lộ hướng đi:

  • Cross-sandbox memory sharing trên cùng host (tuỳ runtime)
  • Dual user/sandbox identity + routing không cần per-sandbox Service
  • GKE Pod Snapshots GA cuối 2026 (mở cho toàn customer, không còn preview)
  • API promotion v1alpha1 → beta/stable khi community feedback chín
  • Integration sâu hơn với framework cấp cao: ADK, LangChain, AutoGen qua SandboxClaim

Khi Agent Sandbox chín, kỳ vọng hợp lý là cluster K8s sẽ có một cách chuẩn để chạy agent — tương tự cách Deployment chuẩn hoá stateless workload một thập kỷ trước. Với team đang build agent-based product, đây là primitive đáng test ngay trong staging.

Nguồn: Google Cloud Blog, Google Open Source Blog, Kubernetes.io, InfoQ, GitHub repo.