How bytedance/deer-flow works
DeerFlow 2.0 is an extensible agent harness: users submit work through the application, which coordinates agent runs and can draw on skills, subagents, memory, and sandboxes. The README also documents web research, private knowledge retrieval, projects, chat archives, scheduled tasks, and external messaging channels. The graph preserves these product branches, but several implementation links are documented capabilities rather than sampled call sites; those edges are dashed where wiring is unverified.
Main entry points: app.py API gateway · agent.py Lead agent · manager.py Run manager · threads.py Threads and runs
Components 19
Gateway and access
- API gateway
backend/app/gateway/app.py - Authentication
backend/app/gateway/auth - Threads and runs
backend/app/gateway/routers/threads.py
Agent execution
- Run manager
backend/packages/harness/deerflow/runtime/runs/manager.py - Lead agent
backend/packages/harness/deerflow/agents/lead_agent/agent.py - Subagents
backend/app/subagent_batches/service.py - Long-term memory
backend/packages/harness/deerflow/agents/memory/manager.py
Knowledge and tools
- Skills
backend/packages/harness/deerflow/skills/storage/skill_storage.py - Sandbox execution
backend/packages/harness/deerflow/community/aio_sandbox - Web research
backend/packages/harness/deerflow/community - Private knowledge
backend/app/gateway/routers/knowledge.py - MCP tools
backend/app/mcp_tasks/service.py
Workspace and integrations
- Persistence
backend/packages/harness/deerflow/persistence/engine.py - Projects and files
backend/app/gateway/routers/projects.py - Artifacts
backend/app/gateway/routers/artifacts.py - Extensions
backend/packages/harness/deerflow/extensions/manager.py - Messaging channels
backend/app/channels/manager.py
Background operations
- Scheduled tasks
backend/app/scheduler/service.py
Other components
- User
Connections 18
- User → API gateway: submits work
README.md - API gateway → Authentication: configures
backend/app/gateway/app.py - API gateway → Threads and runs: registers routes
backend/app/gateway/app.py - Threads and runs → Run manager: starts runs
- Run manager → Lead agent: runs agent
- Lead agent → Subagents: delegates work
README.md - Lead agent → Long-term memory: uses memory
README.md - Lead agent → Skills: uses skills
README.md - Lead agent → Sandbox execution: uses sandbox
README.md - Lead agent → Web research: researches web
README.md - API gateway → Private knowledge: offers retrieval
README.md - API gateway → MCP tools: enables MCP
README.md - Run manager → Persistence: persists runs
backend/packages/harness/deerflow/runtime/runs/manager.py - API gateway → Projects and files: offers projects
README.md - API gateway → Artifacts: registers routes
backend/app/gateway/app.py - Lead agent → Extensions: supports extensions
README.md - Messaging channels → API gateway: dispatches messages
backend/app/channels/manager.py - Scheduled tasks → Run manager: launches runs
backend/app/scheduler/service.py