Overview
About Managing Memories
Managing memories allows you to store, view, search, update, and delete facts and conversational history across different users, agents, and sessions. The memory system processes interactions to extract relevant preferences, details, and context, making future interactions personalized and informed.
Core Concepts
To effectively manage memories, it helps to understand how data is organized and targeted:
- Memory Identifier (
memory_id): A unique identifier assigned to every individual saved memory item, used when retrieving history, updating, or deleting specific records. - Identifiers & Scopes: Memories can be isolated or grouped using parameters such as
user_id,agent_id,app_id(or project ID), andrun_id(session ID). - Inference: By default, text or messages passed to the memory system undergo smart extraction to pull out distinct, manageable facts. You can disable this to store entries verbatim.
Saving Memories
Storing Information
You can save new information by providing raw text, individual facts, or full conversation turns. The system automatically processes the input to extract useful facts, preferences, or details.
How to Save a Memory
- Provide the content you want to store (either as a direct string, a list of facts, or conversation messages).
- Specify optional scoping parameters such as a user ID, agent ID, or app/project ID to organize where the memory lives.
- Submit the request to store the information. The system confirms creation or notes any updates made to existing overlapping facts.
Tip
If you want to store a fact verbatim without the system attempting automatic fact extraction, set the inference option to false.
Viewing and Searching Memories
Retrieval Methods
You can retrieve stored records either by searching for semantic relevance or by browsing through lists within a specific scope.
Browsing All Memories
To view stored memories without a specific query, you can list or paginate through records using your filters or scoping parameters (such as user_id, agent_id, or run_id).
Searching Memories
To find memories relevant to a specific topic or question:
- Provide a search query string.
- Apply optional filters (such as
user_idor metadata filters) to narrow your search space. - Adjust the limit (
top_k) to control how many results are returned.
Note
Top-level entity parameters inside search requests are deprecated in favor of nested filter objects. Always scope searches using filters where supported.
Updating Memories
In-Place Modifications
When a stored fact or preference changes, you can modify it in place rather than deleting and re-creating it. Updating in place preserves the unique memory identifier and its complete modification history.
How to Update a Memory
- Locate the exact
memory_idof the record you wish to change. - Provide the updated text content, new metadata, or expiration date values.
- Submit the update. The system re-indexes the new content and records an update event in the history log.
Important
At least one modifiable field (such as text, metadata, timestamp, or expiration date) must be provided when updating a memory.
Deleting Memories
Removal and Cleanup
You can remove individual memories that are obsolete or incorrect, or clear out entire groups of memories when requested.
Deleting a Single Memory
- Identify the unique
memory_idof the record you want to remove. - Issue a deletion request for that ID. The memory and its associated tracking links are permanently removed.
Deleting Bulk Memories
You can delete all memories associated with a specific user, agent, app, or session identifier.
Caution
Bulk deletions and project-wide memory wipes are irreversible. Ensure you have explicit confirmation before clearing all data for a user or project scope.
Related
On This Page
OverviewAbout Managing MemoriesCore ConceptsSaving MemoriesStoring InformationHow to Save a MemoryViewing and Searching MemoriesRetrieval MethodsBrowsing All MemoriesSearching MemoriesUpdating MemoriesIn-Place ModificationsHow to Update a MemoryDeleting MemoriesRemoval and CleanupDeleting a Single MemoryDeleting Bulk MemoriesRelated