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.

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.

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, Redis, PostgreSQL, MongoDB

Advanced Memory

Long-term, short-term, entity memory

Graph Memory

Relationship-aware memory