mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-10-26 21:26:39 +00:00
* feat(memory): add scoped fact lookup by ID * docs(memory): synchronize tool-mode lookup guidance * docs(memory): clarify named-agent read capability requirement
75 lines
2.2 KiB
Plaintext
75 lines
2.2 KiB
Plaintext
---
|
|
title: Work with Memory
|
|
description: This tutorial shows you how to enable and use DeerFlow's memory system so the agent remembers important information about you across multiple sessions.
|
|
---
|
|
|
|
import { Callout } from "nextra/components";
|
|
|
|
# Work with Memory
|
|
|
|
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
|
|
mode: middleware
|
|
injection_enabled: true
|
|
max_injection_tokens: 2000
|
|
debounce_seconds: 30
|
|
```
|
|
|
|
## How memory works
|
|
|
|
By default, 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.
|
|
|
|
DeerFlow also has an experimental `mode: tool` option. In tool mode, the agent receives `memory_search`, `memory_get`, `memory_add`, `memory_update`, and `memory_delete` tools and decides when to call them. Use `memory_get(fact_id)` to reread a fact whose ID is already known, or `memory_search` when the ID is unknown. Keep `mode: middleware` unless you specifically want to evaluate model-driven memory behavior.
|
|
|
|
## 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)
|