Skip to main content
PraisonAI’s memory backends are pluggable — register your own adapter to store agent memory in any system. The user chats with the agent; your custom memory adapter persists and retrieves facts from your chosen backend.

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

When Memory 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

AdapterRegistry nameBackendWhen to use
SqliteMemoryAdapter"sqlite"SQLite fileDefault persistent local storage
InMemoryAdapter"in_memory"Python dictTests, 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
Factory"dakera"Dakera (lazy)Self-hosted decay-weighted vector memory
Heavy backends register as factories in praisonaiagents.memory.adapters.factories so optional dependencies load only when requested.

Register Your Own Adapter

Implement MemoryProtocol — 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).
Then use it from an agent:

Registry API at a Glance

FunctionPurposeAlias
add_memory_adapter(name, cls)Register an adapter classregister_memory_adapter
add_memory_factory(name, fn)Register a lazy factory functionregister_memory_factory
get_memory_adapter(name, **kwargs)Instantiate a registered adapter
has_memory_adapter(name)Check whether a name is registered
list_memory_adapters()List all registered names

Common Patterns

Async adapter — implement AsyncMemoryProtocol (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

Register adapters with add_memory_adapter or add_memory_factory instead of monkey-patching Memory internals.
Sync methods satisfy MemoryProtocol; add AsyncMemoryProtocol methods if your store supports non-blocking I/O.
Implement close() on adapters that hold clients (MongoDB, ChromaDB). Session.close() calls memory.close_connections() which forwards to the adapter.

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.