docs/integrations/strands.mdx
Integrate Mem0 with Strands Agents, AWS's open-source SDK for building AI agents. The 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.
MemoryStore the MemoryManager drives on every turn: it searches Mem0 and injects the results into the prompt, and writes memory back when extraction is enabled.add_messages, enabling extraction routes raw conversation turns to Mem0's own extraction pipeline, with no extra client-side model call.Before setting up Mem0 with Strands, ensure you have:
pip install strands-mem0
MEM0_API_KEY)Hand a Mem0MemoryStore to a MemoryManager, and the agent gets automatic recall and memory writes:
import os
from strands import Agent
from strands.memory import MemoryManager
from strands_mem0 import Mem0MemoryStore
os.environ["MEM0_API_KEY"] = "your-mem0-api-key"
# extraction=True routes conversation turns to Mem0's server-side extraction.
store = Mem0MemoryStore(user_id="alex", extraction=True)
agent = Agent(memory_manager=MemoryManager(stores=[store]))
agent("Remember I use Neovim and deploy on Fridays.") # writes memory
print(agent("What editor do I use?")) # recalls it, injected automatically
Scope memories with any of 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.
To run against self-hosted Mem0 instead of the platform, pass a config dict:
store = Mem0MemoryStore(
user_id="alex",
extraction=True,
config={
"vector_store": {"provider": "qdrant", "config": {"host": "localhost", "port": 6333}},
},
)
If you want the model to call memory explicitly instead of (or alongside) the automatic store, use the mem0_memory tool from strands-agents-tools. A store and the tool can share the same Mem0 backend and namespace.