Skip to main content
DeerFlow uses environment variables for configuration paths, API keys, and runtime settings. This page documents all supported environment variables.

Configuration Paths

These variables control where DeerFlow looks for configuration files and data storage.

DEER_FLOW_CONFIG_PATH

string
Path to the main configuration file (config.yaml).Default Resolution (if not set):
  1. Current working directory: ./config.yaml
  2. Parent directory: ../config.yaml
  3. Error if not found

DEER_FLOW_EXTENSIONS_CONFIG_PATH

string
Path to the extensions configuration file (extensions_config.json).Default Resolution (if not set):
  1. Current working directory: ./extensions_config.json
  2. Parent directory: ../extensions_config.json
  3. Backward compatibility: ./mcp_config.json
  4. Empty config if not found (extensions are optional)

DEER_FLOW_HOME

string
Base directory for DeerFlow’s data storage (memory, threads, agent configs).Default Resolution (if not set):
  1. If running from backend/ directory: ./.deer-flow
  2. Otherwise: ~/.deer-flow
Directory Structure:

API Keys and Credentials

These variables are referenced in configuration files using the $VARIABLE_NAME syntax.

Model Provider API Keys

OpenAI

Anthropic

Google

DeepSeek

Used in config.yaml:
config.yaml
Never hardcode API keys in configuration files. Always use environment variables.

Tool and Service API Keys

Used in config.yaml and extensions_config.json:
config.yaml
extensions_config.json

Runtime Configuration

These variables affect DeerFlow’s runtime behavior.

Python Environment

string
Python module search path. May be needed if running DeerFlow from a non-standard location.

Development Mode

string
Enable debug mode for more verbose logging.Values: "true", "1", "yes" → Enable debug

Database and Storage

For custom database connections:

Sandbox-Specific Variables

These variables are injected into sandbox environments.

Container Environment Variables

Configured in config.yaml and resolved from host environment:
config.yaml
Host environment:
Variables prefixed with $ in sandbox configuration are resolved from the host environment when DeerFlow starts.

MCP Server Variables

Environment variables for MCP servers (stdio transport):
extensions_config.json
Host environment:

OAuth Variables

For MCP servers using OAuth authentication:
Used in extensions_config.json:

Setting Environment Variables

Create a .env file in your project root:
.env
DeerFlow automatically loads .env files using python-dotenv.
Add .env to your .gitignore to avoid committing secrets:
.gitignore

Using Shell Export

Using System Environment (Linux)

override.conf

Using Docker

docker-compose.yml

Using Kubernetes

deployment.yaml

Environment Variable Reference Table

  • Required if the corresponding service/model is configured in config.yaml or extensions_config.json.

Validation and Errors

Missing Required Variables

If a configuration references an undefined environment variable:
config.yaml
DeerFlow will raise an error:
Solution: Set the variable before starting DeerFlow:

Security Best Practices

Always use .gitignore to prevent committing sensitive files:
For production, use proper secret management:
  • AWS Secrets Manager
  • HashiCorp Vault
  • Kubernetes Secrets
  • Azure Key Vault
Rotate API keys and secrets periodically:
Only set variables where needed:
  • Development: .env file
  • Production: System/container environment
  • CI/CD: Pipeline secrets

Troubleshooting

Check the variable is set:
Ensure .env is in the correct location:
DeerFlow uses python-dotenv which loads .env from the current directory.
Pass variables explicitly in docker-compose.yml:

Next Steps

Configuration Overview

Return to configuration overview

Deployment Guide

Deploy DeerFlow to production