Evaluate whether Memory Storage fits your use case by reviewing its architecture, data model, Scope-based multi-tenancy, and performance benchmarks.
System architecture
Memory Storage is fully managed — you interact through APIs without provisioning or managing servers. Data flows through the following steps:
-
Call the
AddMemoriesAPI with conversation messages (messages) or plain text (text). -
The service saves the raw messages as short-term memories.
-
The service extracts searchable long-term memory units from the messages and persists them to Tablestore.
-
When you call the
SearchMemoriesAPI, the service combines semantic search and keyword search with optional reranking to return relevant long-term memories.
Data model
A memory store organizes data into the following entities.
|
Entity |
Description |
|
MemoryStore |
A memory store. The top-level container that manages memory data. |
|
Memory |
A long-term memory. Searchable information extracted from conversations or text. |
|
Message |
A short-term memory. The raw conversation message written to the store. |
MemoryStore
A MemoryStore is the top-level container for memory data. Create one before writing messages, searching memories, or querying audit logs.
Common usage patterns:
-
Create a separate memory store for each application.
-
Create a separate memory store for each environment, such as development, staging, and production.
-
Create a separate memory store for each business line.
Memory store names can contain only letters, digits, and underscores, with a maximum length of 32 characters.
Memory
A Memory is a long-term memory unit extracted from conversation messages or text, designed for persistent storage and retrieval.
A long-term memory typically contains:
-
Memory ID.
-
Memory text.
-
Scope.
-
Metadata.
-
Creation time.
-
Management information such as version and replacement history.
Retrieve long-term memories by calling SearchMemories, and manage them through ListMemories, GetMemory, UpdateMemory, and DeleteMemory.
Message
A Message is a short-term memory — the raw conversation message written to the store. Messages passed to AddMemories are persisted as-is and queryable through ListMemoryStoreMessages.
Short-term memory APIs require a fully specified Scope: appId, tenantId, agentId, and runId must all be provided. Wildcards are not allowed.
Scope multi-tenancy
Scope defines the ownership and isolation boundary of memory data. Memory Storage uses a four-level Scope hierarchy: appId / tenantId / agentId / runId.
|
Field |
Description |
|
|
Application identifier. Typically maps to a business application or product. |
|
|
Tenant or user identifier. |
|
|
Agent identifier. |
|
|
Session, run, or task identifier. |
The Scope hierarchy is:
appId > tenantId > agentId > runId
Core rules:
-
On write,
appIdis required. Other fields default to__default__if left blank. Wildcards (*) are not allowed on write. -
When searching long-term memories,
appIdandtenantIdare required.agentIdandrunIdaccept the wildcard*for cross-agent or cross-session retrieval. -
When querying short-term memories, all four fields are required and wildcards are not allowed.
Search examples:
-
agentId="",runId="": Retrieve all memories across all agents and sessions for the specified tenant. -
agentId="sales_assistant",runId="*": Retrieve all session memories for the specified agent under the tenant.
Common search scope examples
|
Search scope |
Scope configuration |
Use case |
|
Within the current session |
Specify all four fields: |
Use only the current session history |
|
Across sessions |
|
Reuse user preferences across sessions for the same agent |
|
Across agents and sessions |
|
Share user memories across multiple agents |
Scope vs. multiple memory stores
Use Scope to isolate data within a single store when it belongs to different users or agents in the same application — this supports wildcard-based cross-Scope searches and reduces management overhead. Create separate stores only when business domains require fully independent data spaces.
Memory ingestion
Memory Storage supports two ingestion methods:
-
Conversation messages: Call the
AddMemoriesAPI with amessagesarray. The service saves the raw messages as short-term memories and extracts long-term memory units from them. -
Plain text: Call the
AddMemoriesAPI with thetextfield to submit raw text. The service extracts searchable long-term memories from the text.
Ingestion runs asynchronously by default (sync=false): raw messages are persisted immediately and become queryable as short-term memories, while long-term extraction runs in the background. Use the requestId returned by AddMemories to call GetMemoryTask and track extraction status together with the memory units produced. Each store can also carry custom extractInstructions, set at store creation or update time, that steer long-term extraction toward business-critical information.
Memory retrieval
SearchMemories retrieves long-term memories using natural language queries. The service combines semantic search and keyword search with optional reranking. Reranking is enabled by default.
Each result carries a fused ranking score and a normalized similarity. Use minSimilarity to filter out low-relevance hits. Set includeEvidence=true to attach the raw short-term message snippets (evidence) behind each hit — this improves explainability for downstream answer models.
Metadata
Long-term memories support custom metadata for business-specific information such as source, tags, and priority. Metadata is stored alongside each memory and returned in search results.
Request auditing
All requests to a memory store are logged. Call ListMemoryStoreRequests to query audit records, which include operation type, response status, latency, and failure reason.
Memory consolidation (Dream)
Memory consolidation (Dream) is an asynchronous capability that refines the data already stored in a memory store. The service analyzes long-term memories and raw messages in the background and produces actionable consolidation actions. Actions fall into three categories:
-
Memory refinement (
memory): deduplicate, rewrite, merge, and remove outdated long-term memories throughADD,UPDATE,DELETE,MERGE, andNOOPactions. -
Skill extraction (
skill): distill reusable skills from historical interactions through theEMIT_SKILLaction. -
Profile extraction (
profile): build structured user profiles through theEMIT_PROFILEaction.
Consolidation supports two modes: proposal generates suggestions that require manual or programmatic confirmation before they are applied, while safe_auto applies actions automatically once a confidence threshold is met.
Async tasks and observability
Both memory ingestion and consolidation run as asynchronous tasks. The service exposes matching query APIs:
-
GetMemoryTaskandListMemoryTasks: inspect the status and output of memory extraction tasks. -
GetMemoryDreamTask,ListMemoryDreamTasks, andListMemoryDreamActions: inspect consolidation tasks and the actions they produce. -
ListMemoryStoreScopes: list the Scopes that already exist in a memory store — useful for discovering which agents and sessions under a given app or tenant have produced memories. -
ListMemoryStoreRequests: query request audit logs.
Applicability assessment
Recommended scenarios:
-
Conversational applications such as customer service bots, sales assistants, and enterprise assistants.
-
Personal assistants that remember user preferences, settings, and past choices across sessions.
-
Shared memory management in multi-agent collaboration scenarios.
-
Agent applications that require raw conversation logs with audit trail support.
-
Production systems that need stable retrieval performance at scale with large numbers of tenants and memories.
Scenarios that require evaluation:
-
Use cases with strict real-time requirements for memory ingestion. Memory extraction is asynchronous and introduces processing latency.
-
Use cases that require custom memory extraction strategies. The current extraction process is fully automated by the service.
Not recommended:
-
Pure structured data queries. Use the Tablestore wide column model or a relational database instead.
-
Applications that only need simple context window management without persistent memory. Use the LLM context window directly.
Performance benchmarks
Memory Storage was benchmarked against Mem0 across four dimensions: retrieval accuracy, retrieval latency, storage scale, and token cost.
|
Metric |
Memory Storage |
Industry comparison |
|
Overall retrieval accuracy |
88.25% |
~37.4% higher than Mem0 (64.20%) |
|
P50 retrieval latency |
~155 ms |
~75% lower than typical solutions (200–500 ms) |
|
Verified storage scale |
100 million+ memories, horizontally scalable with no upper limit |
Typical solutions support millions to tens of millions |
|
Token savings |
95% |
~95% reduction compared to Plan A (full context injection) |
These benchmarks reflect typical performance. Actual results vary with data volume, query patterns, network conditions, model configuration, and data distribution.
Retrieval accuracy
Benchmark: LoCoMo dataset
LoCoMo is a widely used benchmark for memory systems. Unlike earlier benchmarks that cover only 3–5 short turns, each LoCoMo test case averages 300 conversation turns across 35 sessions, closely resembling real-world long-term interactions.
LoCoMo originally defines five categories of reasoning questions (single-hop, multi-hop, temporal reasoning, open-domain, and adversarial). The evaluation covered four of these categories.
|
Evaluation dimension |
Definition |
Example in everyday conversation |
|
Single-hop reasoning |
Locate a fact directly from a single session |
"What did I say my favorite drink was?" |
|
Multi-hop reasoning |
Derive an answer by combining information across multiple sessions |
"Based on my dietary preferences and health report, recommend a lunch" |
|
Temporal reasoning |
Understand time-based clues and chronological order |
"I first said I wanted to change jobs, then said I'd stay. What's my current stance?" |
|
Open-domain reasoning |
Combine user history with external common sense |
"I said I'm allergic to peanuts. Can I eat satay sauce?" |
Evaluation results:
|
Memory solution |
Single-hop |
Multi-hop |
Temporal |
Open-domain |
Overall accuracy |
|
Memory Storage |
88.94% |
90.78% |
88.16% |
75.00% |
88.25% |
|
Mem0 |
68.97% |
61.70% |
58.26% |
50.00% |
64.20% |
Tablestore Memory Storage has higher accuracy than Mem0 across all four reasoning categories: about 20 percentage points higher on single-hop reasoning (direct fact lookup); on multi-hop and temporal reasoning—the categories closest to real-world complexity—the gap widens further, reaching about 29 and 30 percentage points respectively. This matters most when the AI must link multiple conversations or reason about time to answer.
Scope: The Tablestore Memory Storage row uses the full LoCoMo benchmark—10 conversations and 1,540 questions across 4 reasoning categories. Both the answering model and the judge model are qwen-max, using Mem0's official latest LoCoMo answering Prompt and the Mem0-provided lenient judge. The Mem0 row reports its publicly published results.
Retrieval latency
The test was conducted at scale with 1.2 million tenants and over 100 million memories in a single memory store, with reranking disabled.
|
Top-K |
Average latency |
P50 latency |
P95 latency |
|
5 |
164 ms |
155 ms |
269 ms |
|
10 |
198 ms |
174 ms |
288 ms |
|
50 |
234 ms |
222 ms |
384 ms |
At 100 million+ memories, P50 latency stays around 200 ms, and P95 remains under 384 ms even when returning Top 50 results. For applications with millions of daily active users, each search completes within 200 ms with all user memories in a single store. Enabling reranking adds 200–300 ms.
Storage scale
A single memory store has been verified to support 1.2 million tenants and over 100 million memories. Built on Tablestore's distributed architecture, the system scales horizontally with no capacity planning or tenant-based sharding required.
Token cost
Plan A (inject the entire dialogue history each turn) vs. Plan B (one-time extraction plus injecting only retrieved memories each turn). Dialogue tokens are counted precisely from the model service usage field; extraction tokens are reproduced with the production extraction prompt (conservative).
|
Metric (across 4 conversations) |
Plan A |
Plan B |
|
Per-question dialogue tokens: average dialogue tokens per question |
24,985 |
823 |
|
One-time extraction tokens (across 4 conversations) |
— |
320,667 |
|
Full dialogue with context tokens: extrapolated to 827 questions across 4 conversations |
20,662,543 |
1,001,153 |
|
Dialogue-only savings |
— |
96.7% |
|
Total savings including extraction |
— |
95.1% |