add_memory
Store conversation history or text as retrievable memory in a self-hosted system, organizing it by user, agent, or run identifiers for future reference.
Instructions
Store a new memory. Requires at least one of user_id, agent_id, or run_id.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | Yes | Text to store as a memory. Converted to messages format internally. | |
| messages | No | Structured conversation history (role/content dicts). When provided, takes precedence over text. | |
| user_id | No | User scope identifier. Defaults to MEM0_USER_ID. | |
| agent_id | No | Agent scope identifier. | |
| run_id | No | Run scope identifier. | |
| metadata | No | Arbitrary metadata JSON to store alongside the memory. | |
| infer | No | If true (default), LLM extracts key facts. If false, stores raw text. | |
| enable_graph | No | Override default graph toggle for this call. |