strands-mem0 package ships a native MemoryStore, so recall and writes happen automatically inside the agent loop, not as tool calls the model has to remember.
Overview
- A
MemoryStoretheMemoryManagerdrives on every turn: it searches Mem0 and injects the results into the prompt, and writes memory back when extraction is enabled. - Server-side extraction: because the store implements
add_messages, enablingextractionroutes raw conversation turns to Mem0’s own extraction pipeline, with no extra client-side model call. - Works with the hosted Mem0 Platform (an API key) or self-hosted Mem0 OSS (a config dict).
Prerequisites
Before setting up Mem0 with Strands, ensure you have:- Installed the required packages:
- A valid API key:
- Mem0 API Key (set as
MEM0_API_KEY)
- Mem0 API Key (set as
Basic Integration Example
Hand aMem0MemoryStore to a MemoryManager, and the agent gets automatic recall and memory writes:
user_id, agent_id, run_id, or app_id (app_id is platform-only). Pass max_search_results to bound how many memories are injected per turn.
Self-hosted Mem0 (OSS)
To run against self-hosted Mem0 instead of the platform, pass aconfig dict:
Explicit memory tool
If you want the model to call memory explicitly instead of (or alongside) the automatic store, use themem0_memory tool from strands-agents-tools. A store and the tool can share the same Mem0 backend and namespace.