mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-21 15:36:48 +00:00
docs: complete all English and Chinese documentation pages
Agent-Logs-Url: https://github.com/bytedance/deer-flow/sessions/a5f192e7-8034-4e46-af22-60b90ee27d40 Co-authored-by: foreleven <4785594+foreleven@users.noreply.github.com>
This commit is contained in:
committed by
jiangfeng.11
parent
69bf3dafd8
commit
2d5f6f1b3d
@@ -1,3 +1,99 @@
|
||||
import { Callout, Steps } from "nextra/components";
|
||||
|
||||
# Create Your First Harness
|
||||
|
||||
TBD
|
||||
This tutorial shows you how to use the DeerFlow Harness programmatically — importing and using DeerFlow directly in your Python code rather than through the web interface.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Python 3.12+
|
||||
- `uv` installed
|
||||
- DeerFlow repository cloned
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
cd deer-flow/backend
|
||||
uv sync
|
||||
```
|
||||
|
||||
## Create configuration
|
||||
|
||||
Create a minimal `config.yaml`:
|
||||
|
||||
```yaml
|
||||
config_version: 6
|
||||
|
||||
models:
|
||||
- name: gpt-4o
|
||||
use: langchain_openai:ChatOpenAI
|
||||
model: gpt-4o
|
||||
api_key: $OPENAI_API_KEY
|
||||
|
||||
sandbox:
|
||||
use: deerflow.sandbox.local:LocalSandboxProvider
|
||||
|
||||
tools:
|
||||
- use: deerflow.community.ddg_search.tools:web_search_tool
|
||||
- use: deerflow.sandbox.tools:read_file_tool
|
||||
- use: deerflow.sandbox.tools:write_file_tool
|
||||
```
|
||||
|
||||
## Write the code
|
||||
|
||||
<Steps>
|
||||
|
||||
### Create a Python file
|
||||
|
||||
Create `my_agent.py` in the `backend/` directory:
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
import os
|
||||
from deerflow.client import DeerFlowClient
|
||||
from deerflow.config import load_config
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-..."
|
||||
|
||||
# Load config.yaml
|
||||
load_config()
|
||||
|
||||
client = DeerFlowClient()
|
||||
|
||||
async def main():
|
||||
async for event in client.astream(
|
||||
thread_id="my-first-thread",
|
||||
message="Write a Python fibonacci function with a docstring",
|
||||
config={
|
||||
"configurable": {
|
||||
"model_name": "gpt-4o",
|
||||
}
|
||||
},
|
||||
):
|
||||
print(event)
|
||||
|
||||
asyncio.run(main())
|
||||
```
|
||||
|
||||
### Run it
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
uv run python my_agent.py
|
||||
```
|
||||
|
||||
</Steps>
|
||||
|
||||
## What the events look like
|
||||
|
||||
The stream yields events like:
|
||||
|
||||
```python
|
||||
{"type": "messages", "data": {"content": "def fibonacci..."}}
|
||||
{"type": "thread_state", "data": {"title": "Python Fibonacci Function"}}
|
||||
```
|
||||
|
||||
## Next steps
|
||||
|
||||
- [Use Tools and Skills](/docs/tutorials/use-tools-and-skills)
|
||||
- [Harness Quick Start](/docs/harness/quick-start)
|
||||
|
||||
@@ -1,3 +1,74 @@
|
||||
import { Callout, Steps } from "nextra/components";
|
||||
|
||||
# Deploy Your Own DeerFlow
|
||||
|
||||
TBD
|
||||
This tutorial guides you through deploying DeerFlow to a production environment using Docker Compose for multi-user access.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Docker and Docker Compose installed
|
||||
- A server or VM (Linux recommended)
|
||||
- LLM API key
|
||||
|
||||
## Steps
|
||||
|
||||
<Steps>
|
||||
|
||||
### Clone the repository
|
||||
|
||||
```bash
|
||||
git clone https://github.com/bytedance/deer-flow.git
|
||||
cd deer-flow
|
||||
```
|
||||
|
||||
### Create the configuration file
|
||||
|
||||
```bash
|
||||
cp config.example.yaml config.yaml
|
||||
```
|
||||
|
||||
Edit `config.yaml` to add your model configuration.
|
||||
|
||||
### Create the environment variables file
|
||||
|
||||
```bash
|
||||
cat > .env << EOF
|
||||
OPENAI_API_KEY=sk-your-key-here
|
||||
DEER_FLOW_ROOT=$(pwd)
|
||||
BETTER_AUTH_SECRET=$(openssl rand -base64 32)
|
||||
BETTER_AUTH_URL=https://your-domain.com
|
||||
EOF
|
||||
```
|
||||
|
||||
### Start the services
|
||||
|
||||
```bash
|
||||
docker compose -f docker/docker-compose-dev.yaml up -d
|
||||
```
|
||||
|
||||
### Verify the deployment
|
||||
|
||||
```bash
|
||||
# Check all services are healthy
|
||||
curl http://localhost:2026/api/models
|
||||
|
||||
# Follow logs
|
||||
docker compose -f docker/docker-compose-dev.yaml logs -f
|
||||
```
|
||||
|
||||
Open `http://your-server:2026` in your browser.
|
||||
|
||||
</Steps>
|
||||
|
||||
## Production checklist
|
||||
|
||||
- Configure HTTPS/TLS for nginx
|
||||
- Set `BETTER_AUTH_SECRET` to a strong random string (minimum 32 characters)
|
||||
- Configure firewall rules to allow only necessary ports
|
||||
- Back up `backend/.deer-flow/` directory regularly
|
||||
- Consider using a container-based sandbox (`AioSandboxProvider`) for multi-user isolation
|
||||
|
||||
## Next steps
|
||||
|
||||
- [Full Deployment Guide](/docs/application/deployment-guide)
|
||||
- [Operations and Troubleshooting](/docs/application/operations-and-troubleshooting)
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
import { Callout, Steps } from "nextra/components";
|
||||
|
||||
# First Conversation
|
||||
|
||||
TBD
|
||||
This tutorial walks you through your first complete agent conversation in DeerFlow — from launching the app to getting meaningful work done with the agent.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- DeerFlow app is running (see [Quick Start](/docs/application/quick-start))
|
||||
- At least one model is configured in `config.yaml`
|
||||
|
||||
## Steps
|
||||
|
||||
<Steps>
|
||||
|
||||
### Open the workspace
|
||||
|
||||
Open [http://localhost:2026](http://localhost:2026) in your browser. You will see the conversation workspace.
|
||||
|
||||
### Send your first message
|
||||
|
||||
Type a question in the input box, for example:
|
||||
|
||||
```
|
||||
Research the top 3 most popular open-source LLM frameworks in 2024 and compare their strengths and weaknesses.
|
||||
```
|
||||
|
||||
Press Enter to send.
|
||||
|
||||
### Watch the agent work
|
||||
|
||||
You will see the agent start working:
|
||||
- Expand the **thinking steps** to see which tools it is calling
|
||||
- Watch search results stream in
|
||||
- Wait for the final report to be generated
|
||||
|
||||
### Interact with the result
|
||||
|
||||
Once the report is generated, you can:
|
||||
- Ask for more detail on a specific section
|
||||
- Ask to export the report as a file (the agent will use the `present_files` tool)
|
||||
- Ask to create a chart based on the research findings
|
||||
|
||||
</Steps>
|
||||
|
||||
## What just happened
|
||||
|
||||
The agent used the DeerFlow Harness to:
|
||||
1. Receive your message and add it to the thread state
|
||||
2. Run the middleware chain (memory injection, title generation)
|
||||
3. Call the LLM, which decided to search the web
|
||||
4. Execute web search tool calls
|
||||
5. Synthesize results into a structured response
|
||||
6. Update the thread state with any artifacts produced
|
||||
|
||||
## Next steps
|
||||
|
||||
- [Use Tools and Skills](/docs/tutorials/use-tools-and-skills)
|
||||
- [Workspace Usage](/docs/application/workspace-usage)
|
||||
|
||||
@@ -1,3 +1,59 @@
|
||||
import { Callout } from "nextra/components";
|
||||
|
||||
# Use Tools and Skills
|
||||
|
||||
TBD
|
||||
This tutorial shows you how to configure and use tools and skills in DeerFlow to give the agent access to web search, file operations, and domain-specific capabilities.
|
||||
|
||||
## Configuring tools
|
||||
|
||||
Add tools to `config.yaml`:
|
||||
|
||||
```yaml
|
||||
tools:
|
||||
# Web search
|
||||
- use: deerflow.community.ddg_search.tools:web_search_tool
|
||||
|
||||
# Web content fetching
|
||||
- use: deerflow.community.jina_ai.tools:web_fetch_tool
|
||||
|
||||
# Sandbox file operations
|
||||
- use: deerflow.sandbox.tools:ls_tool
|
||||
- use: deerflow.sandbox.tools:read_file_tool
|
||||
- use: deerflow.sandbox.tools:write_file_tool
|
||||
- use: deerflow.sandbox.tools:bash_tool
|
||||
```
|
||||
|
||||
## Enabling skills
|
||||
|
||||
Enable skills through the DeerFlow app's extensions panel, or edit `extensions_config.json` directly.
|
||||
|
||||
**Via the app UI:**
|
||||
1. Open the DeerFlow app
|
||||
2. Click the Extensions/Skills icon in the sidebar
|
||||
3. Find `deep-research` and toggle it on
|
||||
|
||||
## Using a skill for research
|
||||
|
||||
With the `deep-research` skill enabled, select it in the conversation input, then send a research request:
|
||||
|
||||
```
|
||||
Do a deep research on the latest advances in quantum computing, focusing on practical applications.
|
||||
```
|
||||
|
||||
The agent will run a multi-step research workflow including web search, information synthesis, and report generation.
|
||||
|
||||
## Using the data analysis skill
|
||||
|
||||
Enable `data-analysis`, then upload a CSV or data file and ask the agent to analyze it:
|
||||
|
||||
```
|
||||
Analyze this CSV file and identify the top trends.
|
||||
```
|
||||
|
||||
The agent will use the sandbox tools to read the file, run analysis, and produce charts.
|
||||
|
||||
## Next steps
|
||||
|
||||
- [Work with Memory](/docs/tutorials/work-with-memory)
|
||||
- [Tools Reference](/docs/harness/tools)
|
||||
- [Skills Reference](/docs/harness/skills)
|
||||
|
||||
@@ -1,3 +1,64 @@
|
||||
import { Callout } from "nextra/components";
|
||||
|
||||
# Work with Memory
|
||||
|
||||
TBD
|
||||
This tutorial shows you how to enable and use DeerFlow's memory system so the agent remembers important information about you across multiple sessions.
|
||||
|
||||
## Enable memory
|
||||
|
||||
In `config.yaml`:
|
||||
|
||||
```yaml
|
||||
memory:
|
||||
enabled: true
|
||||
injection_enabled: true
|
||||
max_injection_tokens: 2000
|
||||
debounce_seconds: 30
|
||||
```
|
||||
|
||||
## How memory works
|
||||
|
||||
Memory works automatically through `MemoryMiddleware`:
|
||||
|
||||
1. **First conversation**: tell the agent about your preferences, project, or background.
|
||||
2. **Automatic learning**: the agent extracts and saves important facts in the background.
|
||||
3. **Future conversations**: memory facts are automatically injected into the system prompt — the agent does not need you to repeat context.
|
||||
|
||||
## Example
|
||||
|
||||
**First conversation:**
|
||||
```
|
||||
I am a Python backend developer primarily using FastAPI and PostgreSQL.
|
||||
My team follows PEP 8 and prefers type annotations everywhere.
|
||||
Please remember this for future code suggestions.
|
||||
```
|
||||
|
||||
**Later conversation** (no need to repeat background):
|
||||
```
|
||||
Help me write a user authentication module
|
||||
```
|
||||
|
||||
The agent will automatically produce FastAPI-style code with type annotations.
|
||||
|
||||
## Inspect memory
|
||||
|
||||
Memory is stored in `backend/.deer-flow/memory.json`:
|
||||
|
||||
```bash
|
||||
cat backend/.deer-flow/memory.json
|
||||
```
|
||||
|
||||
## Per-agent memory
|
||||
|
||||
When a custom agent is active, it maintains its own memory file at:
|
||||
|
||||
```
|
||||
backend/.deer-flow/agents/{agent_name}/memory.json
|
||||
```
|
||||
|
||||
This keeps each agent's learned knowledge separate.
|
||||
|
||||
## Next steps
|
||||
|
||||
- [Deploy Your Own DeerFlow](/docs/tutorials/deploy-your-own-deerflow)
|
||||
- [Memory System Reference](/docs/harness/memory)
|
||||
|
||||
Reference in New Issue
Block a user