Components
Quick deploy
The chart package includes a step-by-step runbook (AGENT-SANDBOX-PREREQUISITE.md) and ready-to-adapt manifests in its agent-sandbox/ folder. In short:
- Create two namespaces:
agent-sandbox-system(controller) andagent-sandbox(router and sandboxes). - Install the upstream controller Helm chart with
controller.extensions=true. - Create the runtime image pull secret, then apply
agent-sandbox/python-sandbox-template.yaml(adapt image tag, node placement, and egress to your cluster). - Apply
agent-sandbox/router.yaml, andagent-sandbox/network-policy.yamlif your CNI enforces NetworkPolicies.agent-sandbox/warm-pool.yamloptionally keeps pre-provisioned sandboxes ready. - Enable the feature in your values and upgrade:
Bring your own sandbox template
TheSandboxTemplate is yours to define. The shipped template is a hardened reference (no service account token, dropped capabilities, managed egress policy), but you can substitute your own isolation approach, for example gVisor or Kata runtime classes, or a dedicated tainted node pool. The platform only requires that the template runs a compatible runtime image and matches the configured agentSandbox.templateName and agentSandbox.namespace.
Bring your own sandbox image
The runtime image defines which Python libraries sandboxed code can import. The shipped image bundles a curated set:requests, pandas, and pydantic. To make additional libraries available (for example beautifulsoup4 for HTML parsing), build a custom image and point the SandboxTemplate at it. The platform never references the image directly, only the template by name, so swapping the image is a template change: no Helm upgrade or platform restart is involved.
Extend the shipped image
The supported approach is to layer extra libraries on top of the published image. Python dependencies live in/app/deps, exposed through PYTHONPATH; install extras into a second directory and append it:
- Pin the base tag to the deployed platform version, and rebuild the extension image on every platform upgrade.
- The base image is
python:3.13-slim-trixiewith/bin/shand the Debian coreutils, which the shell server tool relies on. Hardening comes from the non-root user (uid 65532), the read-only root filesystem, and the sandbox network policy, not from the absence of a shell. - The base image already switches to uid 65532, so a
pip installin the final stage cannot write system site-packages. Install libraries in a builder stage and copy them in, as above. - Pure Python packages work as-is. Packages with compiled extensions must ship wheels for Python 3.13 on Debian 13. The base provides
libstdc++6andlibgcc-s1; a wheel that needs another native library (for examplelibgomp1) must have it installed withapt-getin the final stage, switching toUSER rootfor the install and back toUSER 65532:65532afterwards.
Deploy the custom image
- Push the image to a registry the cluster can pull from, and create a pull secret in the sandbox namespace if the registry requires one.
- Update
spec.podTemplate.spec.containers[0].imagein theSandboxTemplateand re-apply it. - The controller replaces warm-pool sandboxes automatically when the template changes; new executions pick up the new image.
Reaching internal services
The reference template’s egress policy allows sandboxed code to reach the public internet but blocks all private and cluster CIDRs by design. DNS resolution succeeds; the connection itself times out. To let sandboxed code call a service inside the cluster or VPC (for example to fetch and parse an internal website), add a scoped egress rule to theSandboxTemplate’s network policy:
Runtime contract
A fully custom image, not based on the shipped one, must implement the same runtime contract the platform depends on:- An HTTP server on port
8888with a health endpoint (GET /) andPOST /executeaccepting{"command", "timeout_seconds", "env", "cwd"}and returning{"stdout", "stderr", "exit_code"}. Commands run without a shell. - File staging endpoints rooted at a writable
/workspacevolume:POST /upload,GET /download/{path},GET /list/{path},GET /exists/{path},DELETE /files/{path}. python3onPATH: the platform submits code aspython3 -c "..."and reads results from stdout.- A non-root user compatible with the hardened template:
runAsNonRoot, all capabilities dropped, no privilege escalation. - Server-side enforcement of
timeout_seconds, returning exit code124on timeout.