Configuration File Location
By default, the server looks for configuration at~/.sandbox.toml. Override with:
Initialize Configuration
Generate a configuration file with examples:Server Configuration
Control the HTTP server settings:Options
Log Levels
- DEBUG: Detailed diagnostic information
- INFO: General informational messages
- WARNING: Warning messages for potential issues
- ERROR: Error messages for failures
- CRITICAL: Critical errors that may cause shutdown
API Authentication
Authentication is enforced only whenapi_key is set:
- Empty or missing: Middleware skips API key checks (for local/dev)
- Non-empty: All endpoints (except
/health,/docs,/redoc) requireOPEN-SANDBOX-API-KEYheader
Runtime Configuration
Select and configure the sandbox runtime backend:Options
Docker Runtime Configuration
Docker-specific settings:Options
Network Mode Comparison
Security Capabilities
Recommended capabilities to drop:AUDIT_WRITE: Prevent audit log manipulationMKNOD: Block device node creationNET_ADMIN: Disable network configurationNET_RAW: Prevent raw socket creationSYS_ADMIN: Block administrative operationsSYS_MODULE: Prevent kernel module loadingSYS_PTRACE: Disable process tracingSYS_TIME: Block system clock changesSYS_TTY_CONFIG: Prevent TTY configuration
Kubernetes Runtime Configuration
Kubernetes-specific settings:Options
Informer Configuration (Beta)
Informers reduce API server load through watch-based caching:- Enabled by default: Set
informer_enabled = falseto disable - Resync interval: How often to perform full list refresh
- Watch timeout: How long before restarting watch connection
- Tune for your cluster: Adjust based on API rate limits
Egress Configuration
Configure egress sidecar for network policy enforcement:Options
Network Policy Requirements
- Only supported in Docker bridge mode
- Egress image must be configured
- Requests with
networkPolicyare rejected in host mode - Main container shares sidecar network namespace
- Main container drops
NET_ADMINcapability - Sidecar retains
NET_ADMINfor iptables management - IPv6 disabled in shared namespace
Ingress Configuration
Control how clients access sandbox endpoints:Options
Ingress Modes
Direct Mode
Gateway Mode with Wildcard Routing
<sandbox-id>-<port>.example.com/path/to/request
Gateway Mode with URI Routing
10.0.0.1:8000/<sandbox-id>/<port>/path/to/request
Gateway Mode with Header Routing
gateway.example.com with header OpenSandbox-Ingress-To: <sandbox-id>-<port>
Storage Configuration
Control host path access for volume bind mounts:Options
Behavior
- Empty list: All host paths allowed (not recommended for production)
- Non-empty list: Only paths starting with listed prefixes are allowed
- Applies to volume bind mount requests
Agent-Sandbox Configuration
Configuration for agent-sandbox workload provider:Options
Environment Variables
Override configuration with environment variables:Complete Configuration Examples
Production Docker Setup
Production Kubernetes Setup
Development Setup
Configuration Validation
The server validates configuration at startup:- Missing required fields:
runtime.typeandruntime.execd_imageare required - Invalid runtime type: Must be
"docker"or"kubernetes" - Network policy misconfiguration:
egress.imagerequired when usingnetworkPolicy - Invalid log level: Must be a valid Python logging level