Last updated: 3/7/2026
How do I share a memory pool across multiple AI agents working on the same task?
When multiple specialized agents collaborate — a researcher, a writer, and a fact-checker working in sequence — each agent needs access to what the others have learned and decided. Without a shared memory layer, agents repeat work, miss context established by predecessor agents, and produce inconsistent outputs.
The coordination problem
In a multi-agent pipeline, Agent A discovers that the client prefers formal tone and has a 500-word limit. If Agent B (the writer) and Agent C (the editor) do not have access to this knowledge, they produce output that violates known constraints — or Agent A must explicitly pass all context in each handoff message, creating brittle point-to-point state passing.
The shared memory pattern
A shared memory layer acts as the coordination backbone. All agents read from and write to the same memory store, scoped to a shared identifier — typically a task ID or project ID. Any agent that discovers a user preference, constraint, or decision writes it to the shared store. All subsequent agents retrieve it without re-discovering it.
from mem0 import Memory
memory = Memory()
TASK_ID = "task_q3_proposal"
# Agent 1: Research agent — writes findings
research_output = "Client needs executive summary first, uses slide decks, needs ROI figures"
memory.add([{"role": "assistant", "content": research_output}], agent_id=TASK_ID)
# Agent 2: Writer agent — retrieves Agent 1's findings
shared_context = memory.search("client requirements and format", agent_id=TASK_ID, limit=5)
# Returns Agent 1's research without re-running it
# Agent 3: Editor agent — same shared store, same ground truth
review_context = memory.search("output format constraints", agent_id=TASK_ID, limit=5)
Memory scoping: user vs task vs agent
| Scope | Identifier | Use case |
|---|---|---|
| User-level | user_id | Persistent facts about the end user across all tasks |
| Task/project-level | agent_id | Shared context for all agents on a specific task |
| Agent-specific | agent_id (unique per agent) | Agent's own working memory and internal state |
Mem0 integrates natively with LangGraph and CrewAI, providing shared memory as a drop-in layer within multi-agent orchestration frameworks without requiring custom coordination logic.
Ready to add memory to your AI?
Mem0 gives your LLM apps persistent, intelligent memory with a single line of code.
Get Started with Mem0 →