How It Works
Key Features
Separate short-term and long-term memory systems
4-metric quality assessment for stored memories
User, agent, and run-specific memory scoping
Automatic entity extraction and storage
Optional Neo4j/Memgraph for relationships
Quality-based filtering and relevance ranking
Quick Start
Direct Memory Access
Memory Tiers
Short-term Memory (STM)
Short-term memory is cleared between sessions and used for immediate context.Long-term Memory (LTM)
Long-term memory persists across sessions and stores important information.Entity Memory
Entity memory stores information about specific people, places, or things.User Memory
User memory stores personalised information and preferences.Configuration Options
MemoryConfig SDK Reference
Full parameter reference for MemoryConfig
| Backend | Value | Description |
|---|---|---|
| File | "file" | JSON files (default, zero dependencies) |
| SQLite | "sqlite" | SQLite database |
| Redis | "redis" | Redis (requires redis-py) |
| Valkey | "valkey" | Valkey (Redis-compatible) |
| Postgres | "postgres" | PostgreSQL |
| Mem0 | "mem0" | Mem0 cloud service (requires mem0ai) |
| MongoDB | "mongodb" | MongoDB |
| Dakera | "dakera" | Self-hosted decay-weighted memory server (requires praisonaiagents[dakera]) |
| Option | Type | Default | Description |
|---|---|---|---|
backend | str | "file" | Storage backend (see above) |
user_id | str | None | None | Scope memory to a specific user |
session_id | str | None | None | Scope memory to a specific session |
auto_memory | bool | False | Auto-extract and store key facts |
claude_memory | bool | False | Use Claude’s native memory (Anthropic models) |
config | dict | None | None | Provider-specific configuration |
learn | bool | LearnConfig | None | None | Enable continuous learning |
history | bool | False | Auto-inject session history into context |
history_limit | int | 10 | Max messages to inject from history |
auto_save | str | None | None | Auto-save session with this name |
RAG Configuration (Default)
Mem0 Configuration
Requires the optional memory extras:If the package is missing, configuring"provider": "mem0"raises:
Dakera Configuration
Requires the optional Dakera extra:If the package is missing, configuring"provider": "dakera"raises:
Graph Memory Configuration
Requires the optional memory extras:
Backend Fallback
PraisonAI automatically falls back to SQLite when a configured backend (Redis, Valkey, Postgres) is unavailable, so your agent keeps working without crashing.| Configured backend | Fallback when unavailable | Search/store path |
|---|---|---|
redis | SQLite (adapter) | memory_adapter.search_* / store_* |
valkey | SQLite (adapter) | memory_adapter.search_* / store_* |
postgres | SQLite (adapter) | memory_adapter.search_* / store_* |
sqlite | n/a (native) | memory_adapter.* (direct) |
file | n/a (native) | FileMemory (direct) |
mem0 | raises ImportError | direct Mem0 client |
mongodb | raises error | direct Mongo client |
Before the fix in PraisonAI PR #2190, configuring
backend="redis" without redis-py installed produced sqlite3.OperationalError: no such table: short_mem on the first memory call. The SQLite adapter now owns the correct schema (short_term_memory / long_term_memory), so fallback is transparent.Symptom: sqlite3.OperationalError: no such table: short_mem
Symptom: sqlite3.OperationalError: no such table: short_mem
Cause: You are running a version of PraisonAI before PR #2190. A non-default backend (e.g.
redis) was configured but its dependency was not installed, causing a silent fallback to SQLite — which then queried the legacy short_mem table that no longer exists.Fix: Upgrade PraisonAI to the release that includes PR #2190, or install the dependency for your configured backend (e.g. pip install redis for Redis).Quality Scoring System
Quality Metrics
Completeness
Measures how complete and comprehensive the information is
Relevance
Measures how relevant the information is to the context
Clarity
Measures how clear and understandable the information is
Accuracy
Measures the factual accuracy of the information
Quality Calculation
Advanced Features
Cache-Optimised Context
Memory results are deterministically ordered for prompt caching effectiveness. Usebuild_context_for_task() with explicit output control for manual prompt assembly.
Context Building
Build comprehensive context for tasks:Task Output Finalisation
Store task results with quality assessment:Memory Citations
Automatically cite memory sources:Memory Reranking
Enhance search results with intelligent reranking based on relevance scores:Reranking Features
- Semantic Reranking: Re-scores results based on semantic similarity
- Context-Aware Ranking: Considers current context when ranking
- Quality-Weighted Ranking: Combines relevance with quality scores
Custom Reranking Logic
Implement custom reranking strategies:Reranking Performance
Optimize reranking for large result sets:Performance Optimisation
Complete Example
Best Practices
Set quality thresholds for search
Set quality thresholds for search
Use
min_quality=0.8 for critical information retrieval. Use lower thresholds (0.5–0.7) for exploratory searches where recall is more important.Scope memories per user and agent
Scope memories per user and agent
Always pass
user_id for user-specific memories, agent_id for agent-scoped shared knowledge, and run_id for ephemeral session context.Enable embeddings for semantic search
Enable embeddings for semantic search
Set
use_embedding=True in the memory config for semantic (not just keyword) retrieval. Use text-embedding-3-small for cost efficiency.Use AutoMemory for automatic extraction
Use AutoMemory for automatic extraction
Enable
MemoryConfig(auto_memory=True) to automatically extract preferences, facts, and entities from conversations without manual store_* calls.AutoMemory
AutoMemory automatically extracts structured information from conversations using configurable patterns — no manualstore_* calls needed.
How It Works
AutoMemory wrapsFileMemory with a pattern-based extraction engine. After each agent interaction, it scans the conversation for matching patterns (preferences, facts, dates, etc.) and stores them automatically.
Quick Start
Custom Patterns
MemoryConfig Integration
UseMemoryConfig.auto_memory to enable AutoMemory as part of the consolidated memory parameter:
| Parameter | Type | Default | Description |
|---|---|---|---|
auto_memory | bool | False | Enable automatic memory extraction |
backend | str | "file" | Storage backend (file, sqlite, redis, etc.) |
user_id | str | None | User ID for scoping memories |
Related
Knowledge
Integrate with document knowledge bases
Prompt Caching
Optimise memory context for prompt caching
Vector Store
Store and query embeddings with a pluggable, namespace-aware backend

