Quick Start
1
Simple Usage
2
With Configuration
Hybrid setup — SQL for conversations, Redis for state:
How It Works
Storage Backend Options
The registry supports 12 conversation, 9 state, and 20 knowledge backends — configure each store by URL scheme.- Conversation
- State
- Knowledge
SQLite
Local file database for development and single-instance apps
PostgreSQL
Production SQL with JSONB and connection pooling
MySQL
Popular SQL database with broad tooling support
Redis
Fast in-memory state store
MongoDB
Flexible document store for complex state
ClickHouse
Analytics database for large-scale data
JSON Files
Simple file-based storage with cross-platform locking
The registry is the authoritative list, not the docs. Call
list_available_backends() at runtime to discover the current set:Selecting a backend
The store kind narrows which URL schemes resolve to a registered backend.database_url= reaches conversation stores, state_url= reaches state stores, and knowledge_url= reaches vector stores. Kind-specific schemes take priority over generic http(s):// sniffing, so state_url="mongodb://…" reaches the MongoDB state store rather than falling through to conversation detection.
URL schemes per store kind
- State schemes
- Knowledge schemes
state_url= resolves these schemes to a state backend (from PraisonAIDB._STATE_URL_SCHEMES):pgvector:// runs over PostgreSQL, so PraisonAIDB rewrites pgvector://host/db to postgresql://host/db before forwarding it to the driver’s connection pool. Every other scheme is passed through unchanged.Explicit backend override
Some registered backends need out-of-band config the URL cannot carry — GCS (bucket_name), Cosmos DB (connection_string + database + container), and any custom driver whose scheme is not listed above. Reach them by naming the backend explicitly:
database_backend=, state_backend=, and knowledge_backend= are keyword-only and always win over URL scheme detection — use them to reach any registered backend whose scheme is not auto-inferable (e.g. a private or custom driver).
Unknown scheme
PraisonAIDB fails loudly on a scheme it cannot map, pointing at the override:
Backend Aliases
Configure with either name — the registry resolves aliases before instantiating the factory (PraisonAI PR #2669).PersistenceConfig(state_store="motor").validate() now succeeds and resolves to AsyncMongoDBStateStore. Unknown names still fail loudly, listing the current registry backends.
Configuration Options
See Selecting a backend for the scheme tables and override examples.
Database backends require the
praisonai wrapper (pip install praisonai). The core SDK defines DbAdapter; implementations live in praisonai.persistence.from praisonaiagents import db binds the callable factory directly. The namespaced from praisonaiagents.db import db form still works.Best Practices
Choose the right backend
Choose the right backend
SQLite for development; PostgreSQL or MySQL for multi-user production; Redis for fast state; JSON files for minimal dependencies.
Use meaningful session IDs
Use meaningful session IDs
Set
session_id="user-123" so conversations resume reliably across restarts.Read credentials from the environment
Read credentials from the environment
Never hardcode database URLs — use
os.getenv("PRAISON_CONVERSATION_URL").Separate stores by concern
Separate stores by concern
Conversation history, run traces, and vectors scale differently — configure each URL independently.
Related
Database Persistence (Advanced)
MemoryConfig, CLI commands, and Docker setup
Session Persistence
JSON file sessions without a database

