Quick Start
1
Simple Usage
Use a built-in adapter via string to anchor the mental model:
2
With a Custom Adapter
Register your adapter, then point the agent at it:
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
Heavy backends register as factories in
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.
add_memory_adapter and register_memory_adapter are synonyms; both work. add_memory_adapter is the canonical name per the SDK naming convention (add_X = register something).Registry API at a Glance
Common Patterns
Async adapter — implementAsyncMemoryProtocol (astore_short_term, asearch_short_term, etc.) when your backend is async-native.
Lazy-loaded heavy backend — use add_memory_factory(name, create_fn) (or its synonym register_memory_factory) 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.
Inspect the registry — check what’s registered before wiring an agent:
Best Practices
Prefer the registry over patching Memory
Prefer the registry over patching Memory
Register adapters with
add_memory_adapter or add_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.Dakera Memory
Self-hosted, decay-weighted vector recall via the Dakera server.
Memory Troubleshooting
ImportError and fallback behaviour when providers are missing.

