Skip to main content

Memory Features

PraisonAI agents support several memory features that make conversations smarter over time. Each feature is opt-in β€” disabled by default for zero overhead.

Quick Comparison


Auto-Save Sessions

Automatically saves the full conversation history to disk after each start() / run() call.

History Injection

Automatically loads past session history into context so the agent remembers previous conversations.
When history=True, a session ID is auto-generated per project β€” it combines the workspace (git repo root or the current directory) with the agent name. Two Agent(name="assistant") calls in different projects get separate history files and never mix.Set session_id="..." for explicit control over which session to resume, or opt back into name-only global sessions by exporting PRAISONAI_GLOBAL_SESSIONS=true.

Where sessions live

Every auto-generated session is scoped to your workspace, so the same agent name in a different project starts fresh instead of leaking history. The final on-disk id is:
Stored under ~/.praisonai/sessions/ (or wherever PRAISONAI_HOME points). Read the resolved identity from Python:
Reverts to the pre-workspace behaviour: the id becomes history_<sha256("global:<name>")[:8]> and same-named agents in any project share one history file. Accepted values (case-insensitive): 1, true, yes.
Existing history_<name-only>.json files are not adopted automatically when running in workspace scope β€” otherwise Project A’s history would leak into Project B.
  • To keep using an old file everywhere, set PRAISONAI_GLOBAL_SESSIONS=true.
  • To keep it in one specific project, rename it to the new workspace-scoped id (or set session_id="..." explicitly).
  • Otherwise, agents start fresh in each new workspace.
Passing session_id="..." is unchanged β€” it always overrides the auto id and stays global, so use it for deliberate cross-project continuity.

Auto-Memory Extraction

Automatically extracts memorable facts (names, preferences, roles) from conversations and stores them in long-term memory.
Auto-memory uses lightweight regex-based extraction β€” no LLM calls needed. It only processes messages that contain personal information keywords.
Previews don’t consume dedup β€” a process_interaction(..., store=False) call can be followed by store=True for the same text and the real store still writes. See Previews and retry semantics for the full contract.

Manual Memory Storage

You can also store memories manually using the store_memory() method.

Memory Presets

Use string shortcuts instead of MemoryConfig for common configurations.
You can add provider-specific settings with config= β€” the outer backend= still takes effect: MemoryConfig(backend="sqlite", config={"short_db": "./mem/short.db"}) builds a sqlite store. Only a provider/backend key inside config= overrides it. See Memory β†’ Combining backend and config.

Custom Memory Backend

Implement the AgentMemoryProtocol to create your own memory backend.
Any object with get_context() and save_session() methods works as a memory backend. No inheritance required β€” PraisonAI uses duck typing via AgentMemoryProtocol.

Architecture

FileMemory persists to ~/.praisonai/memory/. Writes are atomic β€” see Storage β†’ Durability.

Session Persistence

Resume conversations across restarts

Storage Backends

File, SQLite, ChromaDB, mem0, MongoDB, Dakera, in-memory

Advanced Memory

Long-term, short-term, entity memory

Graph Memory

Relationship-aware memory