k8s-agent-sandbox
A client library to interact with the Agentic Sandbox on Kubernetes.
What it is and what it does
k8s-agent-sandbox is a Python client for the Kubernetes Agent Sandbox Controller, enabling you to programmatically create, configure, and tear down isolated sandbox environments running inside a Kubernetes cluster. It abstracts away the complexity of pod lifecycle management and networking by providing a high-level interface that works as a context manager, ensuring proper resource cleanup.
The client supports four connection modes: Gateway Mode for production cloud deployments with load balancing, Tunnel Mode for local development via kubectl port-forward, In-Cluster Mode for workloads running inside the cluster that connect directly to sandbox pods, and Advanced Mode for custom networking scenarios. It depends on kubernetes, requests, pydantic, and prometheus-client, and includes optional async support for integration with async frameworks like FastAPI.
Use it for:
- Local development and testing of agent code against isolated sandbox environments without needing a public cloud deployment.
- Production agent orchestration on GKE or other managed Kubernetes services using the Gateway Mode for high-scale, load-balanced sandbox provisioning.
- CI/CD pipelines that need to spin up ephemeral, isolated execution environments for testing untrusted or experimental code.
- In-cluster agent workloads that spawn child sandboxes for subtasks, communicating directly via cluster DNS.
- Custom networking scenarios where sandboxes are accessed through a specific domain or manually configured router URL.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A Python client library for creating and managing isolated sandbox environments on Kubernetes clusters, supporting multiple connection modes from local development to production cloud deployments.
Yes. The package is actively maintained with no known vulnerabilities, has low install friction, and fills a clear need for Kubernetes-native sandbox management. Install it if you are building agents or orchestration tools on Kubernetes and need reliable, scalable sandbox lifecycle management. The permissive Apache license and recent release cadence make it a safe production dependency.
Install
k8s-agent-sandbox on PyPI
pip
pip install k8s-agent-sandboxuv
uv add k8s-agent-sandboxpoetry
poetry add k8s-agent-sandboxInstalling k8s-agent-sandbox
Before you install
Low install friction with a pure-Python wheel distribution. The package is actively maintained with a recent release and no known vulnerabilities. Runtime dependencies are standard and widely available (kubernetes, requests, pydantic, prometheus-client).
License in practice
Licensed under Apache Software License (permissive), allowing commercial and private use with minimal restrictions.
Quickstart
pip install k8s-agent-sandbox
from k8s_agent_sandbox import SandboxClient
from k8s_agent_sandbox.models import SandboxLocalTunnelConnectionConfig
client = SandboxClient(connection_config=SandboxLocalTunnelConnectionConfig())
sandbox = client.create_sandbox(warmpool="python-sandbox-warmpool", namespace="default")
try:
result = sandbox.commands.run("echo 'Hello'")
finally:
sandbox.terminate()
Requires a running Kubernetes cluster with the Agent Sandbox Controller installed and a deployed sandbox-router service; kubectl must be configured locally.
Verify before relying
- Whether optional tracing dependencies (GCP OpenTelemetry integration) are production-ready or experimental.
- Performance characteristics and latency overhead of the four connection modes under load.
- Whether the async client API is feature-complete relative to the synchronous client.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.11) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — kubernetes, requests, pydantic, prometheus-client |
| Maintenance | actively maintained — 1 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 648,849/month — #5,582 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: k8s_agent_sandbox-0.5.5-py3-none-any.whl
Tags
More Distributed Computing packages
gRPC Python is an HTTP/2-based RPC framework…
permissive · top 100 on PyPI
execnetexecnet lets you spawn and communicate with…
permissive · top 1,000 on PyPI
cloudpickleCloudpickle extends Python's standard pickle…
permissive · top 1,000 on PyPI
smart-openProvides a unified, open()-compatible Python…
permissive · top 1,000 on PyPI
portalockerPortalocker provides cross-platform file…
permissive · top 1,000 on PyPI
rayRay is a distributed computing framework that…
permissive · top 1,000 on PyPI
kr8sA Python client library for Kubernetes that…
permissive · top 5,000 on PyPI
opensandboxOpenSandbox SDK provides low-level Python…
permissive · top 15,000 on PyPI
agent-sandboxA Python SDK for accessing sandbox, shell,…
permissive · top 15,000 on PyPI
prime-sandboxesPython SDK for creating, managing, and…
permissive · top 15,000 on PyPI
cwsandboxA Python client library for running and…
permissive · top 15,000 on PyPI
portforwardProvides Python bindings for Kubernetes…
permissive · top 15,000 on PyPI
openshiftPython client library for interacting with…
permissive · top 15,000 on PyPI
koyeb-sdkOfficial Python SDK for Koyeb that provides…
permissive · top 15,000 on PyPI
anyscaleAnyscale provides a command-line interface and…
unclear · top 5,000 on PyPI
blaxelPython SDK for creating, managing, and…
unclear · top 15,000 on PyPI