🚀 Announcing Agent Sandbox v1.0.13!
Agent Sandbox v1.0.13 is now available. This release makes Sandbox PodScheduled and Finished conditions persistent, strengthens Sandbox, SandboxClaim, and SandboxWarmPool reconciliation against deletion and adoption races, hardens sandbox-router startup validation when migrating from the legacy Python router, adds PID 1 orphan reaping and graceful shutdown signaling for Execute commands in sandboxd, expands interactive process, metrics, and cleanup capabilities across the Go, Python, and TypeScript SDKs, and adds a Harbor evaluation integration along with Claude and OpenAI Managed Agents examples.
⚠️ Action Required
- Persistent
PodScheduledandFinishedstatus conditions (#2142):- The
SandboxPodScheduledcondition is no longer removed when no backing Pod exists or after expiry. It now reportsstatus: Falsewith reasonPodAbsentwhen no owned Pod exists andstatus: Falsewith reasonSandboxExpiredafter expiry. Clients inspectingPodScheduledmust check itsstatusfield rather than condition presence. - The
Finishedcondition onSandboxandSandboxClaimstays absent until a backing Pod first reachesSucceededorFailed, and is no longer removed once set (transitioning tostatus: Falsewith reasonNotFinishedif a later or replacement Pod has not finished). BecauseFinished=Trueis now preserved while aSandboxis suspended,ttlSecondsAfterFinishedon itsSandboxClaimcontinues running during suspension and can delete the finishedSandboxand its PVCs. Sandboxes suspended before upgrading already hadFinishedremoved, so upgrading does not start their TTL. - Deleting or evicting a running
Sandbox's Pod through the Kubernetes API (such as viakubectl drain) no longer setsFinished=True, startsttlSecondsAfterFinished, or incrementsagent_sandbox_finished_total.
- The
sandbox-routerstartup validation forROUTER_AUTH_TOKEN(#2448):- The Go
sandbox-routerdoes not authenticate requests using the legacy Python router'sROUTER_AUTH_TOKENenvironment variable and now refuses to start ifROUTER_AUTH_TOKENis set to a non-empty value while--authz-modeisallow-all(the default) ortokenreviewwithout--authz-tokenreview-require-token. - Before upgrading, either unset
ROUTER_AUTH_TOKENor switch to--authz-mode=scoped-tokenor--authz-mode=tokenreviewwith--authz-tokenreview-require-token, and issue clients credentials matching that authorization mode.
- The Go
Highlights
Core & Extension Controllers
- Persistent
PodScheduledandFinishedconditions (#2142):SandboxReconcilernow keepsPodScheduledalways present (False/PodAbsentwhen no owned Pod exists,False/SandboxExpiredafter expiry) and keepsFinishedpersistent once set—retaining it across suspension, Pod termination, and Pod lookup failures, and avoiding marking aSandboxfinished on API-driven Pod deletion or eviction—whileSandboxClaimReconcilerpreserves its mirroredFinishedcondition instead of removing it. - Prevent re-adoption during orphan deletes (#2212):
SandboxReconcilernow reads theSandboxdirectly from the Kubernetes API server (APIReader) before adopting an unowned Pod, Service, or PVC, skipping adoption if theSandboxis deleted, deleting, or replaced by a new UID. - Replace deleted bound
SandboxonSandboxClaim(#2390):SandboxClaimReconcilerconfirms cachedNotFoundresults for the status-recordedSandboxagainst the API server before clearing the stalestatus.sandboxbinding and adopting or creating a replacementSandbox, preventing claims from stayingReady=Truewith a deletedSandbox'sserviceFQDN. - Protect adopted
SandboxWarmPoolmembers from deletion (#2415):SandboxWarmPoolReconcilernow deletes pool-ownedSandboxresources withUIDandResourceVersionpreconditions during scale-down, stuck-sandbox cleanup, andRecreatestale cleanup, skipping409 Conflictresponses so sandboxes concurrently adopted by aSandboxClaimare preserved. - Consistent
EnvVarsInjectionRejectedclaim reporting (#2442):SandboxClaimrejections for overriding a template variable under theAllowedpolicy or targeting acontainerNamemissing from the template now wrapErrEnvVarsInjectionRejectedand reportReady=Falsewith reasonEnvVarsInjectionRejectedinstead of retrying withReconcilerError. Edit or recreate theSandboxClaimto recover.
Sandbox Router
- Fail closed when
ROUTER_AUTH_TOKENis set without token-requiring authz (#2448):Config.Validaterejects configurations with a non-emptyROUTER_AUTH_TOKENunder--authz-mode=allow-allor--authz-mode=tokenreviewwithout--authz-tokenreview-require-token. - Separate client cancellations from upstream errors (#2352): Requests canceled by the caller are now counted in
sandbox_router_upstream_errors_totalwithreason="client_canceled"and logged atV(1)instead ofreason="other"with an error-level log. Plain HTTP responses still return status502(with detail"The client canceled the request"), and gRPC callers still receivecodes.Canceled.
sandboxd
- Orphan process reaping as PID 1 (#2419): When running as PID 1,
sandboxdnow runs a background reaper triggered bySIGCHLDand a 10-second periodic rescan (using Linux/proc/<pid>/task/<tid>/children) to reap exited orphaned grandchildren without interfering with directly managed child processes. - Signal
Executecommands on daemon shutdown (#2434): On shutdown (ShutdownProcesses),sandboxdnow signals all active child processes started via gRPCExecuteandExecuteWithLimits(in addition to streamingStart) withSIGTERM, followed bySIGKILLafter 2 seconds or--shutdown-timeout(whichever is shorter), instead of leaving them running until the server force-stops. - Keep command leader unreaped until cleanup finishes (#2369):
sandboxdnow waits for command leader exit viawaitid(..., WEXITED|WNOWAIT)and delayscmd.Wait()until process-tree termination and cancel cleanup complete, avoiding signaling an unrelated process that reused the leader's PID. - Preserve file permissions on REST overwrite (#2451): REST
PUT /v1/files/{path}now keeps an existing file's permission bits when overwriting without an explicitmodequery parameter instead of resetting them to0644. New files still default to0644. - Map
ENOTDIRtoNOT_FOUNDandINVALID_ARGUMENTin gRPC handlers (#2328): gRPCWatchDirand processExecute/ExecuteWithLimits/Startnow returnNOT_FOUNDinstead ofINTERNALwhen a parent path component is a non-directory (such as a regular file), andExecute/ExecuteWithLimits/StartreturnINVALID_ARGUMENTwhencwditself is not a directory.
SDKs
- Go SDK:
- Added
ProcessHandle.WriteStdin()andProcessHandle.CloseStdin()to send serialized stdin chunks (up to 1 MiB per RPC) and EOF to streaming processes started withCommands.Start()(#2358). - Added
WithPTY(cols, rows)forCommands.Start()andProcessHandle.ResizeTTY(ctx, cols, rows)with dimensions in[1, 65535];Commands.Run()rejectsWithPTYwith gRPCcodes.InvalidArgument(#2374). - For the
sandboxdruntime, addedFiles.Stat()andSandbox.Stat()(calling RESTGET /v1/files/{path}?stat=trueand returning*FileEntry) and updatedFiles.Read()andFiles.ReadTo()to sendtype=fileso reading a directory returns a409 HTTPErrorinstead of a JSON directory listing (reading the sandbox root"/"or"."continues to fail locally before making a request) (#2294). - Added
Options.WaitForTermination(defaultfalse) soSandbox.Close()deletes theSandboxClaimwith foreground propagation pinned to its UID and waits for the claim to disappear (sharingCleanupTimeout; requiresgetpermission onSandboxClaims), and updatedClient.DeleteAll()andClient.EnableAutoCleanup()to close tracked sandboxes concurrently (#2325).
- Added
- Python SDK:
- Added opt-in
enable_auto_cleanup()(must be called from the main thread) to bothSandboxClient(sync) andAsyncSandboxClient(async) to delete tracked sandboxes onSIGTERM(with a 10-second cutoff, keeping claims explicitly named increate_sandbox()just likeatexitcleanup) without overriding existing custom or ignoredSIGTERMhandlers (#2428). - Guarded claim deletion in both sync (
K8sHelper.delete_sandbox_claim()) and async (AsyncK8sHelper.delete_sandbox_claim()) helpers to return early for empty strings or invalid DNS-1123 subdomain names (such as"."or".."), preventing accidental deletion of allSandboxClaims in the namespace (#2468). - Fixed
AsyncFileWatcher.watch()(async only) to cancel its gRPCWatchDirstream in afinallyblock on generator close or error (callers retaining the generator or needing deterministic cleanup should callawait gen.aclose()) so early exits do not exhaustsandboxd's 64-watch limit (#2482). - Updated both sync and async
files.read()/files.read_to()to sendtype=file(#2346) andfiles.list()to sendtype=directory(#2469) on thesandboxdruntime so mismatched path types fail with HTTP409instead of returning a directory listing or downloading a file into an error message. - Updated sync
SandboxClient.create_sandbox()to catchBaseExceptionduring claim creation, readiness wait, and handle construction soKeyboardInterruptorSystemExitrolls back a generatedSandboxClaim(analogous toAsyncSandboxClientrolling back onasyncio.CancelledError) (#2438). - Switched label, environment variable name, and
router_namespacevalidators tore.fullmatchso trailing newlines are rejected (#2377).
- Added opt-in
- TypeScript SDK:
- Added optional OpenTelemetry latency histograms in seconds (
sandbox.client.discovery.latency,sandbox.client.suspend.latency,sandbox.client.resume.latency, rendered by the OTel Prometheus exporter assandbox_client_{discovery,suspend,resume}_latency_seconds) across connection establishment,suspend(), andresume(), degrading to no-ops when@opentelemetry/apior aMeterProvideris absent (#2333). - Guarded
SandboxClient.deleteSandbox()to return early for empty or invalid DNS-1123 subdomain claim names (such as".","..", or the emptyclaimNameon handles returned bygetSandboxByName()), preventing namespace-wide claim deletion (#2468). - Fixed buffered REST response body reads to cancel the stream reader directly when the caller's
AbortSignalaborts, preventing hangs on Node 22 after response headers arrive (#2362).
- Added optional OpenTelemetry latency histograms in seconds (
- Integrations (
clients/integrations/):- Added
clients/integrations/harbor(k8s_agent_sandbox_harbor:AgentSandboxEnvironment), a Harbor evaluation environment that manages per-imageSandboxTemplate/SandboxWarmPoolpairs, creates and deletes per-trialSandboxClaims viaAsyncSandboxClient, runs commands and tar transfers over the pod exec API, and providespython -m k8s_agent_sandbox_harbor cleanup(#2125). - Added the
get_sandbox_healthtool toclients/integrations/mcp-server, wrappingAsyncSandbox.health()(GET /v1/healthonsandboxd) and returninghealthy: falseon HTTP503(#2354). - Excluded
openhands-sdk==1.63.0inclients/integrations/openhands/pyproject.tomlto avoid an upstream import error (#2353).
- Added
Examples
- Managed Agents bridges (
examples/managed-agents/): Addedexamples/managed-agents/claude-managed-agents(#2314) andexamples/managed-agents/openai-managed-agents(#2357) demonstrating self-hosted sandbox execution bridged toSandboxWarmPool,SandboxClaim, and suspend/resume with workspace PVC retention, includingcma-runner/oma-runnercontainer images and kind test scripts. - OpenClaw per-sandbox gateway tokens: Updated
examples/openclaw-fleet-gkeandexamples/openclaw-kata-aks-sandboxmanifests to generate a random gateway token per sandbox at startup (persisted in the workspace inexamples/openclaw-fleet-gke) instead of using a static token (#2404), and added token checks toexamples/openclaw-fleet-gke/run-test-gke.sh(#2421). - Scoped RBAC in
examples/ray-integration/direct-proxy(#2403): Bound claim-management RBAC to a dedicatedray-sandbox-managerServiceAccount on Ray head and worker Pods and setautomountServiceAccountToken: falseon theSandboxTemplate. - VS Code example fixes (
examples/vscode-sandbox) (#2413): Raised ephemeral storage requests and limits to8Gi, enabled--auth=passwordinentrypoint.sh, fixedoverlays/kata-mshv/patch-kata.yamlto patch individual fields without dropping container settings, and updatedscripts/apply.shandREADME.mdto deploy the Gosandbox-router. - Warm-pool autoscaling consolidation (
examples/keda-scale-to-zero) (#2464, #2479): Switched the HPA example to anAverageValuetarget (0.05) with namespace label matching (#2464) and foldedexamples/hpa-swp-scalingintoexamples/keda-scale-to-zerowith environment-configurable load script settings (#2479). - Other example updates:
- Passed
namespace="gymnasium"inexamples/agent-sandbox-gymnasium/jupyter/rl_training.ipynband-n gymnasiuminexamples/agent-sandbox-gymnasium/README.md(#2454). - Updated
examples/hermes-agents-as-a-service/10-sandboxtemplate.yamlto allow bothamd64andarm64nodes via node affinity (#2437). - Installed
libatomic1inexamples/playwright-sandbox/Dockerfile(#2425) and bumpedmcpto1.30.0inexamples/router-scoped-mcp-sandbox/Dockerfile(#2446). - Added
examples/sandbox-headlamp-plugin/README.mdpointing to the upstream Headlamp plugin setup guide (#1723, #2430) and removedexamples/nemoclaw-sandbox(#2402).
- Passed
Documentation & CI
- Go 1.27.4 toolchain and dependency updates (#2388, #2367): Updated the Go toolchain and container builder images across the controller,
sandboxd,sandbox-router, and examples to Go1.27.4for stdlib and toolchain security fixes (#2388), refreshed Go modules (including Kubernetesv0.37.2andcontroller-runtimev0.25.3), and movedexamples/python-runtime-sandboxand the legacy Pythonsandbox-routerimages topython:3.15-slim(#2367). - v1.0 API migration guide (
docs/api-migration-guide.md) (#2124): Added instructions for rewriting stalev1alpha1owner references (including on terminating resources), restartingkube-controller-managerto rebuild the garbage collector graph, verifying foreground deletion, and replacing installed CRDs withkubectl replacewhen upgrading fromv0.5.x. - Go
sandbox-routerwalkthroughs (#2423, #2455): Updatedexamples/quickstart/README.md,site/content/docs/getting_started/install_prerequisites/_index.md, andexamples/ci-runner-sandbox/README.mdto document deploying the Gosandbox-routerfromsandbox-router/deploy/with a release tag. - OLM bundle and release tooling (#2449, #2363, #2356): Updated the OLM operator bundle manifests to
1.0.12(#2449), improveddev/tools/generate-release-notesto ground generated release notes in per-commit diffs and release signals (#2363), and updated the release-notes Gemini model default togemini-4-neon(#2356).
Installation
Standard Install (Core + Extensions)
Recommended for most users and GitOps engines (Argo CD, Config Sync, kustomize):
kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v1.0.13/sandbox-with-extensions.yamlSelective Install
Install components separately:
# Core only:
kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v1.0.13/sandbox.yaml
# Extensions (opt-in):
kubectl apply -f https://github.com/kubernetes-sigs/agent-sandbox/releases/download/v1.0.13/extensions.yamlPython SDK
pip install k8s-agent-sandbox==1.0.13Contributors
We extend our sincere thanks to all contributors to this release:
@HasonoCell, @Heman10x-NGU, @MichaelChene, @Sean-790761, @aditya-shantanu, @aminbaa, @dongjiang1989, @ericcurtin, @hakman, @iluv7, @janetkuo, @lunarwhite, @payallenka, @pbxqdown, @rmalani-nv, @shrutiyam-glitch, @sidtuladhar, @tatavartilikhitha, @tomergee, @vincent0426, @wjun29, @yankovitchg
New Contributors
- @payallenka made their first contribution in #2377
- @iluv7 made their first contribution in #2374
- @yankovitchg made their first contribution in #2390
- @MichaelChene made their first contribution in #2413
- @sidtuladhar made their first contribution in #2437
- @Heman10x-NGU made their first contribution in #2442
- @tatavartilikhitha made their first contribution in #2459
Full Changelog: v1.0.12...v1.0.13