Quick Start
How It Works
| Phase | What happens |
|---|---|
| 1. Store | The agent saves context to memory, scoped by user_id |
| 2. Persist | State survives across turns and sessions |
| 3. Recall | Later turns retrieve relevant memories automatically |
Core Stateful Capabilities
Memory System
PraisonAI includes a sophisticated multi-tiered memory system with quality-based filtering:- Short-term Memory (STM): Ephemeral context for current conversations
- Long-term Memory (LTM): Persistent knowledge with quality-based filtering
- Entity Memory: Structured data about named entities and relationships
- User Memory: User-specific preferences and interaction history
- Graph Memory: Complex relationship storage via Mem0 integration
Session Management
TheSession class provides a unified API for managing stateful agent interactions:
Workflow State Management
PraisonAI supports complex stateful workflows with persistent state across steps:Advanced Stateful Patterns
Quality-Based Memory Storage
Memory storage with automatic quality assessment using individual metrics:Enhanced State Management
Context Building from Multiple Sources
Knowledge Base Integration
Advanced Memory Features
Graph Memory Support
Quality Metrics and Evaluation
Session API Updates
Current Session Methods
Configuration Examples
Basic Stateful Agent
Advanced Memory Configuration
Complex Workflow with State
Best Practices
Use Session IDs for Multi-User Apps
Use Session IDs for Multi-User Apps
Always pass a unique
session_id per user. This isolates state and memory between different users in multi-tenant applications.Choose the Right Memory Backend
Choose the Right Memory Backend
Use
"rag" for local embeddings, "mem0" for cloud-based memory with semantic search, and "none" when you only need workflow state without semantic retrieval.Save State After Key Events
Save State After Key Events
Call
session.save_state() after significant workflow milestones, not after every message. This reduces I/O and keeps state snapshots meaningful.Set Quality Thresholds
Set Quality Thresholds
Configure
quality_threshold on memory to automatically filter out low-quality interactions from long-term memory, keeping retrieval fast and relevant.Related
Sessions
Session management and persistence
Memory Advanced Search
Reranking and relevance filtering for memory retrieval

