e0e362d700
SDK Tests / changes (push) Successful in 2m29s
Real E2E Tests / changes (push) Successful in 2m29s
Deploy Docs Pages / build (push) Has been cancelled
Deploy Docs Pages / deploy (push) Has been cancelled
Real E2E Tests / JavaScript E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Python E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Java E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / C# E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Go E2E (docker bridge) (push) Has been cancelled
Real E2E Tests / Real E2E CI (push) Has been cancelled
SDK Tests / SDK CI (push) Has been cancelled
SDK Tests / CLI Tests (push) Has been cancelled
SDK Tests / Python SDK Quality (code-interpreter) (push) Has been cancelled
SDK Tests / Python SDK Quality (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / JavaScript SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Python SDK Tests (sandbox) (push) Has been cancelled
SDK Tests / CLI Quality (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Kotlin SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (code-interpreter) (push) Has been cancelled
SDK Tests / C# SDK Quality And Tests (sandbox) (push) Has been cancelled
SDK Tests / Go SDK Quality And Tests (push) Has been cancelled
64 lines
1.5 KiB
Markdown
64 lines
1.5 KiB
Markdown
---
|
|
title: Agent Sandbox
|
|
description: Create a kubernetes-sigs/agent-sandbox instance and run a command using the OpenSandbox Python SDK.
|
|
---
|
|
|
|
# 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 uses `ubuntu:22.04`).
|
|
|
|
## Start OpenSandbox server
|
|
|
|
1. 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
|
|
```
|
|
|
|
2. Update `~/.sandbox.toml` with the following sections:
|
|
|
|
```toml
|
|
[runtime]
|
|
type = "kubernetes"
|
|
execd_image = "opensandbox/execd:v1.0.21"
|
|
|
|
[kubernetes]
|
|
namespace = "default"
|
|
# kubeconfig_path = "/absolute/path/to/kubeconfig" # optional if running in-cluster
|
|
workload_provider = "agent-sandbox"
|
|
|
|
[agent_sandbox]
|
|
shutdown_policy = "Delete"
|
|
```
|
|
|
|
3. Start the server:
|
|
|
|
```shell
|
|
opensandbox-server
|
|
```
|
|
|
|
## Run the example
|
|
|
|
```shell
|
|
uv pip install opensandbox
|
|
uv run python examples/agent-sandbox/main.py
|
|
```
|
|
|
|
## Expected output
|
|
|
|
```text
|
|
command output: hello world
|
|
```
|
|
|
|
## References
|
|
|
|
- [Source code on GitHub](https://github.com/opensandbox-group/OpenSandbox/tree/main/examples/agent-sandbox)
|