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:
The Adapter Is the Single Source of Truth
As of PR #3515, a configured adapter handles store, search, reset, and delete for every provider — not just
sqlite / in_memory. Data written through a registered adapter (e.g. dakera) is now findable, resettable, and deletable through that same adapter. No sqlite fallback or dual-write pattern is needed.search, reset, and delete only delegated to the adapter when the provider was hardcoded sqlite or in_memory. Any other registered adapter stored data correctly but reads hit the empty legacy tables and returned [] — memory was effectively write-only. All four operation paths now gate symmetrically on whether an adapter is configured.
Round-trip through a custom adapter — store then find:
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.
Every operation routes through the adapter
Once you register an adapter (e.g.add_memory_adapter("dakera", DakeraAdapter)) and set provider="dakera" — or pass the adapter directly — every read and every write routes through it: store_*, search_*, reset_*, and delete_*. There is no provider in {sqlite, in_memory} gate.
Before this became symmetric, a registered adapter’s writes went to its own table while every search_* looked at the legacy long_mem table the adapter never created — so searches returned [] and resets/deletes no-op’d. Store, search, reset, and delete now share one source of truth. The dedicated chroma / mem0 / mongodb write paths still take priority for those providers.
Built-in Adapters
Heavy backends register as factories in
praisonaiagents.memory.adapters.factories so optional dependencies load only when requested.
Adapter operations (as of PR #3515): store ✅ · search ✅ · reset ✅ · delete ✅ — every operation routes through the configured adapter, for any provider, not just sqlite / in_memory.
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.

