Quick Start
How It Works
WhenMemory initialises, it resolves the provider through the adapter registry — the only code path for backend setup since PR #2060 removed orphaned legacy _init_* methods.
Built-in Adapters
| Adapter | Registry name | Backend | When to use |
|---|---|---|---|
SqliteMemoryAdapter | "sqlite" | SQLite file | Default persistent local storage |
InMemoryAdapter | "in_memory" | Python dict | Tests, ephemeral workflows |
| Factory | "chroma" | ChromaDB (lazy) | Vector search, local RAG |
| Factory | "mongodb" | MongoDB (lazy) | Document store, Atlas Vector Search |
| Factory | "mem0" | Mem0 cloud (lazy) | Managed graph / cloud memory |
praisonaiagents.memory.adapters.factories so optional dependencies load only when requested.
Register Your Own Adapter
ImplementMemoryProtocol — at minimum: store_short_term, search_short_term, store_long_term, search_long_term, and get_all_memories.
Common Patterns
Async adapter — implementAsyncMemoryProtocol (astore_short_term, asearch_short_term, etc.) when your backend is async-native.
Lazy-loaded heavy backend — use register_memory_factory(name, create_fn) so imports like chromadb or pymongo happen inside the factory, not at package import time.
Extending an existing adapter — subclass SqliteMemoryAdapter or wrap InMemoryAdapter and register under a new name.
Best Practices
Prefer the registry over patching Memory
Prefer the registry over patching Memory
Register adapters with
register_memory_adapter or register_memory_factory instead of monkey-patching Memory internals.Implement sync and async when possible
Implement sync and async when possible
Sync methods satisfy
MemoryProtocol; add AsyncMemoryProtocol methods if your store supports non-blocking I/O.Close connections in .close()
Close connections in .close()
Implement
close() on adapters that hold clients (MongoDB, ChromaDB). Session.close() calls memory.close_connections() which forwards to the adapter.List registered adapters at runtime
List registered adapters at runtime
Related
Memory Concepts
Provider strings, short-term vs long-term, and configuration basics.
Memory Cleanup
Session teardown and adapter
close() lifecycle.MongoDB Memory
Atlas Vector Search and
use_vector_search configuration.Memory Troubleshooting
ImportError and fallback behaviour when providers are missing.

