What is multi-agent memory?
Multi-agent memory is the set of shared and private records that lets several agents coordinate a task without replaying every transcript through every role. It includes working state for the active run, durable facts and decisions visible to selected agents, and private context used only by one specialist.
The problem is different from single-agent memory because several writers can produce conflicting values at the same time. The architecture must answer who may write, which memory is authoritative, who can read it and how a handoff carries only the context the next agent needs.
How should memory move between agents during a handoff?
A handoff should transfer an explicit package: task, current state, approved facts, unresolved questions, source references and the next expected action. It should not dump the sender’s full context window into the receiver. The receiving agent must know which claims are data, which are instructions and which are still uncertain.
Prefer a shared run record for coordination and bounded memory retrieval for relevant history. If the receiver needs a fact that is not in the handoff package, it can query the same scoped memory service rather than ask another model to summarize the entire conversation.
type Handoff = {
taskId: string;
objective: string;
completedSteps: string[];
approvedFacts: MemoryRef[];
unresolvedQuestions: string[];
blockedActions: string[];
nextAgent: string;
sourceIds: string[];
};
await runStore.writeHandoff(taskId, handoff);
await memory.recordEpisode({
tenantId,
userId,
agentId: 'planner',
taskId,
kind: 'handoff',
summary: 'Planner handed implementation to coding agent.',
sourceIds: handoff.sourceIds,
});How do you prevent conflicting writes across agents?
Assign write ownership by memory type and entity. A billing agent owns billing-state observations; a research agent proposes facts but cannot overwrite them; a coordinator approves a shared project decision. When multiple agents must write the same record, use version checks, confidence, source priority and conflict review.
Do not let the model choose the final truth from two confident statements. Preserve both with provenance, select the correct value through deterministic rules or an authorized resolver, and mark the losing record as rejected or superseded rather than deleting its history immediately.
| Conflict type | Resolution |
|---|---|
| Two observations of the same fact | Keep both; current authoritative source wins |
| A user corrects a memory | Create a superseding version with source and time |
| Two agents propose different plans | Require coordinator approval and record the decision |
| Low-trust document contradicts verified data | Quarantine the document unless a qualified resolver confirms it |
| Concurrent writes | Use version preconditions or optimistic concurrency |
How should multiple agents coordinate working state?
Use a run coordinator or graph runtime for task state, assignments and completion. Keep the durable shared memory smaller than execution state. The coordinator can publish milestones and approved decisions, while individual agents maintain their own local working context.
LangGraph persistence can store graph state and namespaced data, while frameworks such as CrewAI provide their own memory primitives. Whichever runtime you use, preserve a framework-neutral retention contract for facts that must outlive the graph or crew.
- One owner for each shared task milestone.
- Explicit status transitions instead of inferred progress.
- Bounded handoffs with sources and unresolved issues.
- Private scratchpads that are not automatically promoted.
- A shared decision log separate from conversation history.
- Idempotent writes so retries do not duplicate tasks.
How should multi-agent memory enforce user and tenant scope?
Resolve tenant and user identity before an agent runs and pass the trusted scope into every memory operation. An agent ID is an additional scope dimension, not a replacement for user or tenant identity. A supervisor should not inherit private memory from every specialist automatically.
Define which agent identities may read which scopes. Shared team memory can be visible to all approved agents, project memory only to project participants and user memory only when policy permits. If scope resolution fails, fail closed rather than querying a default namespace.
| Operation | Required trusted fields |
|---|---|
| Read shared decision | tenant + project + agent authorization |
| Read user preference | tenant + user + purpose |
| Write specialist state | tenant + agent + session |
| Promote to shared memory | tenant + project + approving principal |
| Delete user | tenant + user + deletion authorization |
What must multi-agent deletion cover?
Deletion must cover every memory surface an agent can read: source events, extracted facts, summaries, graph relationships, embeddings, local caches and exports. It must also invalidate shared references used by coordinators and other agents.
Test deletion by querying through every agent identity, not only the agent that originally wrote the memory. A deleted customer fact that remains in a supervisor cache or second agent’s summary is still a production failure.
How do you test multi-agent memory?
Create a multi-agent run with overlapping work, one handoff and one changed decision. Verify that private scratchpads stay private, the receiver obtains only the needed handoff package and all agents return the latest approved decision from their allowed scopes.
Add adversarial tests for stale writes, simultaneous updates and cross-tenant requests. Then delete a fact through one agent and query through every other agent and coordinator path until no derived copy remains.
| Test | Pass condition |
|---|---|
| Private specialist context | Other agents cannot retrieve it |
| Handoff completeness | Receiver has state, sources and blockers |
| Concurrent conflict | One versioned outcome wins deterministically |
| Stale coordinator cache | Old value is invalidated after correction |
| Second tenant | Zero foreign records are returned |
| Cross-agent deletion | All read paths lose the deleted memory |
What are the most common multi-agent memory failures?
The most damaging pattern is a global blackboard containing every agent’s reasoning. It spreads one specialist’s hallucination to the entire team, consumes context and makes authorization difficult. Another common failure is a handoff that sends a narrative summary without source IDs, blockers or ownership, forcing the receiver to reconstruct work that already happened.
Concurrent writes create a different class of failure. Two agents can both write a plausible but conflicting decision, and last-write-wins may preserve the less authoritative source. Version checks, explicit write ownership and coordinator approval keep shared memory from becoming an opaque race.
- Global context for every agent, regardless of purpose.
- Private scratchpads promoted without review.
- Handoffs without sources, blockers or expected next action.
- Last-write-wins updates without version checks.
- Deletion tested through only the original writing agent.
What is the recommended multi-agent memory architecture?
Use the run coordinator for task state, scoped durable memory for facts and decisions, and explicit handoff packages for transitions. Keep specialist scratchpads private, assign write ownership, resolve conflicts deterministically and test deletion through every agent identity.
Frequently asked questions
What is multi-agent memory?
It is the shared and private context that lets several agents coordinate a task. It includes run state, approved shared facts, handoff packages and specialist-only working memory.
Should every agent share one memory namespace?
No. Use a small shared scope for approved coordination data and separate scopes for private agent state, users, projects and tenants.
What should a multi-agent handoff contain?
Send the objective, current state, completed steps, approved facts, unresolved questions, blocked actions, sources and the expected next action.
How do you resolve conflicting memories between agents?
Preserve both sources, use deterministic source priority and versioning, and require an authorized coordinator or resolver for shared decisions.
Can LangGraph or CrewAI memory work with an external memory layer?
Yes. Keep their runtime or crew persistence for execution state and use an external scoped memory API for facts that must outlive the graph, crew or framework.
How do you test deletion in a multi-agent system?
Delete through an authorized path, then query through every agent, coordinator, cache, export and tenant boundary to prove no derived copy remains retrievable.
