Quick Start
1
Simple Usage
Use a built-in backend via the registry:
2
With Configuration
Register a custom backend at runtime:Package it as an entry point in
CONVERSATION_STORES, KNOWLEDGE_STORES, and STATE_STORES are still importable from praisonai.persistence.registry for backward compatibility — they are now lazy attributes that build on first access via __getattr__. New code should prefer get_default_registry(kind) for clarity.pyproject.toml:How It Works
No import-time cost. Importing
praisonai.persistence.registry no longer walks Python entry points or registers the ~40 built-in loaders as a side effect — each kind’s registry is built lazily the first time you call get_default_registry(kind) (or reference the legacy *_STORES names). import praisonai is now safe to run in tests, notebooks, and multi-tenant runtimes without side effects.Multi-tenant isolation
All three factory functions accept an injectedregistry= — pass your own StoreRegistry to keep tenant registrations from leaking into the process-default registry.
create_knowledge_store(..., registry=) and create_state_store(..., registry=). See Registry Dependency Injection for the wider pattern.
Configuration Options
StoreRegistry API
Third-party backend authors register plugins via the same three entry-point groups (
praisonai.conversation_stores / praisonai.knowledge_stores / praisonai.state_stores). Lazy loading means the entry-point scan runs on first use of that kind only, not on every import praisonai.Built-in conversation backends
postgres, async_postgres, mysql, async_mysql, sqlite, sync_sqlite, async_sqlite, json, singlestore, supabase, surrealdb, turso
Common aliases: neon, cockroachdb, crdb → postgres; aiomysql → async_mysql; libsql → turso.
Built-in knowledge backends
chroma, qdrant, pinecone, weaviate, lancedb, milvus, pgvector, redis, cassandra, clickhouse, and others.
Built-in state backends
redis, dynamodb, firestore, mongodb, async_mongodb, upstash, memory, gcs
Best Practices
Use lazy imports in factories
Use lazy imports in factories
Follow built-in backends — import heavy dependencies inside the factory function, not at module level.
Provide meaningful aliases
Provide meaningful aliases
Register short aliases (
mb, pg) alongside canonical names for easier CLI and config usage.Handle unknown backends clearly
Handle unknown backends clearly
Factory functions should raise clear errors with connection hints — the registry lists available backends on
ValueError.Keep factories thread-safe
Keep factories thread-safe
Registries use
threading.Lock — factory functions should also be safe for concurrent creation.Related
Database Persistence
Overview of all persistence backends
Framework Adapter Plugins
Plugin system for multi-agent frameworks

