Skip to main content
DeerFlow supports multiple sandbox modes for executing code and commands. Choose between local execution for simplicity, Docker for isolation, or Kubernetes for production scalability.

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 overhead
Simple setup - no Docker required
No isolation - full host access
Security risk - agent can access all host files
Local sandbox is not recommended for production use. The agent has unrestricted access to your filesystem and can execute any command.

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
This minimal configuration automatically:
  • 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

string
required
Must be src.community.aio_sandbox:AioSandboxProvider
string
Docker image to use. The default image works on both x86_64 and arm64 architectures.
integer
default:"8080"
Base port for sandbox containers. Each container uses an incremental port.
string
If set, uses an existing sandbox at this URL instead of starting a new container.Example: http://localhost:8080
boolean
default:"true"
Whether to automatically start Docker containers. Set to false if managing containers manually.
string
default:"deer-flow-sandbox"
Prefix for container names. Containers are named {prefix}-{thread_id}.
integer
default:"600"
Idle timeout in seconds before sandbox is released (default: 10 minutes). Set to 0 to disable timeout.
array
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 machine
  • container_path: Path inside the container
  • read_only: Whether the mount is read-only (default: false)
object
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
Start the sandbox manually:

Platform-Specific Behavior

On macOS, DeerFlow automatically prefers Apple Container if available, with fallback to Docker:
  1. Checks for Apple Container runtime
  2. Falls back to Docker if not available
No configuration changes needed - the provider handles this automatically.

Volume Mounts

The Docker sandbox automatically mounts:
  1. Skills directory: From skills.path to skills.container_path (read-only)
  2. Thread workspace: Per-thread working directory
  3. 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. Each sandbox_id gets a dedicated pod.

Configuration

config.yaml

Architecture

Characteristics

Full isolation - each thread gets its own pod
Scalable - 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

Recommendations

Use Docker sandbox for the best balance of isolation and convenience:
Use Docker sandbox with explicit configuration:
Use Kubernetes sandbox with provisioner:
Use local sandbox for rapid iteration:
Never use local sandbox with untrusted input or in production.

Troubleshooting

Check Docker is running and accessible:
Ensure the host paths exist and have correct permissions:
Verify environment variables are set on the host:
Increase the idle timeout or disable it:

Next Steps

Skills Configuration

Configure skills and MCP servers

Tools Reference

Explore available tools