Skip to main content
OpenSandbox Server uses TOML configuration files to control runtime behavior, networking, security, and resource management. This guide covers all available configuration options.

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 when api_key is set:
  • Empty or missing: Middleware skips API key checks (for local/dev)
  • Non-empty: All endpoints (except /health, /docs, /redoc) require OPEN-SANDBOX-API-KEY header

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 manipulation
  • MKNOD: Block device node creation
  • NET_ADMIN: Disable network configuration
  • NET_RAW: Prevent raw socket creation
  • SYS_ADMIN: Block administrative operations
  • SYS_MODULE: Prevent kernel module loading
  • SYS_PTRACE: Disable process tracing
  • SYS_TIME: Block system clock changes
  • SYS_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 = false to 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 networkPolicy are rejected in host mode
  • Main container shares sidecar network namespace
  • Main container drops NET_ADMIN capability
  • Sidecar retains NET_ADMIN for iptables management
  • IPv6 disabled in shared namespace

Ingress Configuration

Control how clients access sandbox endpoints:

Options

Ingress Modes

Direct Mode

Clients connect directly to sandboxes. Required for Docker runtime.

Gateway Mode with Wildcard Routing

Endpoint format: <sandbox-id>-<port>.example.com/path/to/request

Gateway Mode with URI Routing

Endpoint format: 10.0.0.1:8000/<sandbox-id>/<port>/path/to/request

Gateway Mode with Header Routing

Endpoint format: 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:
Common validation errors:
  • Missing required fields: runtime.type and runtime.execd_image are required
  • Invalid runtime type: Must be "docker" or "kubernetes"
  • Network policy misconfiguration: egress.image required when using networkPolicy
  • Invalid log level: Must be a valid Python logging level

Next Steps