Quick Start
1
Simple Usage
2
With Custom Embedder
Configuration Options
MultiAgentMemoryConfig SDK Reference
Full parameter reference for MultiAgentMemoryConfig
How It Works
Configuration Options
Full list of options, types, and defaults —
MultiAgentMemoryConfigCommon Patterns
Pattern 1 — Project-scoped research memory
Best Practices
Always set user_id for project isolation
Always set user_id for project isolation
Set
user_id to a unique project or session identifier to prevent memory from bleeding between unrelated workflows. Without user_id, all workflows share the same memory namespace.Order tasks to build context
Order tasks to build context
Tasks run in order by default. Place information-gathering tasks first and synthesis/writing tasks later so downstream agents have full context from upstream agents.
Isolating collections per agent
When several agents share onerag_db_path, give each a distinct collection_name so they coexist and can be reset independently.
collection_name defaults to "memory_store". See Memory Configuration.
Per-agent isolation across backends
Two agents in one process no longer share one on-disk store by default. As of PraisonAI #4203,Agent(memory="sqlite" | "chroma" | {"provider": "mongodb"} | {"provider": "mem0"} | {"learn": True}) inherits the same per-agent isolation that FileMemory already had — each agent gets a per-instance agent-<uuid> id and its own default store when no explicit user_id is given.
user_id:
Explicit values always win —
user_id, short_db, long_db, rag_db_path, or collection_name in the caller’s dict bypass the auto-defaults. A bare store with no user_id keeps the original shared defaults, so existing single-store setups are unchanged.
When to pass an explicit user_id:
user_id validation for default-path scoping. When a user_id feeds the default sqlite/chroma paths, it must not contain /, \, .., or NUL — an unsafe value raises ValueError("memory user_id must not contain path separators or parent references") at Memory init. Other characters are normalised (only isalnum() or one of -_. is kept; everything else becomes _). Explicit short_db / long_db / rag_db_path / collection_name bypass this normalisation entirely.Concurrency and shared user_id
When multiple agents share the sameuser_id and back FileMemory (or the file-backed learn store) on the same paths, concurrent writes are now merge-safe: each mutation re-reads the on-disk state under the instance lock before appending, so two agents recording facts against the same user_id no longer overwrite each other’s entries. This applies to add_short_term, add_long_term, add_entity, auto-promotion to long-term memory, and learn/stores.py BaseStore.add.
This is a bug fix, not a new API — no configuration change is required. If you previously worked around lost writes by serializing agent runs or by giving agents distinct user_ids, you can remove that workaround where sharing was actually the goal.
File-based memory serializes writes per-process. If you run agents across separate processes on the same on-disk memory files, the per-process lock does not cover cross-process races — use per-process
user_id scoping or a shared memory provider (RAG/graph) for cross-process sharing.The built-in in-memory adapter is thread-safe. Task-callback memory writes are offloaded to worker threads on the async path (see Async Safety), so parallel task callbacks in an
asyncio.gather(...) fan-out can hit the adapter from multiple threads at once. The adapter guards its store, search, delete, and reset methods with an RLock, so concurrent writes cannot lose entries or duplicate ids.Related
Advanced Memory
Single-agent memory configuration
Multi-Agent Planning
Plan tasks before executing them
Multi-Agent Hooks
Intercept task lifecycle events
Learn
Continuous learning from conversations

