A subset of
Memory is now callable directly over MCP — see MCP Memory Tools.Replaces the deprecated
auto_save="name" kwarg — see Legacy Agent Parameters.Grow memory autonomously
Withself_improve="background" and memory=True, the same guarded post-turn review that autonomously grows skills can also autonomously persist durable facts and preferences via store_memory — off the hot path, with zero cost to reply latency and zero context pollution during the live turn. See Self-Improving Agents.
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 —
MemoryConfigTurn on
prefetch=True on MemoryConfig to have relevant long-term memories injected into the system prompt at the start of every turn — no explicit recall() call required. See Memory Prefetch for the full guide.Common Patterns
Pattern 1 — User-scoped memory
Pattern 2 — History injection for conversation continuity
Default sessions are workspace-scoped — the same agent name in a different project is a different session. See Where sessions live for details and the
PRAISONAI_GLOBAL_SESSIONS opt-out.Pattern 3 — Recalled context at turn start
## Recalled memories block in its system prompt before the first model call — no extra tool call needed.
Quick API — remember, recall, forget
Three verbs give you explicit control over long-term facts — store, look up, and delete.
An agent with memory=True exposes its memory instance directly, so you can store and recall facts on demand.
Memory() standalone in a plain script — no config, no agent required.
Parameters
remember() and recall() operate on long-term memory only, and forget(query=...) is scoped to long-term memory to match. forget() requires exactly one of memory_id or query — passing neither, both, or an empty query raises ValueError.Which memory API?
Interaction flow
Best Practices
Use auto_memory for fact extraction
Use auto_memory for fact extraction
Enable
auto_memory=True to have the agent automatically identify and store important facts from each conversation — names, preferences, decisions — without extra code.Combine memory with learning
Combine memory with learning
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).Backend scaling path
Backend scaling path
Start with
file, move to sqlite when you need durability, then mongodb (or chroma for vector search) when you deploy multiple agent instances that share memory. For Redis or Postgres, use memory=MemoryConfig(db=db(state_url="redis://...")) or db(database_url="postgresql://...") — see Redis persistence.Choose remember/recall for facts, memory=True for conversation history
Choose remember/recall for facts, memory=True for conversation history
Agent(memory=True) auto-captures every conversation turn. remember() / recall() / forget() give you explicit control for fact storage — use them for structured knowledge you want to look up later. Both share the same long-term store when the agent’s memory instance is used.Related
Learn
Learn — continuous learning from conversations
Knowledge
Knowledge — add documents and URLs as agent knowledge
Memory Flush on Compaction
Preserve facts before compaction — save durable facts before older messages are dropped

