The OpenSandbox server is the control plane of the entire platform — a production-grade FastAPI service responsible for creating, monitoring, pausing, resuming, and terminating sandboxes. It authenticates requests, validates configuration, persists server-managed metadata, and delegates all runtime work to a configured backend (Docker or Kubernetes). Every SDK call and CLI command ultimately reaches this service first.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/opensandbox-group/OpenSandbox/llms.txt
Use this file to discover all available pages before exploring further.
Requirements
| Requirement | Minimum Version |
|---|---|
| Python | 3.10+ |
| Package manager | uv (recommended) or pip |
| Docker (Docker runtime) | Engine 20.10+ |
| Kubernetes (K8s runtime) | 1.21.1+ |
| Operating system | Linux, macOS, or Windows with WSL2 |
Core Features
Lifecycle APIs
Standardized REST interfaces for create, start, pause, resume, and delete across Docker and Kubernetes backends.
Pluggable Runtimes
Switch between Docker (local/single-host) and Kubernetes (scaled/pooled) runtimes via a single config field.
Lifecycle Cleanup
Configurable TTL with renewal, or manual cleanup with explicit delete. Expiration timers are restored after server restart.
API Key Authentication
Enforce
OPEN-SANDBOX-API-KEY header on all non-health endpoints. Disable only for local development with explicit acknowledgment.Networking Modes
Choose
host (shared host network, maximum performance) or bridge (isolated network with built-in HTTP routing).Resource Quotas
CPU and memory limits expressed with Kubernetes-style specs, enforced at container creation time.
Observability
Unified sandbox status with
state, reason, message, and lastTransitionAt fields for every lifecycle transition.Registry Support
Pull from public or private registries. Supply per-request image authentication credentials.
Installation and Startup
Install the server package
Install
opensandbox-server from PyPI. For local development, clone the repository and run uv sync inside server/.Generate a starter config
Use the
init-config command to scaffold a config file for your chosen runtime. Use --example docker for local Docker deployments or --example k8s for Kubernetes.Edit the config for your environment
Open
~/.sandbox.toml and configure the [server], [runtime], and [docker] or [kubernetes] sections as needed. See the Configuration reference below for all available sections and keys.Start the server
Run the server. It listens on the
host and port from your TOML config. Pass --config to specify a non-default path.Configuration Reference
The server reads a TOML file. The default path is~/.sandbox.toml. Override with the SANDBOX_CONFIG_PATH environment variable or the --config CLI flag.
Config sections
| Section | Description |
|---|---|
[server] | Host, port, API key, and general server settings |
[runtime] | Runtime backend selection (docker or kubernetes) and execd_image |
[docker] | Docker-specific settings: network_mode, host_ip, capability drops, PID limits, registry credentials |
[kubernetes] | Kubernetes-specific settings: workload_provider, batchsandbox_template_file |
[egress] | Egress sidecar image and mode for per-sandbox networkPolicy enforcement |
[ingress] | Ingress gateway configuration for sandbox traffic routing |
[secure_runtime] | Secure container runtime type (e.g., gvisor, kata-qemu, firecracker) and OCI runtime name |
[storage] | Host bind-mount allowlist and default PVC size for volume mounts |
[store] | Persistence backend. Defaults to SQLite at ~/.opensandbox/opensandbox.db |
[renew_intent] | Optional auto-renew-on-access integration (experimental) |
[agent_sandbox] | Agent sandbox settings for the Kubernetes agent-sandbox workload provider |
[log] | Log level and output format |
Key server config fields
Docker Compose example
The followingdocker-compose.example.yaml starts the server as a container with access to the host Docker socket.
When the server runs inside a Docker container and manages sandboxes on
bridge mode, set host_ip to the host’s IP or hostname (e.g., host.docker.internal) so that bridge-mode endpoints are reachable from outside the container.API Authentication
Authentication is enforced whenserver.api_key is set. Pass the key via the OPEN-SANDBOX-API-KEY header on all calls except /health, /docs, and /redoc.
Health Check and API Docs
| Endpoint | Description |
|---|---|
GET /health | Returns {"status": "healthy"}. No authentication required. |
GET /docs | Swagger UI — interactive REST API explorer |
GET /redoc | ReDoc — full OpenAPI reference |
Sandbox Lifecycle APIs
The lifecycle endpoints all require theOPEN-SANDBOX-API-KEY header when authentication is enabled.
Sandbox lifecycle states
Creation is asynchronous. After
POST /v1/sandboxes returns, poll GET /v1/sandboxes/{id} or use an SDK readiness helper until the state transitions to Running.Environment Variables
| Variable | Description |
|---|---|
SANDBOX_CONFIG_PATH | Override the default config file path (~/.sandbox.toml) |
OPENSANDBOX_SERVER_API_KEY | Override the API key from the TOML config file |
DOCKER_HOST | Custom Docker daemon socket or TCP address |
PENDING_FAILURE_TTL | Seconds to retain failed Pending sandboxes before cleanup (default: 3600) |
OPENSANDBOX_INSECURE_SERVER | Set to YES to run without an API key in non-interactive environments |
Ports
| Port | Protocol | Description |
|---|---|---|
8080 | HTTP | Default server port (configurable via [server].port) |
Reserved Metadata Prefix
Related
- Docker Runtime — Configure the Docker backend in detail
- Kubernetes Deployment — Deploy on Kubernetes with Helm
- Architecture Overview — How the server fits into the broader system
- Network Architecture — Networking modes and isolation