feat: add docker support (#104)

* init docker support

* chore: update Dockerfile and .dockerignore for improved build context and dependency management

* feat: add Docker support with Dockerfile, docker-compose, and .dockerignore for web application

* feat: update environment configuration and docker-compose for improved API integration

* docs: update Japanese and Chinese README files for consistency and clarity
This commit is contained in:
Leo Hui
2025-05-13 19:53:28 +08:00
committed by GitHub
parent 71808802de
commit 9c3021a568
12 changed files with 663 additions and 245 deletions

52
.dockerignore Normal file
View File

@@ -0,0 +1,52 @@
.env
Dockerfile
.dockerignore
.git
.gitignore
# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# Web
node_modules
npm-debug.log
.next
# IDE
.idea/
.vscode/
*.swp
*.swo
# OS
.DS_Store
Thumbs.db
# Project specific
conf.yaml
web/
docs/
examples/
assets/
tests/
*.log

View File

@@ -2,6 +2,9 @@
DEBUG=True DEBUG=True
APP_ENV=development APP_ENV=development
# docker build args
NEXT_PUBLIC_API_URL="http://localhost:8000/api"
# Search Engine, Supported values: tavily (recommended), duckduckgo, brave_search, arxiv # Search Engine, Supported values: tavily (recommended), duckduckgo, brave_search, arxiv
SEARCH_API=tavily SEARCH_API=tavily
TAVILY_API_KEY=tvly-xxx TAVILY_API_KEY=tvly-xxx

17
Dockerfile Normal file
View File

@@ -0,0 +1,17 @@
FROM ghcr.io/astral-sh/uv:python3.12-bookworm
# Install uv.
COPY --from=ghcr.io/astral-sh/uv:latest /uv /bin/uv
WORKDIR /app
# Copy the application into the container.
COPY . /app
# Install the application dependencies.
RUN uv sync --frozen --no-cache
EXPOSE 8000
# Run the application.
CMD ["uv", "run", "python", "server.py", "--host", "0.0.0.0", "--port", "8000"]

View File

@@ -3,6 +3,7 @@
[![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/) [![Python 3.12+](https://img.shields.io/badge/python-3.12+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![DeepWiki](https://img.shields.io/badge/DeepWiki-bytedance%2Fdeer--flow-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/bytedance/deer-flow) [![DeepWiki](https://img.shields.io/badge/DeepWiki-bytedance%2Fdeer--flow-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/bytedance/deer-flow)
<!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ --> <!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
[English](./README.md) | [简体中文](./README_zh.md) | [日本語](./README_ja.md) | [Deutsch](./README_de.md) [English](./README.md) | [简体中文](./README_zh.md) | [日本語](./README_ja.md) | [Deutsch](./README_de.md)
@@ -20,6 +21,7 @@ Please visit [our official website](https://deerflow.tech/) for more details.
https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
In this demo, we showcase how to use DeerFlow to: In this demo, we showcase how to use DeerFlow to:
- Seamlessly integrate with MCP services - Seamlessly integrate with MCP services
- Conduct the Deep Research process and produce a comprehensive report with images - Conduct the Deep Research process and produce a comprehensive report with images
- Create podcast audio based on the generated report - Create podcast audio based on the generated report
@@ -34,13 +36,13 @@ In this demo, we showcase how to use DeerFlow to:
--- ---
## 📑 Table of Contents ## 📑 Table of Contents
- [🚀 Quick Start](#quick-start) - [🚀 Quick Start](#quick-start)
- [🌟 Features](#features) - [🌟 Features](#features)
- [🏗️ Architecture](#architecture) - [🏗️ Architecture](#architecture)
- [🛠️ Development](#development) - [🛠️ Development](#development)
- [🐳 Docker](#docker)
- [🗣️ Text-to-Speech Integration](#text-to-speech-integration) - [🗣️ Text-to-Speech Integration](#text-to-speech-integration)
- [📚 Examples](#examples) - [📚 Examples](#examples)
- [❓ FAQ](#faq) - [❓ FAQ](#faq)
@@ -48,12 +50,12 @@ In this demo, we showcase how to use DeerFlow to:
- [💖 Acknowledgments](#acknowledgments) - [💖 Acknowledgments](#acknowledgments)
- [⭐ Star History](#star-history) - [⭐ Star History](#star-history)
## Quick Start ## Quick Start
DeerFlow is developed in Python, and comes with a web UI written in Node.js. To ensure a smooth setup process, we recommend using the following tools: DeerFlow is developed in Python, and comes with a web UI written in Node.js. To ensure a smooth setup process, we recommend using the following tools:
### Recommended Tools ### Recommended Tools
- **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):** - **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):**
Simplify Python environment and dependency management. `uv` automatically creates a virtual environment in the root directory and installs all required packages for you—no need to manually install Python environments. Simplify Python environment and dependency management. `uv` automatically creates a virtual environment in the root directory and installs all required packages for you—no need to manually install Python environments.
@@ -64,11 +66,14 @@ DeerFlow is developed in Python, and comes with a web UI written in Node.js. To
Install and manage dependencies of Node.js project. Install and manage dependencies of Node.js project.
### Environment Requirements ### Environment Requirements
Make sure your system meets the following minimum requirements: Make sure your system meets the following minimum requirements:
- **[Python](https://www.python.org/downloads/):** Version `3.12+` - **[Python](https://www.python.org/downloads/):** Version `3.12+`
- **[Node.js](https://nodejs.org/en/download/):** Version `22+` - **[Node.js](https://nodejs.org/en/download/):** Version `22+`
### Installation ### Installation
```bash ```bash
# Clone the repository # Clone the repository
git clone https://github.com/bytedance/deer-flow.git git clone https://github.com/bytedance/deer-flow.git
@@ -120,6 +125,7 @@ uv run main.py
### Web UI ### Web UI
This project also includes a Web UI, offering a more dynamic and engaging interactive experience. This project also includes a Web UI, offering a more dynamic and engaging interactive experience.
> [!NOTE] > [!NOTE]
> You need to install the dependencies of web UI first. > You need to install the dependencies of web UI first.
@@ -136,19 +142,21 @@ Open your browser and visit [`http://localhost:3000`](http://localhost:3000) to
Explore more details in the [`web`](./web/) directory. Explore more details in the [`web`](./web/) directory.
## Supported Search Engines ## Supported Search Engines
DeerFlow supports multiple search engines that can be configured in your `.env` file using the `SEARCH_API` variable: DeerFlow supports multiple search engines that can be configured in your `.env` file using the `SEARCH_API` variable:
- **Tavily** (default): A specialized search API for AI applications - **Tavily** (default): A specialized search API for AI applications
- Requires `TAVILY_API_KEY` in your `.env` file - Requires `TAVILY_API_KEY` in your `.env` file
- Sign up at: https://app.tavily.com/home - Sign up at: https://app.tavily.com/home
- **DuckDuckGo**: Privacy-focused search engine - **DuckDuckGo**: Privacy-focused search engine
- No API key required - No API key required
- **Brave Search**: Privacy-focused search engine with advanced features - **Brave Search**: Privacy-focused search engine with advanced features
- Requires `BRAVE_SEARCH_API_KEY` in your `.env` file - Requires `BRAVE_SEARCH_API_KEY` in your `.env` file
- Sign up at: https://brave.com/search/api/ - Sign up at: https://brave.com/search/api/
@@ -176,6 +184,7 @@ SEARCH_API=tavily
### Tools and MCP Integrations ### Tools and MCP Integrations
- 🔍 **Search and Retrieval** - 🔍 **Search and Retrieval**
- Web search via Tavily, Brave Search and more - Web search via Tavily, Brave Search and more
- Crawling with Jina - Crawling with Jina
- Advanced content extraction - Advanced content extraction
@@ -187,6 +196,7 @@ SEARCH_API=tavily
### Human Collaboration ### Human Collaboration
- 🧠 **Human-in-the-loop** - 🧠 **Human-in-the-loop**
- Supports interactive modification of research plans using natural language - Supports interactive modification of research plans using natural language
- Supports auto-acceptance of research plans - Supports auto-acceptance of research plans
@@ -202,27 +212,30 @@ SEARCH_API=tavily
- Automated creation of simple PowerPoint presentations - Automated creation of simple PowerPoint presentations
- Customizable templates for tailored content - Customizable templates for tailored content
## Architecture ## Architecture
DeerFlow implements a modular multi-agent system architecture designed for automated research and code analysis. The system is built on LangGraph, enabling a flexible state-based workflow where components communicate through a well-defined message passing system. DeerFlow implements a modular multi-agent system architecture designed for automated research and code analysis. The system is built on LangGraph, enabling a flexible state-based workflow where components communicate through a well-defined message passing system.
![Architecture Diagram](./assets/architecture.png) ![Architecture Diagram](./assets/architecture.png)
> See it live at [deerflow.tech](https://deerflow.tech/#multi-agent-architecture) > See it live at [deerflow.tech](https://deerflow.tech/#multi-agent-architecture)
The system employs a streamlined workflow with the following components: The system employs a streamlined workflow with the following components:
1. **Coordinator**: The entry point that manages the workflow lifecycle 1. **Coordinator**: The entry point that manages the workflow lifecycle
- Initiates the research process based on user input - Initiates the research process based on user input
- Delegates tasks to the planner when appropriate - Delegates tasks to the planner when appropriate
- Acts as the primary interface between the user and the system - Acts as the primary interface between the user and the system
2. **Planner**: Strategic component for task decomposition and planning 2. **Planner**: Strategic component for task decomposition and planning
- Analyzes research objectives and creates structured execution plans - Analyzes research objectives and creates structured execution plans
- Determines if enough context is available or if more research is needed - Determines if enough context is available or if more research is needed
- Manages the research flow and decides when to generate the final report - Manages the research flow and decides when to generate the final report
3. **Research Team**: A collection of specialized agents that execute the plan: 3. **Research Team**: A collection of specialized agents that execute the plan:
- **Researcher**: Conducts web searches and information gathering using tools like web search engines, crawling and even MCP services. - **Researcher**: Conducts web searches and information gathering using tools like web search engines, crawling and even MCP services.
- **Coder**: Handles code analysis, execution, and technical tasks using Python REPL tool. - **Coder**: Handles code analysis, execution, and technical tasks using Python REPL tool.
Each agent has access to specific tools optimized for their role and operates within the LangGraph framework Each agent has access to specific tools optimized for their role and operates within the LangGraph framework
@@ -253,7 +266,6 @@ curl --location 'http://localhost:8000/api/tts' \
--output speech.mp3 --output speech.mp3
``` ```
## Development ## Development
### Testing ### Testing
@@ -311,6 +323,7 @@ langgraph dev
``` ```
After starting the LangGraph server, you'll see several URLs in the terminal: After starting the LangGraph server, you'll see several URLs in the terminal:
- API: http://127.0.0.1:2024 - API: http://127.0.0.1:2024
- Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024 - Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- API Docs: http://127.0.0.1:2024/docs - API Docs: http://127.0.0.1:2024/docs
@@ -328,11 +341,46 @@ In the Studio UI, you can:
5. Provide feedback during the planning phase to refine research plans 5. Provide feedback during the planning phase to refine research plans
When you submit a research topic in the Studio UI, you'll be able to see the entire workflow execution, including: When you submit a research topic in the Studio UI, you'll be able to see the entire workflow execution, including:
- The planning phase where the research plan is created - The planning phase where the research plan is created
- The feedback loop where you can modify the plan - The feedback loop where you can modify the plan
- The research and writing phases for each section - The research and writing phases for each section
- The final report generation - The final report generation
## Docker
You can also run this project with Docker.
First, you need read the [configuration](#configuration) below. Make sure `.env`, `.conf.yaml` files are ready.
Second, to build a Docker image of your own web server:
```bash
docker build -t deer-flow-api .
```
Final, start up a docker container running the web server:
```bash
# Replace deer-flow-api-app with your preferred container name
docker run -d -t -p 8000:8000 --env-file .env --name deer-flow-api-app deer-flow-api
# stop the server
docker stop deer-flow-api-app
```
### Docker Compose (include both backend and frontend)
DeerFlow provides a docker-compose setup to easily run both the backend and frontend together:
```bash
# building docker image
docker compose build
# start the server
docker compose up
```
## Examples ## Examples
The following examples demonstrate the capabilities of DeerFlow: The following examples demonstrate the capabilities of DeerFlow:
@@ -340,35 +388,43 @@ The following examples demonstrate the capabilities of DeerFlow:
### Research Reports ### Research Reports
1. **OpenAI Sora Report** - Analysis of OpenAI's Sora AI tool 1. **OpenAI Sora Report** - Analysis of OpenAI's Sora AI tool
- Discusses features, access, prompt engineering, limitations, and ethical considerations - Discusses features, access, prompt engineering, limitations, and ethical considerations
- [View full report](examples/openai_sora_report.md) - [View full report](examples/openai_sora_report.md)
2. **Google's Agent to Agent Protocol Report** - Overview of Google's Agent to Agent (A2A) protocol 2. **Google's Agent to Agent Protocol Report** - Overview of Google's Agent to Agent (A2A) protocol
- Discusses its role in AI agent communication and its relationship with Anthropic's Model Context Protocol (MCP) - Discusses its role in AI agent communication and its relationship with Anthropic's Model Context Protocol (MCP)
- [View full report](examples/what_is_agent_to_agent_protocol.md) - [View full report](examples/what_is_agent_to_agent_protocol.md)
3. **What is MCP?** - A comprehensive analysis of the term "MCP" across multiple contexts 3. **What is MCP?** - A comprehensive analysis of the term "MCP" across multiple contexts
- Explores Model Context Protocol in AI, Monocalcium Phosphate in chemistry, and Micro-channel Plate in electronics - Explores Model Context Protocol in AI, Monocalcium Phosphate in chemistry, and Micro-channel Plate in electronics
- [View full report](examples/what_is_mcp.md) - [View full report](examples/what_is_mcp.md)
4. **Bitcoin Price Fluctuations** - Analysis of recent Bitcoin price movements 4. **Bitcoin Price Fluctuations** - Analysis of recent Bitcoin price movements
- Examines market trends, regulatory influences, and technical indicators - Examines market trends, regulatory influences, and technical indicators
- Provides recommendations based on historical data - Provides recommendations based on historical data
- [View full report](examples/bitcoin_price_fluctuation.md) - [View full report](examples/bitcoin_price_fluctuation.md)
5. **What is LLM?** - An in-depth exploration of Large Language Models 5. **What is LLM?** - An in-depth exploration of Large Language Models
- Discusses architecture, training, applications, and ethical considerations - Discusses architecture, training, applications, and ethical considerations
- [View full report](examples/what_is_llm.md) - [View full report](examples/what_is_llm.md)
6. **How to Use Claude for Deep Research?** - Best practices and workflows for using Claude in deep research 6. **How to Use Claude for Deep Research?** - Best practices and workflows for using Claude in deep research
- Covers prompt engineering, data analysis, and integration with other tools - Covers prompt engineering, data analysis, and integration with other tools
- [View full report](examples/how_to_use_claude_deep_research.md) - [View full report](examples/how_to_use_claude_deep_research.md)
7. **AI Adoption in Healthcare: Influencing Factors** - Analysis of factors driving AI adoption in healthcare 7. **AI Adoption in Healthcare: Influencing Factors** - Analysis of factors driving AI adoption in healthcare
- Discusses AI technologies, data quality, ethical considerations, economic evaluations, organizational readiness, and digital infrastructure - Discusses AI technologies, data quality, ethical considerations, economic evaluations, organizational readiness, and digital infrastructure
- [View full report](examples/AI_adoption_in_healthcare.md) - [View full report](examples/AI_adoption_in_healthcare.md)
8. **Quantum Computing Impact on Cryptography** - Analysis of quantum computing's impact on cryptography 8. **Quantum Computing Impact on Cryptography** - Analysis of quantum computing's impact on cryptography
- Discusses vulnerabilities of classical cryptography, post-quantum cryptography, and quantum-resistant cryptographic solutions - Discusses vulnerabilities of classical cryptography, post-quantum cryptography, and quantum-resistant cryptographic solutions
- [View full report](examples/Quantum_Computing_Impact_on_Cryptography.md) - [View full report](examples/Quantum_Computing_Impact_on_Cryptography.md)
@@ -400,6 +456,7 @@ uv run main.py --help
The application now supports an interactive mode with built-in questions in both English and Chinese: The application now supports an interactive mode with built-in questions in both English and Chinese:
1. Launch the interactive mode: 1. Launch the interactive mode:
```bash ```bash
uv run main.py --interactive uv run main.py --interactive
``` ```
@@ -417,11 +474,13 @@ DeerFlow includes a human in the loop mechanism that allows you to review, edit,
1. **Plan Review**: When human in the loop is enabled, the system will present the generated research plan for your review before execution 1. **Plan Review**: When human in the loop is enabled, the system will present the generated research plan for your review before execution
2. **Providing Feedback**: You can: 2. **Providing Feedback**: You can:
- Accept the plan by responding with `[ACCEPTED]` - Accept the plan by responding with `[ACCEPTED]`
- Edit the plan by providing feedback (e.g., `[EDIT PLAN] Add more steps about technical implementation`) - Edit the plan by providing feedback (e.g., `[EDIT PLAN] Add more steps about technical implementation`)
- The system will incorporate your feedback and generate a revised plan - The system will incorporate your feedback and generate a revised plan
3. **Auto-acceptance**: You can enable auto-acceptance to skip the review process: 3. **Auto-acceptance**: You can enable auto-acceptance to skip the review process:
- Via API: Set `auto_accepted_plan: true` in your request - Via API: Set `auto_accepted_plan: true` in your request
4. **API Integration**: When using the API, you can provide feedback through the `feedback` parameter: 4. **API Integration**: When using the API, you can provide feedback through the `feedback` parameter:
@@ -464,6 +523,7 @@ We would like to extend our sincere appreciation to the following projects for t
These projects exemplify the transformative power of open-source collaboration, and we are proud to build upon their foundations. These projects exemplify the transformative power of open-source collaboration, and we are proud to build upon their foundations.
### Key Contributors ### Key Contributors
A heartfelt thank you goes out to the core authors of `DeerFlow`, whose vision, passion, and dedication have brought this project to life: A heartfelt thank you goes out to the core authors of `DeerFlow`, whose vision, passion, and dedication have brought this project to life:
- **[Daniel Walnut](https://github.com/hetaoBackend/)** - **[Daniel Walnut](https://github.com/hetaoBackend/)**

View File

@@ -18,6 +18,7 @@
https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
このデモでは、DeerFlow の使用方法を紹介しています: このデモでは、DeerFlow の使用方法を紹介しています:
- MCP サービスとのシームレスな統合 - MCP サービスとのシームレスな統合
- 深層研究プロセスの実施と画像を含む包括的なレポートの作成 - 深層研究プロセスの実施と画像を含む包括的なレポートの作成
- 生成されたレポートに基づくポッドキャストオーディオの作成 - 生成されたレポートに基づくポッドキャストオーディオの作成
@@ -32,7 +33,6 @@ https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
--- ---
## 📑 目次 ## 📑 目次
- [🚀 クイックスタート](#クイックスタート) - [🚀 クイックスタート](#クイックスタート)
@@ -46,12 +46,12 @@ https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
- [💖 謝辞](#謝辞) - [💖 謝辞](#謝辞)
- [⭐ スター履歴](#スター履歴) - [⭐ スター履歴](#スター履歴)
## クイックスタート ## クイックスタート
DeerFlow は Python で開発され、Node.js で書かれた Web UI が付属しています。スムーズなセットアッププロセスを確保するために、以下のツールの使用をお勧めします: DeerFlow は Python で開発され、Node.js で書かれた Web UI が付属しています。スムーズなセットアッププロセスを確保するために、以下のツールの使用をお勧めします:
### 推奨ツール ### 推奨ツール
- **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):** - **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):**
Python 環境と依存関係の管理を簡素化します。`uv`はルートディレクトリに自動的に仮想環境を作成し、必要なパッケージをすべてインストールします—Python 環境を手動でインストールする必要はありません。 Python 環境と依存関係の管理を簡素化します。`uv`はルートディレクトリに自動的に仮想環境を作成し、必要なパッケージをすべてインストールします—Python 環境を手動でインストールする必要はありません。
@@ -62,11 +62,14 @@ DeerFlowはPythonで開発され、Node.jsで書かれたWeb UIが付属して
Node.js プロジェクトの依存関係をインストールおよび管理します。 Node.js プロジェクトの依存関係をインストールおよび管理します。
### 環境要件 ### 環境要件
システムが以下の最小要件を満たしていることを確認してください: システムが以下の最小要件を満たしていることを確認してください:
- **[Python](https://www.python.org/downloads/):** バージョン `3.12+` - **[Python](https://www.python.org/downloads/):** バージョン `3.12+`
- **[Node.js](https://nodejs.org/en/download/):** バージョン `22+` - **[Node.js](https://nodejs.org/en/download/):** バージョン `22+`
### インストール ### インストール
```bash ```bash
# リポジトリをクローン # リポジトリをクローン
git clone https://github.com/bytedance/deer-flow.git git clone https://github.com/bytedance/deer-flow.git
@@ -118,6 +121,7 @@ uv run main.py
### Web UI ### Web UI
このプロジェクトには Web UI も含まれており、より動的で魅力的なインタラクティブ体験を提供します。 このプロジェクトには Web UI も含まれており、より動的で魅力的なインタラクティブ体験を提供します。
> [!注意] > [!注意]
> 先に Web UI の依存関係をインストールする必要があります。 > 先に Web UI の依存関係をインストールする必要があります。
@@ -134,19 +138,21 @@ bootstrap.bat -d
[`web`](./web/)ディレクトリで詳細を確認できます。 [`web`](./web/)ディレクトリで詳細を確認できます。
## サポートされている検索エンジン ## サポートされている検索エンジン
DeerFlow は複数の検索エンジンをサポートしており、`.env`ファイルの`SEARCH_API`変数で設定できます: DeerFlow は複数の検索エンジンをサポートしており、`.env`ファイルの`SEARCH_API`変数で設定できます:
- **Tavily**デフォルトAI アプリケーション向けの専門検索 API - **Tavily**デフォルトAI アプリケーション向けの専門検索 API
- `.env`ファイルに`TAVILY_API_KEY`が必要 - `.env`ファイルに`TAVILY_API_KEY`が必要
- 登録先https://app.tavily.com/home - 登録先https://app.tavily.com/home
- **DuckDuckGo**:プライバシー重視の検索エンジン - **DuckDuckGo**:プライバシー重視の検索エンジン
- API キー不要 - API キー不要
- **Brave Search**:高度な機能を備えたプライバシー重視の検索エンジン - **Brave Search**:高度な機能を備えたプライバシー重視の検索エンジン
- `.env`ファイルに`BRAVE_SEARCH_API_KEY`が必要 - `.env`ファイルに`BRAVE_SEARCH_API_KEY`が必要
- 登録先https://brave.com/search/api/ - 登録先https://brave.com/search/api/
@@ -174,6 +180,7 @@ SEARCH_API=tavily
### ツールと MCP 統合 ### ツールと MCP 統合
- 🔍 **検索と取得** - 🔍 **検索と取得**
- Tavily、Brave Search などを通じた Web 検索 - Tavily、Brave Search などを通じた Web 検索
- Jina を使用したクローリング - Jina を使用したクローリング
- 高度なコンテンツ抽出 - 高度なコンテンツ抽出
@@ -185,6 +192,7 @@ SEARCH_API=tavily
### 人間との協力 ### 人間との協力
- 🧠 **人間参加型ループ** - 🧠 **人間参加型ループ**
- 自然言語を使用した研究計画の対話的修正をサポート - 自然言語を使用した研究計画の対話的修正をサポート
- 研究計画の自動承認をサポート - 研究計画の自動承認をサポート
@@ -200,27 +208,30 @@ SEARCH_API=tavily
- シンプルな PowerPoint プレゼンテーションの自動作成 - シンプルな PowerPoint プレゼンテーションの自動作成
- カスタマイズ可能なテンプレートで個別のコンテンツに対応 - カスタマイズ可能なテンプレートで個別のコンテンツに対応
## アーキテクチャ ## アーキテクチャ
DeerFlow は、自動研究とコード分析のためのモジュラーなマルチエージェントシステムアーキテクチャを実装しています。システムは LangGraph 上に構築され、コンポーネントが明確に定義されたメッセージパッシングシステムを通じて通信する柔軟な状態ベースのワークフローを実現しています。 DeerFlow は、自動研究とコード分析のためのモジュラーなマルチエージェントシステムアーキテクチャを実装しています。システムは LangGraph 上に構築され、コンポーネントが明確に定義されたメッセージパッシングシステムを通じて通信する柔軟な状態ベースのワークフローを実現しています。
![アーキテクチャ図](./assets/architecture.png) ![アーキテクチャ図](./assets/architecture.png)
> [deerflow.tech](https://deerflow.tech/#multi-agent-architecture)でライブで確認できます > [deerflow.tech](https://deerflow.tech/#multi-agent-architecture)でライブで確認できます
システムは以下のコンポーネントを含む合理化されたワークフローを採用しています: システムは以下のコンポーネントを含む合理化されたワークフローを採用しています:
1. **コーディネーター**:ワークフローのライフサイクルを管理するエントリーポイント 1. **コーディネーター**:ワークフローのライフサイクルを管理するエントリーポイント
- ユーザー入力に基づいて研究プロセスを開始 - ユーザー入力に基づいて研究プロセスを開始
- 適切なタイミングでプランナーにタスクを委託 - 適切なタイミングでプランナーにタスクを委託
- ユーザーとシステム間の主要なインターフェースとして機能 - ユーザーとシステム間の主要なインターフェースとして機能
2. **プランナー**:タスク分解と計画のための戦略的コンポーネント 2. **プランナー**:タスク分解と計画のための戦略的コンポーネント
- 研究目標を分析し、構造化された実行計画を作成 - 研究目標を分析し、構造化された実行計画を作成
- 十分なコンテキストが利用可能か、さらなる研究が必要かを判断 - 十分なコンテキストが利用可能か、さらなる研究が必要かを判断
- 研究フローを管理し、最終レポート生成のタイミングを決定 - 研究フローを管理し、最終レポート生成のタイミングを決定
3. **研究チーム**:計画を実行する専門エージェントの集合: 3. **研究チーム**:計画を実行する専門エージェントの集合:
- **研究者**Web 検索エンジン、クローリング、さらには MCP サービスなどのツールを使用して Web 検索と情報収集を行う。 - **研究者**Web 検索エンジン、クローリング、さらには MCP サービスなどのツールを使用して Web 検索と情報収集を行う。
- **コーダー**Python REPL ツールを使用してコード分析、実行、技術的タスクを処理する。 - **コーダー**Python REPL ツールを使用してコード分析、実行、技術的タスクを処理する。
各エージェントは自分の役割に最適化された特定のツールにアクセスでき、LangGraph フレームワーク内で動作する 各エージェントは自分の役割に最適化された特定のツールにアクセスでき、LangGraph フレームワーク内で動作する
@@ -230,28 +241,6 @@ DeerFlowは、自動研究とコード分析のためのモジュラーなマル
- 収集した情報を処理および構造化 - 収集した情報を処理および構造化
- 包括的な研究レポートを生成 - 包括的な研究レポートを生成
## テキスト読み上げ統合
DeerFlowには現在、研究レポートを音声に変換できるテキスト読み上げTTS機能が含まれています。この機能は火山引擎TTS APIを使用して高品質なテキストオーディオを生成します。速度、音量、ピッチなどの特性もカスタマイズ可能です。
### TTS APIの使用
`/api/tts`エンドポイントからTTS機能にアクセスできます
```bash
# curlを使用したAPI呼び出し例
curl --location 'http://localhost:8000/api/tts' \
--header 'Content-Type: application/json' \
--data '{
"text": "これはテキスト読み上げ機能のテストです。",
"speed_ratio": 1.0,
"volume_ratio": 1.0,
"pitch_ratio": 1.0
}' \
--output speech.mp3
```
## 開発 ## 開発
### テスト ### テスト
@@ -309,6 +298,7 @@ langgraph dev
``` ```
LangGraph サーバーを開始すると、端末にいくつかの URL が表示されます: LangGraph サーバーを開始すると、端末にいくつかの URL が表示されます:
- API: http://127.0.0.1:2024 - API: http://127.0.0.1:2024
- Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024 - Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- API ドキュメント: http://127.0.0.1:2024/docs - API ドキュメント: http://127.0.0.1:2024/docs
@@ -326,11 +316,67 @@ Studio UIでは、次のことができます
5. 計画段階でフィードバックを提供して研究計画を洗練 5. 計画段階でフィードバックを提供して研究計画を洗練
Studio UI で研究トピックを送信すると、次を含む全ワークフロー実行プロセスを見ることができます: Studio UI で研究トピックを送信すると、次を含む全ワークフロー実行プロセスを見ることができます:
- 研究計画を作成する計画段階 - 研究計画を作成する計画段階
- 計画を修正できるフィードバックループ - 計画を修正できるフィードバックループ
- 各セクションの研究と執筆段階 - 各セクションの研究と執筆段階
- 最終レポート生成 - 最終レポート生成
## Docker
このプロジェクトは Docker でも実行できます。
まず、以下の[設定](#設定)セクションを読んでください。`.env``.conf.yaml`ファイルが準備できていることを確認してください。
次に、独自の Web サーバーの Docker イメージをビルドします:
```bash
docker build -t deer-flow-api .
```
最後に、Web サーバーを実行する Docker コンテナを起動します:
```bash
# deer-flow-api-appを希望のコンテナ名に置き換えてください
docker run -d -t -p 8000:8000 --env-file .env --name deer-flow-api-app deer-flow-api
# サーバーを停止
docker stop deer-flow-api-app
```
### Docker Compose
このプロジェクトは docker compose でも設定できます:
```bash
# dockerイメージをビルド
docker compose build
# サーバーを起動
docker compose up
```
## テキスト読み上げ統合
DeerFlow には現在、研究レポートを音声に変換できるテキスト読み上げTTS機能が含まれています。この機能は火山引擎 TTS API を使用して高品質なテキストオーディオを生成します。速度、音量、ピッチなどの特性もカスタマイズ可能です。
### TTS API の使用
`/api/tts`エンドポイントから TTS 機能にアクセスできます:
```bash
# curlを使用したAPI呼び出し例
curl --location 'http://localhost:8000/api/tts' \
--header 'Content-Type: application/json' \
--data '{
"text": "これはテキスト読み上げ機能のテストです。",
"speed_ratio": 1.0,
"volume_ratio": 1.0,
"pitch_ratio": 1.0
}' \
--output speech.mp3
```
## 例 ## 例
以下の例は DeerFlow の機能を示しています: 以下の例は DeerFlow の機能を示しています:
@@ -338,35 +384,43 @@ Studio UIで研究トピックを送信すると、次を含む全ワークフ
### 研究レポート ### 研究レポート
1. **OpenAI Sora レポート** - OpenAI の Sora AI ツールの分析 1. **OpenAI Sora レポート** - OpenAI の Sora AI ツールの分析
- 機能、アクセス方法、プロンプトエンジニアリング、制限、倫理的考慮について議論 - 機能、アクセス方法、プロンプトエンジニアリング、制限、倫理的考慮について議論
- [完全なレポートを見る](examples/openai_sora_report.md) - [完全なレポートを見る](examples/openai_sora_report.md)
2. **Google の Agent to Agent プロトコルレポート** - Google の Agent to AgentA2Aプロトコルの概要 2. **Google の Agent to Agent プロトコルレポート** - Google の Agent to AgentA2Aプロトコルの概要
- AI エージェント通信における役割と、Anthropic の Model Context ProtocolMCPとの関係について議論 - AI エージェント通信における役割と、Anthropic の Model Context ProtocolMCPとの関係について議論
- [完全なレポートを見る](examples/what_is_agent_to_agent_protocol.md) - [完全なレポートを見る](examples/what_is_agent_to_agent_protocol.md)
3. **MCP とは何か?** - 複数のコンテキストにおける「MCP」という用語の包括的分析 3. **MCP とは何か?** - 複数のコンテキストにおける「MCP」という用語の包括的分析
- AI における Model Context Protocol、化学における Monocalcium Phosphate、電子工学における Micro-channel Plate を探る - AI における Model Context Protocol、化学における Monocalcium Phosphate、電子工学における Micro-channel Plate を探る
- [完全なレポートを見る](examples/what_is_mcp.md) - [完全なレポートを見る](examples/what_is_mcp.md)
4. **ビットコイン価格変動** - 最近のビットコイン価格動向の分析 4. **ビットコイン価格変動** - 最近のビットコイン価格動向の分析
- 市場動向、規制の影響、テクニカル指標の調査 - 市場動向、規制の影響、テクニカル指標の調査
- 歴史的データに基づく提言 - 歴史的データに基づく提言
- [完全なレポートを見る](examples/bitcoin_price_fluctuation.md) - [完全なレポートを見る](examples/bitcoin_price_fluctuation.md)
5. **LLM とは何か?** - 大規模言語モデルの詳細な探求 5. **LLM とは何か?** - 大規模言語モデルの詳細な探求
- アーキテクチャ、トレーニング、応用、倫理的考慮について議論 - アーキテクチャ、トレーニング、応用、倫理的考慮について議論
- [完全なレポートを見る](examples/what_is_llm.md) - [完全なレポートを見る](examples/what_is_llm.md)
6. **Claude を使った深層研究の方法は?** - 深層研究での Claude の使用に関するベストプラクティスとワークフロー 6. **Claude を使った深層研究の方法は?** - 深層研究での Claude の使用に関するベストプラクティスとワークフロー
- プロンプトエンジニアリング、データ分析、他のツールとの統合 - プロンプトエンジニアリング、データ分析、他のツールとの統合
- [完全なレポートを見る](examples/how_to_use_claude_deep_research.md) - [完全なレポートを見る](examples/how_to_use_claude_deep_research.md)
7. **医療における AI 採用:影響要因** - 医療における AI 採用に影響する要因の分析 7. **医療における AI 採用:影響要因** - 医療における AI 採用に影響する要因の分析
- AI テクノロジー、データ品質、倫理的考慮、経済的評価、組織の準備状況、デジタルインフラについて議論 - AI テクノロジー、データ品質、倫理的考慮、経済的評価、組織の準備状況、デジタルインフラについて議論
- [完全なレポートを見る](examples/AI_adoption_in_healthcare.md) - [完全なレポートを見る](examples/AI_adoption_in_healthcare.md)
8. **量子コンピューティングの暗号学への影響** - 量子コンピューティングの暗号学への影響の分析 8. **量子コンピューティングの暗号学への影響** - 量子コンピューティングの暗号学への影響の分析
- 古典的暗号の脆弱性、ポスト量子暗号学、耐量子暗号ソリューションについて議論 - 古典的暗号の脆弱性、ポスト量子暗号学、耐量子暗号ソリューションについて議論
- [完全なレポートを見る](examples/Quantum_Computing_Impact_on_Cryptography.md) - [完全なレポートを見る](examples/Quantum_Computing_Impact_on_Cryptography.md)
@@ -398,6 +452,7 @@ uv run main.py --help
アプリケーションは現在、英語と中国語の組み込み質問を使用したインタラクティブモードをサポートしています: アプリケーションは現在、英語と中国語の組み込み質問を使用したインタラクティブモードをサポートしています:
1. インタラクティブモードを開始: 1. インタラクティブモードを開始:
```bash ```bash
uv run main.py --interactive uv run main.py --interactive
``` ```
@@ -415,17 +470,21 @@ DeerFlowには人間参加型ループメカニズムが含まれており、研
1. **計画レビュー**:人間参加型ループが有効な場合、システムは実行前に生成された研究計画を表示 1. **計画レビュー**:人間参加型ループが有効な場合、システムは実行前に生成された研究計画を表示
2. **フィードバック提供**:次のことができます: 2. **フィードバック提供**:次のことができます:
- `[ACCEPTED]`と返信して計画を承認 - `[ACCEPTED]`と返信して計画を承認
- フィードバックを提供して計画を編集(例:`[EDIT PLAN] 技術実装に関するステップをさらに追加する` - フィードバックを提供して計画を編集(例:`[EDIT PLAN] 技術実装に関するステップをさらに追加する`
- システムはフィードバックを統合し、修正された計画を生成 - システムはフィードバックを統合し、修正された計画を生成
3. **自動承認**:レビュープロセスをスキップするために自動承認を有効にできます: 3. **自動承認**:レビュープロセスをスキップするために自動承認を有効にできます:
- API 経由:リクエストで`auto_accepted_plan: true`を設定 - API 経由:リクエストで`auto_accepted_plan: true`を設定
4. **API 統合**API を使用する場合、`feedback`パラメータでフィードバックを提供できます: 4. **API 統合**API を使用する場合、`feedback`パラメータでフィードバックを提供できます:
```json ```json
{ {
"messages": [{"role": "user", "content": "量子コンピューティングとは何ですか?"}], "messages": [
{ "role": "user", "content": "量子コンピューティングとは何ですか?" }
],
"thread_id": "my_thread_id", "thread_id": "my_thread_id",
"auto_accepted_plan": false, "auto_accepted_plan": false,
"feedback": "[EDIT PLAN] 量子アルゴリズムについてもっと含める" "feedback": "[EDIT PLAN] 量子アルゴリズムについてもっと含める"
@@ -462,6 +521,7 @@ DeerFlowはオープンソースコミュニティの素晴らしい成果の上
これらのプロジェクトはオープンソースコラボレーションの変革力を示しており、その基盤の上に構築できることを誇りに思います。 これらのプロジェクトはオープンソースコラボレーションの変革力を示しており、その基盤の上に構築できることを誇りに思います。
### 主要貢献者 ### 主要貢献者
`DeerFlow`の主要な作者に心から感謝します。彼らのビジョン、情熱、献身がこのプロジェクトを実現しました: `DeerFlow`の主要な作者に心から感謝します。彼らのビジョン、情熱、献身がこのプロジェクトを実現しました:
- **[Daniel Walnut](https://github.com/hetaoBackend/)** - **[Daniel Walnut](https://github.com/hetaoBackend/)**

View File

@@ -18,6 +18,7 @@
https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
在此演示中,我们展示了如何使用 DeerFlow 在此演示中,我们展示了如何使用 DeerFlow
- 无缝集成 MCP 服务 - 无缝集成 MCP 服务
- 进行深度研究过程并生成包含图像的综合报告 - 进行深度研究过程并生成包含图像的综合报告
- 基于生成的报告创建播客音频 - 基于生成的报告创建播客音频
@@ -32,7 +33,6 @@ https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
--- ---
## 📑 目录 ## 📑 目录
- [🚀 快速开始](#快速开始) - [🚀 快速开始](#快速开始)
@@ -46,12 +46,12 @@ https://github.com/user-attachments/assets/f3786598-1f2a-4d07-919e-8b99dfa1de3e
- [💖 致谢](#致谢) - [💖 致谢](#致谢)
- [⭐ Star History](#star-History) - [⭐ Star History](#star-History)
## 快速开始 ## 快速开始
DeerFlow 使用 Python 开发,并配有用 Node.js 编写的 Web UI。为确保顺利的设置过程我们推荐使用以下工具 DeerFlow 使用 Python 开发,并配有用 Node.js 编写的 Web UI。为确保顺利的设置过程我们推荐使用以下工具
### 推荐工具 ### 推荐工具
- **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):** - **[`uv`](https://docs.astral.sh/uv/getting-started/installation/):**
简化 Python 环境和依赖管理。`uv`会自动在根目录创建虚拟环境并为您安装所有必需的包—无需手动安装 Python 环境。 简化 Python 环境和依赖管理。`uv`会自动在根目录创建虚拟环境并为您安装所有必需的包—无需手动安装 Python 环境。
@@ -62,11 +62,14 @@ DeerFlow使用Python开发并配有用Node.js编写的Web UI。为确保顺
安装和管理 Node.js 项目的依赖。 安装和管理 Node.js 项目的依赖。
### 环境要求 ### 环境要求
确保您的系统满足以下最低要求: 确保您的系统满足以下最低要求:
- **[Python](https://www.python.org/downloads/):** 版本 `3.12+` - **[Python](https://www.python.org/downloads/):** 版本 `3.12+`
- **[Node.js](https://nodejs.org/en/download/):** 版本 `22+` - **[Node.js](https://nodejs.org/en/download/):** 版本 `22+`
### 安装 ### 安装
```bash ```bash
# 克隆仓库 # 克隆仓库
git clone https://github.com/bytedance/deer-flow.git git clone https://github.com/bytedance/deer-flow.git
@@ -118,6 +121,7 @@ uv run main.py
### Web UI ### Web UI
本项目还包括一个 Web UI提供更加动态和引人入胜的交互体验。 本项目还包括一个 Web UI提供更加动态和引人入胜的交互体验。
> [!注意] > [!注意]
> 您需要先安装 Web UI 的依赖。 > 您需要先安装 Web UI 的依赖。
@@ -134,19 +138,21 @@ bootstrap.bat -d
在[`web`](./web/)目录中探索更多详情。 在[`web`](./web/)目录中探索更多详情。
## 支持的搜索引擎 ## 支持的搜索引擎
DeerFlow 支持多种搜索引擎,可以在`.env`文件中通过`SEARCH_API`变量进行配置: DeerFlow 支持多种搜索引擎,可以在`.env`文件中通过`SEARCH_API`变量进行配置:
- **Tavily**(默认):专为 AI 应用设计的专业搜索 API - **Tavily**(默认):专为 AI 应用设计的专业搜索 API
- 需要在`.env`文件中设置`TAVILY_API_KEY` - 需要在`.env`文件中设置`TAVILY_API_KEY`
- 注册地址https://app.tavily.com/home - 注册地址https://app.tavily.com/home
- **DuckDuckGo**:注重隐私的搜索引擎 - **DuckDuckGo**:注重隐私的搜索引擎
- 无需 API 密钥 - 无需 API 密钥
- **Brave Search**:具有高级功能的注重隐私的搜索引擎 - **Brave Search**:具有高级功能的注重隐私的搜索引擎
- 需要在`.env`文件中设置`BRAVE_SEARCH_API_KEY` - 需要在`.env`文件中设置`BRAVE_SEARCH_API_KEY`
- 注册地址https://brave.com/search/api/ - 注册地址https://brave.com/search/api/
@@ -174,6 +180,7 @@ SEARCH_API=tavily
### 工具和 MCP 集成 ### 工具和 MCP 集成
- 🔍 **搜索和检索** - 🔍 **搜索和检索**
- 通过 Tavily、Brave Search 等进行网络搜索 - 通过 Tavily、Brave Search 等进行网络搜索
- 使用 Jina 进行爬取 - 使用 Jina 进行爬取
- 高级内容提取 - 高级内容提取
@@ -185,6 +192,7 @@ SEARCH_API=tavily
### 人机协作 ### 人机协作
- 🧠 **人在环中** - 🧠 **人在环中**
- 支持使用自然语言交互式修改研究计划 - 支持使用自然语言交互式修改研究计划
- 支持自动接受研究计划 - 支持自动接受研究计划
@@ -200,27 +208,30 @@ SEARCH_API=tavily
- 自动创建简单的 PowerPoint 演示文稿 - 自动创建简单的 PowerPoint 演示文稿
- 可定制模板以满足个性化内容需求 - 可定制模板以满足个性化内容需求
## 架构 ## 架构
DeerFlow 实现了一个模块化的多智能体系统架构,专为自动化研究和代码分析而设计。该系统基于 LangGraph 构建,实现了灵活的基于状态的工作流,其中组件通过定义良好的消息传递系统进行通信。 DeerFlow 实现了一个模块化的多智能体系统架构,专为自动化研究和代码分析而设计。该系统基于 LangGraph 构建,实现了灵活的基于状态的工作流,其中组件通过定义良好的消息传递系统进行通信。
![架构图](./assets/architecture.png) ![架构图](./assets/architecture.png)
> 在[deerflow.tech](https://deerflow.tech/#multi-agent-architecture)上查看实时演示 > 在[deerflow.tech](https://deerflow.tech/#multi-agent-architecture)上查看实时演示
系统采用了精简的工作流程,包含以下组件: 系统采用了精简的工作流程,包含以下组件:
1. **协调器**:管理工作流生命周期的入口点 1. **协调器**:管理工作流生命周期的入口点
- 根据用户输入启动研究过程 - 根据用户输入启动研究过程
- 在适当时候将任务委派给规划器 - 在适当时候将任务委派给规划器
- 作为用户和系统之间的主要接口 - 作为用户和系统之间的主要接口
2. **规划器**:负责任务分解和规划的战略组件 2. **规划器**:负责任务分解和规划的战略组件
- 分析研究目标并创建结构化执行计划 - 分析研究目标并创建结构化执行计划
- 确定是否有足够的上下文或是否需要更多研究 - 确定是否有足够的上下文或是否需要更多研究
- 管理研究流程并决定何时生成最终报告 - 管理研究流程并决定何时生成最终报告
3. **研究团队**:执行计划的专业智能体集合: 3. **研究团队**:执行计划的专业智能体集合:
- **研究员**:使用网络搜索引擎、爬虫甚至 MCP 服务等工具进行网络搜索和信息收集。 - **研究员**:使用网络搜索引擎、爬虫甚至 MCP 服务等工具进行网络搜索和信息收集。
- **编码员**:使用 Python REPL 工具处理代码分析、执行和技术任务。 - **编码员**:使用 Python REPL 工具处理代码分析、执行和技术任务。
每个智能体都可以访问针对其角色优化的特定工具,并在 LangGraph 框架内运行 每个智能体都可以访问针对其角色优化的特定工具,并在 LangGraph 框架内运行
@@ -230,28 +241,6 @@ DeerFlow实现了一个模块化的多智能体系统架构专为自动化研
- 处理和组织收集的信息 - 处理和组织收集的信息
- 生成全面的研究报告 - 生成全面的研究报告
## 文本转语音集成
DeerFlow现在包含一个文本转语音(TTS)功能允许您将研究报告转换为语音。此功能使用火山引擎TTS API生成高质量的文本音频。速度、音量和音调等特性也可以自定义。
### 使用TTS API
您可以通过`/api/tts`端点访问TTS功能
```bash
# 使用curl的API调用示例
curl --location 'http://localhost:8000/api/tts' \
--header 'Content-Type: application/json' \
--data '{
"text": "这是文本转语音功能的测试。",
"speed_ratio": 1.0,
"volume_ratio": 1.0,
"pitch_ratio": 1.0
}' \
--output speech.mp3
```
## 开发 ## 开发
### 测试 ### 测试
@@ -309,6 +298,7 @@ langgraph dev
``` ```
启动 LangGraph 服务器后,您将在终端中看到几个 URL 启动 LangGraph 服务器后,您将在终端中看到几个 URL
- API: http://127.0.0.1:2024 - API: http://127.0.0.1:2024
- Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024 - Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
- API 文档: http://127.0.0.1:2024/docs - API 文档: http://127.0.0.1:2024/docs
@@ -326,11 +316,67 @@ langgraph dev
5. 在规划阶段提供反馈以完善研究计划 5. 在规划阶段提供反馈以完善研究计划
当您在 Studio UI 中提交研究主题时,您将能够看到整个工作流执行过程,包括: 当您在 Studio UI 中提交研究主题时,您将能够看到整个工作流执行过程,包括:
- 创建研究计划的规划阶段 - 创建研究计划的规划阶段
- 可以修改计划的反馈循环 - 可以修改计划的反馈循环
- 每个部分的研究和写作阶段 - 每个部分的研究和写作阶段
- 最终报告生成 - 最终报告生成
## Docker
您也可以使用 Docker 运行此项目。
首先,您需要阅读下面的[配置](#配置)部分。确保`.env``.conf.yaml`文件已准备就绪。
其次,构建您自己的 Web 服务器 Docker 镜像:
```bash
docker build -t deer-flow-api .
```
最后,启动运行 Web 服务器的 Docker 容器:
```bash
# 将deer-flow-api-app替换为您首选的容器名称
docker run -d -t -p 8000:8000 --env-file .env --name deer-flow-api-app deer-flow-api
# 停止服务器
docker stop deer-flow-api-app
```
### Docker Compose
您也可以使用 docker compose 设置此项目:
```bash
# 构建docker镜像
docker compose build
# 启动服务器
docker compose up
```
## 文本转语音集成
DeerFlow 现在包含一个文本转语音(TTS)功能,允许您将研究报告转换为语音。此功能使用火山引擎 TTS API 生成高质量的文本音频。速度、音量和音调等特性也可以自定义。
### 使用 TTS API
您可以通过`/api/tts`端点访问 TTS 功能:
```bash
# 使用curl的API调用示例
curl --location 'http://localhost:8000/api/tts' \
--header 'Content-Type: application/json' \
--data '{
"text": "这是文本转语音功能的测试。",
"speed_ratio": 1.0,
"volume_ratio": 1.0,
"pitch_ratio": 1.0
}' \
--output speech.mp3
```
## 示例 ## 示例
以下示例展示了 DeerFlow 的功能: 以下示例展示了 DeerFlow 的功能:
@@ -338,35 +384,43 @@ langgraph dev
### 研究报告 ### 研究报告
1. **OpenAI Sora 报告** - OpenAI 的 Sora AI 工具分析 1. **OpenAI Sora 报告** - OpenAI 的 Sora AI 工具分析
- 讨论功能、访问方式、提示工程、限制和伦理考虑 - 讨论功能、访问方式、提示工程、限制和伦理考虑
- [查看完整报告](examples/openai_sora_report.md) - [查看完整报告](examples/openai_sora_report.md)
2. **Google 的 Agent to Agent 协议报告** - Google 的 Agent to Agent (A2A)协议概述 2. **Google 的 Agent to Agent 协议报告** - Google 的 Agent to Agent (A2A)协议概述
- 讨论其在 AI 智能体通信中的作用及其与 Anthropic 的 Model Context Protocol (MCP)的关系 - 讨论其在 AI 智能体通信中的作用及其与 Anthropic 的 Model Context Protocol (MCP)的关系
- [查看完整报告](examples/what_is_agent_to_agent_protocol.md) - [查看完整报告](examples/what_is_agent_to_agent_protocol.md)
3. **什么是 MCP** - 对"MCP"一词在多个上下文中的全面分析 3. **什么是 MCP** - 对"MCP"一词在多个上下文中的全面分析
- 探讨 AI 中的 Model Context Protocol、化学中的 Monocalcium Phosphate 和电子学中的 Micro-channel Plate - 探讨 AI 中的 Model Context Protocol、化学中的 Monocalcium Phosphate 和电子学中的 Micro-channel Plate
- [查看完整报告](examples/what_is_mcp.md) - [查看完整报告](examples/what_is_mcp.md)
4. **比特币价格波动** - 最近比特币价格走势分析 4. **比特币价格波动** - 最近比特币价格走势分析
- 研究市场趋势、监管影响和技术指标 - 研究市场趋势、监管影响和技术指标
- 基于历史数据提供建议 - 基于历史数据提供建议
- [查看完整报告](examples/bitcoin_price_fluctuation.md) - [查看完整报告](examples/bitcoin_price_fluctuation.md)
5. **什么是 LLM** - 对大型语言模型的深入探索 5. **什么是 LLM** - 对大型语言模型的深入探索
- 讨论架构、训练、应用和伦理考虑 - 讨论架构、训练、应用和伦理考虑
- [查看完整报告](examples/what_is_llm.md) - [查看完整报告](examples/what_is_llm.md)
6. **如何使用 Claude 进行深度研究?** - 在深度研究中使用 Claude 的最佳实践和工作流程 6. **如何使用 Claude 进行深度研究?** - 在深度研究中使用 Claude 的最佳实践和工作流程
- 涵盖提示工程、数据分析和与其他工具的集成 - 涵盖提示工程、数据分析和与其他工具的集成
- [查看完整报告](examples/how_to_use_claude_deep_research.md) - [查看完整报告](examples/how_to_use_claude_deep_research.md)
7. **医疗保健中的 AI 采用:影响因素** - 影响医疗保健中 AI 采用的因素分析 7. **医疗保健中的 AI 采用:影响因素** - 影响医疗保健中 AI 采用的因素分析
- 讨论 AI 技术、数据质量、伦理考虑、经济评估、组织准备度和数字基础设施 - 讨论 AI 技术、数据质量、伦理考虑、经济评估、组织准备度和数字基础设施
- [查看完整报告](examples/AI_adoption_in_healthcare.md) - [查看完整报告](examples/AI_adoption_in_healthcare.md)
8. **量子计算对密码学的影响** - 量子计算对密码学影响的分析 8. **量子计算对密码学的影响** - 量子计算对密码学影响的分析
- 讨论经典密码学的漏洞、后量子密码学和抗量子密码解决方案 - 讨论经典密码学的漏洞、后量子密码学和抗量子密码解决方案
- [查看完整报告](examples/Quantum_Computing_Impact_on_Cryptography.md) - [查看完整报告](examples/Quantum_Computing_Impact_on_Cryptography.md)
@@ -398,6 +452,7 @@ uv run main.py --help
应用程序现在支持带有英文和中文内置问题的交互模式: 应用程序现在支持带有英文和中文内置问题的交互模式:
1. 启动交互模式: 1. 启动交互模式:
```bash ```bash
uv run main.py --interactive uv run main.py --interactive
``` ```
@@ -415,11 +470,13 @@ DeerFlow包含一个人在环中机制允许您在执行研究计划前审查
1. **计划审查**:启用人在环中时,系统将在执行前向您展示生成的研究计划 1. **计划审查**:启用人在环中时,系统将在执行前向您展示生成的研究计划
2. **提供反馈**:您可以: 2. **提供反馈**:您可以:
- 通过回复`[ACCEPTED]`接受计划 - 通过回复`[ACCEPTED]`接受计划
- 通过提供反馈编辑计划(例如,`[EDIT PLAN] 添加更多关于技术实现的步骤` - 通过提供反馈编辑计划(例如,`[EDIT PLAN] 添加更多关于技术实现的步骤`
- 系统将整合您的反馈并生成修订后的计划 - 系统将整合您的反馈并生成修订后的计划
3. **自动接受**:您可以启用自动接受以跳过审查过程: 3. **自动接受**:您可以启用自动接受以跳过审查过程:
- 通过 API在请求中设置`auto_accepted_plan: true` - 通过 API在请求中设置`auto_accepted_plan: true`
4. **API 集成**:使用 API 时,您可以通过`feedback`参数提供反馈: 4. **API 集成**:使用 API 时,您可以通过`feedback`参数提供反馈:
@@ -462,6 +519,7 @@ DeerFlow建立在开源社区的杰出工作基础之上。我们深深感谢所
这些项目展示了开源协作的变革力量,我们很自豪能够在他们的基础上构建。 这些项目展示了开源协作的变革力量,我们很自豪能够在他们的基础上构建。
### 核心贡献者 ### 核心贡献者
衷心感谢`DeerFlow`的核心作者,他们的愿景、热情和奉献使这个项目得以实现: 衷心感谢`DeerFlow`的核心作者,他们的愿景、热情和奉献使这个项目得以实现:
- **[Daniel Walnut](https://github.com/hetaoBackend/)** - **[Daniel Walnut](https://github.com/hetaoBackend/)**

36
docker-compose.yml Normal file
View File

@@ -0,0 +1,36 @@
services:
backend:
build:
context: .
dockerfile: Dockerfile
container_name: deer-flow-backend
ports:
- "8000:8000"
env_file:
- .env
volumes:
- ./conf.yaml:/app/conf.yaml
restart: unless-stopped
networks:
- deer-flow-network
frontend:
build:
context: ./web
dockerfile: Dockerfile
args:
- NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL
container_name: deer-flow-frontend
ports:
- "3000:3000"
env_file:
- .env
depends_on:
- backend
restart: unless-stopped
networks:
- deer-flow-network
networks:
deer-flow-network:
driver: bridge

8
web/.dockerignore Normal file
View File

@@ -0,0 +1,8 @@
.env
Dockerfile
.dockerignore
node_modules
npm-debug.log
README.md
.next
.git

55
web/Dockerfile Normal file
View File

@@ -0,0 +1,55 @@
##### DEPENDENCIES
FROM node:20-alpine AS deps
RUN apk add --no-cache libc6-compat openssl
WORKDIR /app
# Install dependencies based on the preferred package manager
COPY package.json yarn.lock* package-lock.json* pnpm-lock.yaml\* ./
RUN \
if [ -f yarn.lock ]; then yarn --frozen-lockfile; \
elif [ -f package-lock.json ]; then npm ci; \
elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && pnpm i; \
else echo "Lockfile not found." && exit 1; \
fi
##### BUILDER
FROM node:20-alpine AS builder
WORKDIR /app
ARG NEXT_PUBLIC_API_URL
COPY --from=deps /app/node_modules ./node_modules
COPY . .
ENV NEXT_TELEMETRY_DISABLED=1
RUN \
if [ -f yarn.lock ]; then SKIP_ENV_VALIDATION=1 yarn build; \
elif [ -f package-lock.json ]; then SKIP_ENV_VALIDATION=1 npm run build; \
elif [ -f pnpm-lock.yaml ]; then npm install -g pnpm && SKIP_ENV_VALIDATION=1 pnpm run build; \
else echo "Lockfile not found." && exit 1; \
fi
##### RUNNER
FROM gcr.io/distroless/nodejs20-debian12 AS runner
WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
COPY --from=builder /app/next.config.js ./
COPY --from=builder /app/public ./public
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
EXPOSE 3000
ENV PORT=3000
CMD ["server.js"]

View File

@@ -6,6 +6,26 @@
This is the web UI for [`DeerFlow`](https://github.com/bytedance/deer-flow). This is the web UI for [`DeerFlow`](https://github.com/bytedance/deer-flow).
## Quick Start
### Prerequisites
- [`DeerFlow`](https://github.com/bytedance/deer-flow)
- Node.js (v22.14.0+)
- pnpm (v10.6.2+) as package manager
### Configuration
Create a `.env` file in the project root and configure the following environment variables:
- `NEXT_PUBLIC_API_URL`: The URL of the deer-flow API.
It's always a good idea to start with the given example file, and edit the `.env` file with your own values:
```bash
cp .env.example .env
```
## How to Install ## How to Install
DeerFlow Web UI uses `pnpm` as its package manager. DeerFlow Web UI uses `pnpm` as its package manager.
@@ -37,6 +57,39 @@ You can set the `NEXT_PUBLIC_API_URL` environment variable if you're using a dif
NEXT_PUBLIC_API_URL=http://localhost:8000/api NEXT_PUBLIC_API_URL=http://localhost:8000/api
``` ```
## Docker
You can also run this project with Docker.
First, you need read the [configuration](#configuration) below. Make sure `.env` file is ready.
Second, to build a Docker image of your own web server:
```bash
docker build --build-arg NEXT_PUBLIC_API_URL=YOUR_DEER-FLOW_API -t deer-flow-web .
```
Final, start up a docker container running the web server:
```bash
# Replace deer-flow-web-app with your preferred container name
docker run -d -t -p 3000:3000 --env-file .env --name deer-flow-web-app deer-flow-web
# stop the server
docker stop deer-flow-web-app
```
### Docker Compose
You can also setup this project with the docker compose:
```bash
# building docker image
docker compose build
# start the server
docker compose up
```
## License ## License
@@ -48,11 +101,12 @@ We extend our heartfelt gratitude to the open source community for their invalua
DeerFlow is built upon the foundation of these outstanding projects: DeerFlow is built upon the foundation of these outstanding projects:
In particular, we want to express our deep appreciation for: In particular, we want to express our deep appreciation for:
* [Next.js](https://nextjs.org/) for their exceptional framework
* [Shadcn](https://ui.shadcn.com/) for their minimalistic components that powers our UI - [Next.js](https://nextjs.org/) for their exceptional framework
* [Zustand](https://zustand.docs.pmnd.rs/) for their stunning state management - [Shadcn](https://ui.shadcn.com/) for their minimalistic components that powers our UI
* [Framer Motion](https://www.framer.com/motion/) for their amazing animation library - [Zustand](https://zustand.docs.pmnd.rs/) for their stunning state management
* [React Markdown](https://www.npmjs.com/package/react-markdown) for their exceptional markdown rendering and customizability - [Framer Motion](https://www.framer.com/motion/) for their amazing animation library
* Last but not least, special thanks to [SToneX](https://github.com/stonexer) for his great contribution for [token-by-token visual effect](./src/core/rehype/rehype-split-words-into-spans.ts) - [React Markdown](https://www.npmjs.com/package/react-markdown) for their exceptional markdown rendering and customizability
- Last but not least, special thanks to [SToneX](https://github.com/stonexer) for his great contribution for [token-by-token visual effect](./src/core/rehype/rehype-split-words-into-spans.ts)
These outstanding projects form the backbone of DeerFlow and exemplify the transformative power of open source collaboration. These outstanding projects form the backbone of DeerFlow and exemplify the transformative power of open source collaboration.

12
web/docker-compose.yml Normal file
View File

@@ -0,0 +1,12 @@
services:
deer-flow-web:
build:
context: .
dockerfile: Dockerfile
args:
NEXT_PUBLIC_API_URL: ${NEXT_PUBLIC_API_URL}
image: deer-flow-web
ports:
- "3000:3000"
env_file:
- .env

View File

@@ -34,6 +34,9 @@ const config = {
}); });
return config; return config;
}, },
// ... rest of the configuration.
output: "standalone",
}; };
export default config; export default config;