Skip to main content
Memory lets agents remember past conversations, user preferences, and context across sessions.
The user shares preferences in chat; the agent recalls them in later sessions via the configured memory backend.

Quick Start

1

Level 1 — Bool (simplest)

Turn on memory with a single flag — the agent remembers across turns using the default file backend.
2

Level 2 — String (pick a backend)

Pass a backend name to choose where memories are stored.
3

Level 3 — Config class (full control)

Use MemoryConfig to scope memory per user and auto-extract facts.
4

Level 4 — Config with continuous learning

Add LearnConfig to build a long-term persona alongside session memory.

How It Works


Which Backend to Choose?


Configuration Options

Full list of options, types, and defaults — MemoryConfig
The most common options at a glance:

Common Patterns

Pattern 1 — User-scoped memory

Pattern 2 — History injection for conversation continuity


Best Practices

Without user_id, all users share the same memory store. Set user_id to a unique identifier per user to keep memories properly scoped and private.
Enable auto_memory=True to have the agent automatically identify and store important facts from each conversation — names, preferences, decisions — without extra code.
Set learn=True inside MemoryConfig to enable continuous learning alongside session memory. This gives agents both short-term context (memory) and long-term pattern recognition (learn).
Start with file, move to sqlite when you need durability, then redis when you deploy multiple agent instances that share memory.

Learn

Learn — continuous learning from conversations

Knowledge

Knowledge — add documents and URLs as agent knowledge