Work with Memory
This tutorial shows you how to enable and use PengBao AI’s memory system so the agent remembers important information about you across multiple sessions.
Enable memory
In config.yaml:
memory:
enabled: true
injection_enabled: true
max_injection_tokens: 2000
debounce_seconds: 30How memory works
Memory works automatically through MemoryMiddleware:
- First conversation: tell the agent about your preferences, project, or background.
- Automatic learning: the agent extracts and saves important facts in the background.
- 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 moduleThe agent will automatically produce FastAPI-style code with type annotations.
Inspect memory
Memory is stored in backend/.deer-flow/memory.json:
cat backend/.deer-flow/memory.jsonPer-agent memory
When a custom agent is active, it maintains its own memory file at:
backend/.deer-flow/agents/{agent_name}/memory.jsonThis keeps each agent’s learned knowledge separate.