Evidence boundary
This breakdown describes DeerFlow v2.0.4 at commit a4f891b234c90e12d8f7e6a5b4c3d2e1f0e9d8c7. The pinned source repository establishes the architecture and execution mechanics shown below.
1. LangGraph Pregel Supervisor Control Plane
At the core of DeerFlow 2.0 is a Bulk Synchronous Parallel (BSP) Pregel state machine that coordinates autonomous model decisions while enforcing deterministic control boundaries.
Control Plane Topology:
- User Goal Processing: Generation requests are validated by Pydantic V2 schemas and submitted to the LangGraph supervisor router.
- Supervisor Fan-Out: The supervisor evaluates the global state and dispatches sub-tasks to specialized worker agents (Researcher, Coder, Reviewer) using
Send()directives. - Scratchpad Memory Isolation: Worker subgraphs execute in ephemeral memory spaces. Raw tool logs (DOM dumps, compiler traces, shell outputs) remain isolated inside the worker scratchpad.
- Channel Reducer Barrier Flush: Upon worker completion, pure
add_messageschannel reducers sanitize and summarize results, passing only essential findings back to the parent supervisor prompt window.
2. Mathematical Formulation: Subagent Context Partitioning & Token Allocation
To prevent prompt window saturation during long-horizon tasks, DeerFlow 2.0 calculates dynamic token context allocations per subagent worker:
Partitions available model context window across concurrent worker subagents to prevent context overflow.
3. Sandboxed Docker Container Execution Engine
To allow agents to execute arbitrary code safely without risking host environment security, DeerFlow 2.0 incorporates a sandboxed container runner.
Execution Mechanics:
- Ephemeral Sandbox Container: Each agent run provisions an isolated
python:3.11-slimcontainer with strict CPU (2.0 cores), RAM (4,096 MB), and network egress limits. - IPC & File System Synchronization: The supervisor mounts volume workspaces to allow the agent to create files, compile binaries, and generate research reports (Markdown, PDF, charts).
- Execution Guardrails: AST syntax validation prevents malformed script execution before container invocation, and hard timeouts (60s) protect against infinite execution loops.
4. Declarative Skill Engine (SKILL.md) & Dynamic Loader
DeerFlow 2.0 decouples agent logic from python tool code by introducing human-readable Markdown skill specifications.
Skill Architecture:
- YAML Frontmatter Metadata: Defines tool names, descriptions, input parameter schemas, and access scopes.
- Markdown Body Instructions: Contains step-by-step guidance, edge case treatments, and prompt instructions.
- Dynamic Tool Registration: The
SkillLoaderparsesSKILL.mdfiles at startup or runtime, generating typed Pydantic tool schemas that are injected directly into the agent's active prompt context.
5. Deep Research & Synthesis Pipeline
DeerFlow 2.0 features an iterative deep research workflow that converts vague user prompts into evidence-backed reports.
Pipeline Execution Steps:
- Query Decomposition: Breaks a high-level topic into sub-queries across multiple domain vectors.
- Iterative Web Scraping & Evidence Harvesting: Concurrently fetches web pages, parses raw text, and extracts factual evidence claims.
- Cross-Claim Verification: Evaluates source reliability and filters out unverified narrative assertions.
- Synthesis & Asset Generation: Compiles claims into structured markdown dossiers complete with citations, data tables, and inline Mermaid diagrams.
6. Durable Checkpointing & Human-in-the-Loop Governance
Production deployments require persistence across worker crashes and explicit human authorization before high-consequence operations.
State Persistence & Interrupt Boundaries:
- Postgres Async Checkpointer: Serializes channel state supersteps to PostgreSQL via
JSONPlusSerializer. - Interrupt Gates (
interrupt_before): Sensitive tool nodes (e.g., executing shell commands, modifying databases) freeze state and emit an approval event. - State Mutation & Resumption: Operators can inspect active state, modify parameters via
graph.update_state(), and resume execution seamlessly.
Technical Summary & Trade-Off Matrix
| Architecture Option | Primary Best-For Case |
|---|