Mem0 Block
Agent memory management
The Mem0 block adds long-term memory to your AI agents using Mem0. Add, search, and retrieve memories to persist conversation history, user preferences, and context across workflow executions for enhanced AI agent capabilities.
Overview
| Property | Value |
|---|---|
| Type | mem0 |
| Category | tools |
| Color | #181C1E |
When to Use
- Store conversation messages so an agent remembers prior turns across executions
- Persist user preferences and facts tied to a specific user ID
- Search past memories with a natural-language query to enrich an agent's context
- Retrieve a specific memory by ID or pull all memories for a user within a date range
- Cap the number of results returned from search and get operations with a result limit
- Build personalized agent experiences that carry context from one workflow run to the next
Configuration
Operation
Dropdown that selects which action to perform. Defaults to add.
| Label | ID |
|---|---|
| Add Memories | add |
| Search Memories | search |
| Get Memories | get |
User ID
Required for all operations. Scopes memories to a specific user so that stored data is isolated per-user.
Messages
Shown only when operation is add. Required. A JSON array of message objects, each with role and content fields (e.g. [{"role": "user", "content": "I love Zelaxy!"}]). The array must be non-empty and every element must have both role and content.
Search Query
Shown only when operation is search. Required. A natural-language query used for semantic search over stored memories.
Memory ID
Shown only when operation is get. Optional. When provided, retrieves that single specific memory by its ID using the GET /v1/memories/{id}/ endpoint. When omitted, all memories matching the user and date filters are returned.
Start Date / End Date
Shown only when operation is get. Optional date range filters in YYYY-MM-DD format. Memories whose created_at timestamp falls within the range are returned.
API Key
Required for all operations. Your Mem0 platform API key. Stored as a password (masked) field. Pass it as a secret reference: {{MEM0_API_KEY}}.
Result Limit
Slider (1–50, integer steps). Shown when operation is search or get. Caps the number of results returned. Defaults to 10 when not set.
Inputs & Outputs
Inputs:
operation(string) — Operation to perform (add,search, orget)apiKey(string) — Mem0 API keyuserId(string) — User identifierversion(string) — API versionmessages(json) — Message data array (required foradd)query(string) — Search query (required forsearch)memoryId(string) — Memory identifier (optional, forget)startDate(string) — Start date filter in YYYY-MM-DD format (forget)endDate(string) — End date filter in YYYY-MM-DD format (forget)limit(number) — Result limit (forsearchandget)
Outputs:
ids(json) — Memory identifiers returned by the operationmemories(json) — Memory data objects returned byaddandgetoperationssearchResults(json) — Search result objects returned by thesearchoperation, each containingid,data.memory, andscore
Tools
- Add Memories (
mem0_add_memories) — POSTs a messages array tohttps://api.mem0.ai/v1/memories/scoped to the givenuser_id. Returnsids(array of created memory IDs) andmemories(array of created memory objects). - Search Memories (
mem0_search_memories) — POSTs a semantic search request tohttps://api.mem0.ai/v2/memories/search/with the query anduser_idfilter. ReturnssearchResults(array of objects withid,data.memory, andscore) andids. - Get Memories (
mem0_get_memories) — Retrieves memories by user or by a specific ID. WhenmemoryIdis provided, callsGET https://api.mem0.ai/v1/memories/{id}/; otherwise POSTs tohttps://api.mem0.ai/v2/memories/with user and date-range filters. Returnsmemoriesandids.
YAML Example
mem0_1:
type: mem0
name: "Mem0"
inputs:
operation: "add"
userId: "{{start.userId}}"
messages: '[{"role": "user", "content": "I love Zelaxy!"}]'
apiKey: "{{MEM0_API_KEY}}"
connections:
outgoing:
- target: next-block-id