hawkli-1994/deerflow-book

本书围绕 DeerFlow 2.0,从理论到源码,系统讲解如何进行二次开发。(精校)

What it solves

This book helps developers go beyond using DeerFlow as a black box. It explains the internal architecture and source code of DeerFlow 2.0, so readers can modify, extend, or build on top of it for their own projects. Instead of just showing how to call the framework, it digs into why the code is designed the way it is, with real source files and practical examples.

How it works

The book is organized in three parts. Part one covers the theoretical foundations: what DeerFlow is, its core concepts like Skills versus Tools, Sub-Agents, Sandbox, Memory, and Context Engineering, and the overall architecture. Part two dives into the source code chapter by chapter, explaining the ThreadState type system, the middleware chain, the Skills and Tools manager, the Sub-Agent executor, the Sandbox provider, the Memory system, and Context Engineering techniques. Part three focuses on real-world secondary development: integrating MCP servers with OAuth 2.0, building custom Skills with multimodal output (PPT, podcast, image, video, dashboard), adding human-in-the-loop approval flows, and enterprise cases like multi-tenant isolation, RBAC, and audit systems. Each chapter references the actual DeerFlow source files it explains, and the book is continuously updated to match the latest version.

Who it's for

This book is aimed at developers who already have some experience with agents or LLM applications and want to do serious customization. It expects familiarity with Python 3.12+, type annotations, async programming, and basic LangChain/LangGraph concepts. There are different reading paths for newcomers, secondary development engineers, enterprise application developers, and potential source contributors.

Highlights

  • Source-level analysis: every chapter goes into the actual DeerFlow source code, not just high-level ideas.
  • Practical orientation: complete secondary development examples that can be used directly in projects.
  • Architecture thinking: explains not only "how to use" but also "why it is designed this way".
  • Continuously updated: kept in sync with DeerFlow releases, with recent updates covering memory, skills, sandbox, and OAuth.
  • Includes a Docker quick-start guide and configuration reference for setting up DeerFlow locally.
  • Open source under the MIT license, with contribution guidelines provided.

Related

  • Project
  • Project
  • Project
  • Project