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

122
README.md
View File

@@ -3,6 +3,7 @@
[![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)
[![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/ -->
[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
In this demo, we showcase how to use DeerFlow to:
- Seamlessly integrate with MCP services
- Conduct the Deep Research process and produce a comprehensive report with images
- 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
- [🚀 Quick Start](#quick-start)
- [🌟 Features](#features)
- [🏗️ Architecture](#architecture)
- [🛠️ Development](#development)
- [🐳 Docker](#docker)
- [🗣️ Text-to-Speech Integration](#text-to-speech-integration)
- [📚 Examples](#examples)
- [❓ FAQ](#faq)
@@ -48,12 +50,12 @@ In this demo, we showcase how to use DeerFlow to:
- [💖 Acknowledgments](#acknowledgments)
- [⭐ Star History](#star-history)
## 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:
### Recommended Tools
- **[`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.
@@ -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.
### Environment Requirements
Make sure your system meets the following minimum requirements:
- **[Python](https://www.python.org/downloads/):** Version `3.12+`
- **[Node.js](https://nodejs.org/en/download/):** Version `22+`
### Installation
```bash
# Clone the repository
git clone https://github.com/bytedance/deer-flow.git
@@ -120,6 +125,7 @@ uv run main.py
### Web UI
This project also includes a Web UI, offering a more dynamic and engaging interactive experience.
> [!NOTE]
> You need to install the dependencies of web UI first.
@@ -136,25 +142,27 @@ Open your browser and visit [`http://localhost:3000`](http://localhost:3000) to
Explore more details in the [`web`](./web/) directory.
## Supported Search Engines
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
- Requires `TAVILY_API_KEY` in your `.env` file
- Sign up at: https://app.tavily.com/home
- Requires `TAVILY_API_KEY` in your `.env` file
- Sign up at: https://app.tavily.com/home
- **DuckDuckGo**: Privacy-focused search engine
- No API key required
- No API key required
- **Brave Search**: Privacy-focused search engine with advanced features
- Requires `BRAVE_SEARCH_API_KEY` in your `.env` file
- Sign up at: https://brave.com/search/api/
- Requires `BRAVE_SEARCH_API_KEY` in your `.env` file
- Sign up at: https://brave.com/search/api/
- **Arxiv**: Scientific paper search for academic research
- No API key required
- Specialized for scientific and academic papers
- No API key required
- Specialized for scientific and academic papers
To configure your preferred search engine, set the `SEARCH_API` variable in your `.env` file:
@@ -168,64 +176,69 @@ SEARCH_API=tavily
### Core Capabilities
- 🤖 **LLM Integration**
- It supports the integration of most models through [litellm](https://docs.litellm.ai/docs/providers).
- Support for open source models like Qwen
- OpenAI-compatible API interface
- Multi-tier LLM system for different task complexities
- It supports the integration of most models through [litellm](https://docs.litellm.ai/docs/providers).
- Support for open source models like Qwen
- OpenAI-compatible API interface
- Multi-tier LLM system for different task complexities
### Tools and MCP Integrations
- 🔍 **Search and Retrieval**
- Web search via Tavily, Brave Search and more
- Crawling with Jina
- Advanced content extraction
- Web search via Tavily, Brave Search and more
- Crawling with Jina
- Advanced content extraction
- 🔗 **MCP Seamless Integration**
- Expand capabilities for private domain access, knowledge graph, web browsing and more
- Facilitates integration of diverse research tools and methodologies
- Expand capabilities for private domain access, knowledge graph, web browsing and more
- Facilitates integration of diverse research tools and methodologies
### Human Collaboration
- 🧠 **Human-in-the-loop**
- Supports interactive modification of research plans using natural language
- Supports auto-acceptance of research plans
- Supports interactive modification of research plans using natural language
- Supports auto-acceptance of research plans
- 📝 **Report Post-Editing**
- Supports Notion-like block editing
- Allows AI refinements, including AI-assisted polishing, sentence shortening, and expansion
- Powered by [tiptap](https://tiptap.dev/)
- Supports Notion-like block editing
- Allows AI refinements, including AI-assisted polishing, sentence shortening, and expansion
- Powered by [tiptap](https://tiptap.dev/)
### Content Creation
- 🎙️ **Podcast and Presentation Generation**
- AI-powered podcast script generation and audio synthesis
- Automated creation of simple PowerPoint presentations
- Customizable templates for tailored content
- AI-powered podcast script generation and audio synthesis
- Automated creation of simple PowerPoint presentations
- Customizable templates for tailored content
## 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.
![Architecture Diagram](./assets/architecture.png)
> See it live at [deerflow.tech](https://deerflow.tech/#multi-agent-architecture)
The system employs a streamlined workflow with the following components:
1. **Coordinator**: The entry point that manages the workflow lifecycle
- Initiates the research process based on user input
- Delegates tasks to the planner when appropriate
- Acts as the primary interface between the user and the system
2. **Planner**: Strategic component for task decomposition and planning
- Analyzes research objectives and creates structured execution plans
- Determines if enough context is available or if more research is needed
- Manages the research flow and decides when to generate the final report
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.
- **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
4. **Reporter**: Final stage processor for research outputs
- Aggregates findings from the research team
@@ -253,7 +266,6 @@ curl --location 'http://localhost:8000/api/tts' \
--output speech.mp3
```
## Development
### Testing
@@ -311,6 +323,7 @@ langgraph dev
```
After starting the LangGraph server, you'll see several URLs in the terminal:
- API: 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
@@ -328,11 +341,46 @@ In the Studio UI, you can:
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:
- The planning phase where the research plan is created
- The feedback loop where you can modify the plan
- The research and writing phases for each section
- 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
The following examples demonstrate the capabilities of DeerFlow:
@@ -340,35 +388,43 @@ The following examples demonstrate the capabilities of DeerFlow:
### Research Reports
1. **OpenAI Sora Report** - Analysis of OpenAI's Sora AI tool
- Discusses features, access, prompt engineering, limitations, and ethical considerations
- [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
- 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)
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
- [View full report](examples/what_is_mcp.md)
4. **Bitcoin Price Fluctuations** - Analysis of recent Bitcoin price movements
- Examines market trends, regulatory influences, and technical indicators
- Provides recommendations based on historical data
- [View full report](examples/bitcoin_price_fluctuation.md)
5. **What is LLM?** - An in-depth exploration of Large Language Models
- Discusses architecture, training, applications, and ethical considerations
- [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
- Covers prompt engineering, data analysis, and integration with other tools
- [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
- Discusses AI technologies, data quality, ethical considerations, economic evaluations, organizational readiness, and digital infrastructure
- [View full report](examples/AI_adoption_in_healthcare.md)
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
- [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:
1. Launch the interactive mode:
```bash
uv run main.py --interactive
```
@@ -417,17 +474,19 @@ 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
2. **Providing Feedback**: You can:
- Accept the plan by responding with `[ACCEPTED]`
- 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
3. **Auto-acceptance**: You can enable auto-acceptance to skip the review process:
- 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:
```json
{
"messages": [{"role": "user", "content": "What is quantum computing?"}],
"messages": [{ "role": "user", "content": "What is quantum computing?" }],
"thread_id": "my_thread_id",
"auto_accepted_plan": false,
"feedback": "[EDIT PLAN] Include more about quantum algorithms"
@@ -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.
### 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:
- **[Daniel Walnut](https://github.com/hetaoBackend/)**