How to Set Up and Run DeerFlow Locally in 5 Minutes
Purpose
This post shows how to set up and run DeerFlow locally. The key point is using Docker deployment for the fastest path to a working system.
Problem
I wanted to try DeerFlow, ByteDance’s open-source AI agent framework. I cloned the repository and got stuck.
Here’s what I tried first:
git clone https://github.com/bytedance/deer-flow.gitcd deer-flowmake installmake devI got this error:
ERROR: Node.js version 18.17.0 is not supported. Please use Node.js 22+.ERROR: Python version 3.10.0 is not supported. Please use Python 3.12+.My local environment was outdated. I didn’t want to upgrade my system Node.js and Python versions just for one project.
I tried using nvm and pyenv to manage versions. It worked, but then I hit dependency conflicts with my existing projects.
I needed a cleaner approach that wouldn’t mess up my development environment.
Environment
- macOS or Linux (Windows via WSL2)
- Docker Desktop or Docker Engine
- At least one LLM API key (OpenAI, Anthropic, or compatible)
- 8GB RAM minimum, 16GB recommended
Solution: Docker Deployment
DeerFlow provides a Docker-based deployment that isolates all dependencies. This approach solved my environment issues completely.
Step 1: Check Prerequisites
Before starting, I ran the prerequisite check:
make checkI got this output:
Checking prerequisites...[OK] Docker: 24.0.7[OK] Docker Compose: 2.23.0[OK] Git: 2.43.0[OK] Make: 3.81[MISSING] Node.js 22+ (required for local dev only)[MISSING] Python 3.12+ (required for local dev only)[MISSING] pnpm 10.26.2+ (required for local dev only)[MISSING] uv (required for local dev only)
Docker deployment: READYLocal development: MISSING DEPENDENCIESThe check confirmed Docker deployment was ready. I could skip local development setup entirely.
Step 2: Clone and Configure
I cloned the repository and generated configuration files:
git clone https://github.com/bytedance/deer-flow.gitcd deer-flowmake configThis command generated three configuration files:
Created: config.yaml # Main application configurationCreated: .env # Environment variables (API keys)Created: extensions_config.json # MCP servers and skillsStep 3: Configure Your Model
I opened config.yaml to define my LLM provider. The default template looked like this:
models: - name: gpt-4 display_name: GPT-4 use: langchain_openai:ChatOpenAI model: gpt-4 api_key: $OPENAI_API_KEY max_tokens: 4096 temperature: 0.7I use multiple providers, so I configured them all:
models: # OpenAI GPT-4o - name: gpt-4o display_name: GPT-4o use: langchain_openai:ChatOpenAI model: gpt-4o api_key: $OPENAI_API_KEY supports_vision: true
# Anthropic Claude - name: claude-3-5-sonnet display_name: Claude 3.5 Sonnet use: langchain_anthropic:ChatAnthropic model: claude-3-5-sonnet-20241022 api_key: $ANTHROPIC_API_KEY
# OpenRouter (OpenAI-compatible API) - name: gemini-flash display_name: Gemini 2.5 Flash use: langchain_openai:ChatOpenAI model: google/gemini-2.5-flash-preview api_key: $OPENROUTER_API_KEY base_url: https://openrouter.ai/api/v1The use field specifies which LangChain integration to use. DeerFlow supports any LangChain-compatible provider.
Step 4: Set API Keys
I edited .env to add my API keys:
# Required: At least one LLM API keyOPENAI_API_KEY=sk-proj-your-key-here
# Optional: For web search toolsTAVILY_API_KEY=tvly-your-key-here
# Optional: For Claude modelsANTHROPIC_API_KEY=sk-ant-your-key-here
# Optional: For OpenRouterOPENROUTER_API_KEY=sk-or-your-key-hereI made a mistake here. I initially put the key directly in config.yaml:
# WRONG: Hardcoded keyapi_key: sk-proj-xxxxx
# CORRECT: Environment variable referenceapi_key: $OPENAI_API_KEYThe $VARIABLE syntax is important. It reads from your .env file instead of hardcoding secrets.
Step 5: Pull and Start Docker
I pulled the sandbox image and started all services:
# Pull sandbox image (one-time setup)make docker-init
# Start all servicesmake docker-startI got this output:
Pulling deer-flow-sandbox...latest: Pulling from bytedance/deer-flow-sandboxDigest: sha256:abc123...Status: Downloaded newer image
Starting services...[+] Running 4/4 Network deer-flow_default Created Container deer-flow-frontend Started Container deer-flow-gateway Started Container deer-flow-backend Started Container deer-flow-sandbox Started
DeerFlow is running at http://localhost:2026Step 6: Access the Application
I opened http://localhost:2026 in my browser. The interface loaded successfully.
I verified the installation with curl:
# Check if services are runningcurl http://localhost:2026/health
# List available modelscurl http://localhost:2026/api/models
# List available skillscurl http://localhost:2026/api/skillsI got this output:
{ "status": "healthy", "services": { "frontend": "running", "gateway": "running", "backend": "running", "sandbox": "running" }}Architecture Overview
DeerFlow’s architecture looks like this:
User → http://localhost:2026 │ ▼ ┌─────────┐ │ Nginx │ ← Reverse proxy on port 2026 └────┬────┘ │ ┌─────────┼─────────┐ ▼ ▼ ▼Frontend Gateway LangGraph(3000) (8001) (2024) ← Internal ports │ │ │ │ │ ▼ │ │ ┌─────────┐ │ │ │ Sandbox │ ← Isolated code execution │ │ │ Docker │ │ │ └─────────┘ │ │ ▼ ▼┌─────────────────┐│ LLM Providers │ ← OpenAI, Anthropic, etc.└─────────────────┘Understanding this helped me debug issues later. Each component runs in its own container:
- Nginx (port 2026): Entry point, routes requests
- Frontend (port 3000): React-based UI
- Gateway (port 8001): API gateway for frontend
- LangGraph (port 2024): Backend agent runtime
- Sandbox: Docker-based code execution
Common Issues
Issue 1: Port Conflicts
I got this error when port 2026 was already in use:
Error: bind: address already in use Port 2026 is occupied by another processI checked what was using the port:
lsof -i :2026I got this output:
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAMEnginx 12345 user 6u IPv4 123456 0t0 TCP *:2026 (LISTEN)I killed the process:
kill -9 12345Alternatively, I could modify the port in the Docker Compose file:
services: nginx: ports: - "2027:2026" # Use 2027 externallyIssue 2: Missing Provider Modules
When I added a new provider, I got this error:
ERROR: ModuleNotFoundError: No module named 'langchain_google_genai'The error message suggested the fix:
cd backend && uv add langchain-google-genaiAfter installing the missing module, I restarted:
make docker-startIssue 3: Sandbox Image Pull Fails
On slow networks, the sandbox image pull timed out:
ERROR: failed to register layer: write /var/lib/docker/overlay2/...: no space left on deviceI cleaned up Docker and retried:
# Clean up unused Docker resourcesdocker system prune -a
# Manually pull the imagedocker pull ghcr.io/bytedance/deer-flow-sandbox:latest
# Try againmake docker-initmake docker-startIssue 4: API Key Not Found
I forgot to add my API key to .env. I got this error:
ERROR: OpenAI API key not found Please set OPENAI_API_KEY in your .env fileI checked my .env file:
cat .env | grep API_KEYThe key was missing. I added it:
echo "OPENAI_API_KEY=sk-proj-your-key-here" >> .envThen I restarted the services:
make docker-startLocal Development Alternative
If you prefer running without Docker, you need to install the prerequisites:
# Install Node.js 22+curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -sudo apt-get install -y nodejs
# Install pnpm
# Install Python 3.12+pyenv install 3.12.0pyenv global 3.12.0
# Install uvcurl -LsSf https://astral.sh/uv/install.sh | shThen install and run:
make installmake devI found Docker deployment much simpler. It isolates all dependencies and works consistently across different machines.
Sandbox Modes
DeerFlow supports three sandbox modes for code execution:
sandbox: # Local mode: Run code directly (fastest, least secure) mode: local
# Docker mode: Run in Docker container (balanced) mode: docker
# Kubernetes mode: Run in K8s pod (most secure) mode: kubernetes provisioner: k8sI use Docker mode for local development. It provides good isolation without Kubernetes complexity.
Summary
In this post, I showed how to set up and run DeerFlow locally. The key points are:
- Use Docker deployment to avoid environment conflicts
- Configure at least one LLM provider in
config.yaml - Store API keys in
.envusing$VARIABLEreferences - Run
make docker-init && make docker-startfor quick setup - Check port availability before starting
DeerFlow’s setup is streamlined with Make commands and sensible defaults. The Docker deployment provides a complete environment with minimal configuration. For production deployments, customize config.yaml with your preferred models, sandbox mode, and optional MCP servers.
Final Words + More Resources
My intention with this article was to help others share my knowledge and experience. If you want to contact me, you can contact by email: Email me
Here are also the most important links from this article along with some further resources that will help you in this scope:
Oh, and if you found these resources useful, don’t forget to support me by starring the repo on GitHub!
Comments