Overview
The sandbox system provides isolated execution environments for agent operations. All file operations, command execution, and code running happen within the sandbox.Local Sandbox
Direct execution on host machine. Fast but no isolation.
Docker Sandbox
Containerized execution with full isolation. Recommended for development.
Kubernetes Sandbox
Pod-based execution managed by provisioner. Best for production.
Local Sandbox
The simplest mode - executes commands directly on the host machine.Configuration
config.yaml
Characteristics
Fast - no container overheadSimple setup - no Docker required
No isolation - full host access
Security risk - agent can access all host files
Use Cases
- Quick local development and testing
- Running in trusted environments
- Debugging without container complexity
- Limited resource environments
Docker Sandbox (AIO Sandbox)
Containerized execution using Docker or Apple Container (macOS). Provides isolation while maintaining good performance.Basic Configuration
config.yaml
- Starts a Docker container on port 8080
- Uses the default all-in-one sandbox image
- Mounts the skills directory
- On macOS: Prefers Apple Container if available, falls back to Docker
Advanced Configuration
config.yaml
Configuration Options
Must be
src.community.aio_sandbox:AioSandboxProviderDocker image to use. The default image works on both x86_64 and arm64 architectures.
Base port for sandbox containers. Each container uses an incremental port.
If set, uses an existing sandbox at this URL instead of starting a new container.Example:
http://localhost:8080Whether to automatically start Docker containers. Set to
false if managing containers manually.Prefix for container names. Containers are named
{prefix}-{thread_id}.Idle timeout in seconds before sandbox is released (default: 10 minutes). Set to
0 to disable timeout.Additional volume mounts to share directories between host and container.Note: The skills directory is automatically mounted.Each mount requires:
host_path: Path on the host machinecontainer_path: Path inside the containerread_only: Whether the mount is read-only (default: false)
Environment variables to inject into the sandbox container.Values starting with
$ are resolved from the host environment:Using Existing Sandbox
Connect to a pre-started sandbox instead of managing containers:config.yaml
Platform-Specific Behavior
- macOS
- Linux
- Windows
On macOS, DeerFlow automatically prefers Apple Container if available, with fallback to Docker:
- Checks for Apple Container runtime
- Falls back to Docker if not available
Volume Mounts
The Docker sandbox automatically mounts:- Skills directory: From
skills.pathtoskills.container_path(read-only) - Thread workspace: Per-thread working directory
- Custom mounts: Additional directories specified in
mounts
config.yaml
Environment Variables in Container
Inject environment variables into the sandbox:config.yaml
Environment variables prefixed with
$ are resolved from the host environment when DeerFlow starts.Kubernetes Sandbox (Provisioner)
Production-grade sandbox using Kubernetes pods managed by a provisioner service. Eachsandbox_id gets a dedicated pod.
Configuration
config.yaml
Architecture
Characteristics
Full isolation - each thread gets its own podScalable - handles many concurrent threads
Resource limits - CPU and memory controls
Production-ready - managed lifecycle
Complex setup - requires Kubernetes and provisioner
Use Cases
- Production deployments
- Multi-tenant environments
- High concurrency requirements
- Environments requiring strict isolation
- Cloud deployments
Provisioner Setup
The provisioner is a separate service that manages Kubernetes pods. See the provisioner documentation for setup instructions.Comparison Matrix
| Feature | Local | Docker | Kubernetes |
|---|---|---|---|
| Isolation | ❌ None | ✅ Container | ✅✅ Pod |
| Setup Complexity | ✅ Simple | ⚠️ Moderate | ❌ Complex |
| Performance | ✅✅ Fast | ✅ Good | ⚠️ Moderate |
| Scalability | ⚠️ Limited | ✅ Good | ✅✅ Excellent |
| Security | ❌ Low | ✅ High | ✅✅ Highest |
| Resource Control | ❌ No | ⚠️ Basic | ✅ Advanced |
| Production Ready | ❌ No | ⚠️ Yes | ✅ Yes |
Recommendations
Development
Development
Use Docker sandbox for the best balance of isolation and convenience:
Production (Single-user)
Production (Single-user)
Use Docker sandbox with explicit configuration:
Production (Multi-tenant)
Production (Multi-tenant)
Use Kubernetes sandbox with provisioner:
Quick Testing
Quick Testing
Use local sandbox for rapid iteration:
Troubleshooting
Docker container fails to start
Docker container fails to start
Check Docker is running and accessible:
Permission denied on volume mounts
Permission denied on volume mounts
Ensure the host paths exist and have correct permissions:
Environment variables not resolved
Environment variables not resolved
Verify environment variables are set on the host:
Container idle timeout too aggressive
Container idle timeout too aggressive
Increase the idle timeout or disable it:
Next Steps
Skills Configuration
Configure skills and MCP servers
Tools Reference
Explore available tools