How Mem0 Adds Memory
Adding memory is how Mem0 captures useful details from a conversation so your agents can reuse them later. Think of it as saving the important sentences from a chat transcript into a structured notebook your agent can search.Key terms
- Messages: The ordered list of user/assistant turns you send to
add. - Infer: Controls whether Mem0 extracts structured memories (
infer=True, default) or stores raw messages. - Metadata: Optional filters (e.g.,
{"category": "movie_recommendations"}) that improve retrieval later. - User / Session identifiers:
user_id,agent_id,app_id, orrun_idthat scope the memory for future searches. - expiration_date: Optional
YYYY-MM-DDdate after which the memory is treated as expired. UseexpirationDatein the JavaScript SDKs. Expired memories are hidden fromsearchandget_allunless you passshow_expired(showExpiredin JavaScript); fetching by ID still returns them.
How does it work?
Mem0 offers two flows:- Mem0 Platform: Fully managed API with dashboard and scaling.
- Mem0 Open Source: Local SDK that you run in your own environment.
1
Information extraction
Mem0 sends the messages through an LLM that pulls out key facts, decisions, or preferences to remember.
2
Additive storage
New memories are added without overwriting or deleting existing memories.
3
Retrieval
Future searches rank the most relevant memories for the query.
add call: no manual orchestration needed.
Add with Mem0 Platform
Expect a
status: "PENDING" response with an event_id. Poll GET /v1/event/{event_id}/ to confirm completion.Automatic conversation context
On the Platform, you only send new messages. Mem0 automatically pulls the earlier messages that share the same identifiers (user_id, and run_id if you use one) and uses them as context when extracting memories, so you never need to resend conversation history.
This means a follow-up turn is understood against what came before it:
user_id (plus run_id for a distinct session) and Mem0 handles the rest.
This is default behavior and needs no configuration. Earlier SDK versions gated it behind a
version="v2" argument on add; that argument no longer exists and is ignored if sent.Add with Mem0 Open Source
When Should You Add Memory?
Add memory whenever your agent learns something useful:- A new user preference is shared
- A decision or suggestion is made
- A goal or task is completed
- A new entity is introduced
- A user gives feedback or clarification
MCP Alternative: With Mem0 MCP, AI agents can add memories automatically based on context.
More Details
For full list of supported fields, required formats, and advanced options, see the Add Memory API Reference.Managed vs OSS differences
Put it into practice
- Review the Advanced Memory Operations guide to layer metadata and rerankers.
- Explore the Add Memories API reference for every request/response field.
See it live
- Support Inbox with Mem0 shows add + search powering a support flow.
- AI Tutor with Mem0 uses add to personalize lesson plans.