Agent-Sandbox Example
This example creates a sandbox backed by kubernetes-sigs/agent-sandbox and executes echo hello world via the OpenSandbox Python SDK.
Prerequisites
- A Kubernetes cluster with the agent-sandbox controller and CRDs installed.
- OpenSandbox server configured with Kubernetes runtime and
workload_provider = "agent-sandbox". - Sandbox image should include
bash(default example usesubuntu:22.04).
Start OpenSandbox server
- Install the server package and fetch the example config for agent-sandbox:
shell
uv pip install opensandbox-server
opensandbox-server init-config ~/.sandbox.toml --example docker- Update
~/.sandbox.tomlwith the following sections:
toml
[runtime]
type = "kubernetes"
execd_image = "opensandbox/execd:v1.0.6"
[kubernetes]
namespace = "default"
# kubeconfig_path = "/absolute/path/to/kubeconfig" # optional if running in-cluster
workload_provider = "agent-sandbox"
[agent_sandbox]
shutdown_policy = "Delete"- Start the server:
shell
opensandbox-serverRun the example
shell
uv pip install opensandbox
uv run python examples/agent-sandbox/main.pyExpected output
text
command output: hello world此页内容来自仓库源文件:
examples/agent-sandbox/README.md