add_memory
Add a memory with AI-driven fact extraction or raw text storage. Scoped by user, agent, or run for personalized management.
Instructions
Store a new memory. Requires at least one of user_id, agent_id, or run_id.
Response contract (never a bare list):
- {"status": "queued", "task_id", "submitted_at", "queue_depth", "estimated_wait_s"}
— infer=true path; extraction runs in background, poll memory_task_status.
- {"status": "stored", "memory_ids": [...], "results": [...]}
— synchronous path; empty memory_ids carries "reason": "no_new_facts".
- {"error": ...} — failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to store as a memory. Converted to messages format internally. | |
| infer | No | If true (default), LLM extracts key facts asynchronously: the call returns a queued envelope with a task_id immediately (use memory_task_status to fetch the resulting memory_ids). If false, stores raw text synchronously. | |
| run_id | No | Run scope identifier. | |
| user_id | No | User scope identifier. Defaults to MEM0_USER_ID. | |
| agent_id | No | Agent scope identifier. | |
| messages | No | Structured conversation history (role/content dicts). When provided, takes precedence over text. | |
| metadata | No | Arbitrary metadata JSON to store alongside the memory. | |
| enable_graph | No | Override default graph toggle for this call. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |