Memory Storage provides 30 APIs over HTTP JSON for managing memory stores, long-term and short-term memories, audit records, asynchronous tasks, memory consolidation (Dream), file memory, and file views. Use these APIs for custom integrations without an SDK.
API list
All APIs grouped by category:
Memory store management
|
API |
Description |
|
|
Creates a memory store. |
|
|
Retrieves memory store details. |
|
|
Updates the description of a memory store. |
|
|
Deletes a memory store. |
|
|
Lists memory stores. |
Long-term memory
|
API |
Description |
|
|
Writes conversation messages or text to generate long-term memories. |
|
|
Searches long-term memories. |
|
|
Lists long-term memories. |
|
|
Retrieves a long-term memory entry. |
|
|
Updates a long-term memory entry. |
|
|
Deletes a long-term memory entry. |
Short-term memory and audit
|
API |
Description |
|
|
Queries short-term memories (original conversation messages). |
|
|
Queries audit records of memory store requests. |
Asynchronous tasks and Scope
|
API |
Description |
|
|
Queries the status and result of an async extraction task. |
|
|
Lists async extraction tasks. |
|
|
Lists the Scopes that exist in a memory store. |
Memory consolidation (Dream)
|
API |
Description |
|
|
Creates a memory consolidation task. |
|
|
Queries the progress of a memory consolidation task. |
|
|
Lists memory consolidation tasks. |
|
|
Lists the proposed actions generated by a memory consolidation task. |
|
|
Applies proposed memory consolidation actions. |
|
|
Cancels a memory consolidation task. |
File memory and file views
|
API |
Description |
|
|
Adds a memory file. |
|
|
Lists files by path prefix with pagination. |
|
|
Retrieves file content or metadata only. |
|
|
Updates file content or renames a file. |
|
|
Deletes a file. |
|
|
Lists historical file versions with pagination. |
|
|
Retrieves a historical file version. |
|
|
Irreversibly redacts a historical file version. |
Common objects
Data structures shared across API requests and responses.
Scope
A Scope defines the ownership hierarchy of memory data.
|
Field |
Type |
Description |
|
|
string |
The application identifier. |
|
|
string |
The tenant or user identifier. |
|
|
string |
The agent identifier. |
|
|
string |
The session, run, or task identifier. |
Required Scope fields and wildcard * support vary by API.
|
Scenario |
Required fields |
Wildcard |
|
Write ( |
|
Empty fields are populated with |
|
Search long-term memories ( |
|
|
|
Query short-term memories ( |
All four Scope fields |
The wildcard |
|
Get, update, or delete a long-term memory entry ( |
All four Scope fields |
The wildcard |
|
File memory and file views (Item APIs) |
All four Scope fields |
The wildcard |
|
List operations ( |
None. We recommend that you provide at least |
The wildcard |
Example:
{
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
}
Message
The messages field of AddMemories uses the following structure.
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The message role, such as |
|
|
string |
Yes |
The message content. |
|
|
string |
No |
The message ID. Maximum length: 256 characters. |
|
|
string |
No |
The timestamp in RFC 3339 format. |
|
|
object |
No |
Message-level metadata. Keys and values must be strings. |
Metadata
String key-value pairs for business tags. Search APIs use metadata for exact-match filtering.
|
Constraint |
Value |
|
Maximum keys per request |
16 |
|
Maximum key length |
64 characters |
|
Maximum value length |
1,024 characters |
Example:
{
"source": "chat",
"topic": "preference"
}
Memory store management
CreateMemoryStore
Creates a memory store.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. The name can contain only letters, digits, and underscores (_) and can be up to 32 characters in length. |
|
|
string |
No |
The memory store description. Maximum length: 1,024 bytes in UTF-8. |
|
|
string |
No |
Custom memory extraction instructions that are injected into the extraction prompt and affect subsequent long-term memory extraction in the memory store. Maximum length: 4,096 characters. |
|
|
string |
No |
The memory capability: |
Request example
{
"memoryStoreName": "agent_memory",
"description": "Long-term memory store for the agent",
"extractInstructions": "Focus on the user's dietary preferences and travel habits"
}
To create a memory store for directly adding memory files:
{
"memoryStoreName": "agent_files",
"storageMode": "filemem"
}
Response example
{
"otsInstance": "mem-test-01",
"memoryStoreName": "agent_memory",
"description": "Long-term memory store for the agent",
"extractInstructions": "Focus on the user's dietary preferences and travel habits",
"storageMode": "ots",
"createdAt": "2026-06-17T07:19:48.935Z",
"updatedAt": "2026-06-17T07:19:48.935Z"
}
GetMemoryStore
Retrieves memory store details.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
Request example
{
"memoryStoreName": "agent_memory"
}
UpdateMemoryStore
Updates the memory store description or custom extraction instructions. This API uses PATCH semantics: fields that are not provided remain unchanged, and an empty string clears the corresponding field.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
No |
The new description. Maximum length: 1,024 bytes in UTF-8. Pass an empty string to clear the description, or omit this field to keep the current description. |
|
|
string |
No |
The new custom extraction instructions. Maximum length: 4,096 characters. To clear the value, pass an empty string. To keep the current value, do not pass this field. |
DeleteMemoryStore
Deletes a memory store.
Deleting a memory store permanently removes all its data. This action is irreversible. Proceed with caution in production environments.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
ListMemoryStores
Lists memory stores.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
int |
No |
The maximum number of entries to return. |
|
|
string |
No |
The pagination token for the next page. |
Long-term memory
AddMemories
Writes conversation messages or text. Raw messages are stored as short-term memories, and long-term memories are extracted from the input.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The target memory store name. |
|
|
object |
Yes |
The Scope. |
|
|
array |
One of messages and |
An array of up to 20 conversation messages. The total content can be up to 32,000 bytes in UTF-8. |
|
|
string |
One of |
The text content. Maximum length: 32,000 bytes in UTF-8. |
|
|
object |
No |
Write-level metadata. Maximum: 16 keys, 64-character keys, 1,024-character values. |
|
|
boolean |
No |
Whether to wait synchronously for memory extraction to complete. Default: |
|
|
string |
No |
The session reference time, or "as-of" anchor, in RFC 3339 format. If this field is set, messages without a |
For AddMemories limits, see Limitations and notes.
When reconcile_enabled is enabled, the write pipeline first retrieves existing vector candidates. The same DecideMemoryActions call then selects ADD, NOOP, UPDATE, DELETE, or MERGE. MERGE does not trigger an additional model call.
Server-side reconcile_merge_mode controls online MERGE behavior: off (default) does not propose merges, shadow validates and observes proposals without applying them, and safe_auto applies safe merges. A merge is accepted only for a high-confidence result that contains two or three sources, including the new memory, within the same complete four-level Scope. The service conservatively checks entities, speakers, polarity, types, explicit times, metadata, and versions.
In off or shadow mode, or when a proposal is rejected or unsafe, the original new memory continues as an ADD. If batch re-embedding fails for an accepted plan or the response format is invalid, all plans in the batch revert to their original ADD operations and the write continues.
If PutMemories fails for a batch that contains a merge result, the API returns a persistence error and does not perform compare-and-swap (CAS) deletion of the sources. The write must not be treated as a successful ADD.
After a merge result is persisted, source finalization errors are nonfatal for the write and the new result remains stored. An ErrConflict or another CAS or backend error that occurs before the row is applied typically leaves the corresponding old source valid for a retry or Dream. Other sources can still complete independently.
A typed row-applied or event-persistence error indicates that the source tombstone is persisted and the deletion is reflected in the cache, but the audit event remains incomplete. An idempotent replay of the same finalization plan or an operations repair fills the event gap. Dream does not reconstruct online audit events. It handles valid old sources, duplicate stored memories, and convergence.
Successful source operations are not rolled back. Search-time semantic deduplication can hide temporary duplicates during the transition.
Use UPDATE when a state changes and a replacement state exists. Use DELETE only to retract a state when no replacement exists. Do not use MERGE for either case. Dream handles larger source sets, cross-session operations, complex conflicts, and repairs.
Request example: Write messages
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"messages": [
{
"role": "user",
"content": "I like coffee."
},
{
"role": "assistant",
"content": "Got it. I'll remember that."
}
],
"metadata": {
"source": "chat"
},
"sync": true
}
Request example: Write text
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "user-001"
},
"text": "The user likes coffee and prefers concise responses."
}
Response fields
|
Field |
Description |
|
|
The request ID. |
|
|
The request status. Asynchronous writes typically return |
|
|
The number of accepted messages. |
|
|
The Scope used for the write. |
|
|
The memory store name. |
|
|
Returned for synchronous writes. The number of memcells created. |
|
|
Returned for synchronous writes. The number of long-term memory units created. |
SearchMemories
Searches long-term memories.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The target memory store name. |
|
|
string |
Yes |
The query text. |
|
|
object |
Yes |
The Scope. |
|
|
object |
No |
The complete Scope of the current session, used as a soft-ranking signal. All four fields must contain exact values without the wildcard |
|
|
int |
No |
The maximum number of results to return. Default: 10. Maximum: 50. Relevance filtering or semantic deduplication can result in fewer than topK results. |
|
|
boolean |
No |
Whether to enable reranking. Default: |
|
|
boolean |
No |
Specifies whether to include short-term memory source evidence (the |
|
|
float |
No |
The relevance threshold in the range |
|
|
object |
No |
Metadata filters for exact matching. Keys and values must be strings. |
When search_semantic_dedup_enabled is enabled on the server, semantic deduplication applies only to the current fused pool of long-term memory candidates for the public SearchMemories API. Answer and internal searches are not affected.
Deduplication runs before reranking and evidence expansion. It uses conservative, structure-aware complete-link clustering and retains one representative per cluster. As a result, duplicate long-term memories do not consume the reranking budget, while short-term evidence remains independent. Deduplication does not expand candidateK, run a second search, generate additional embeddings, backfill results, or use LLM clustering. topK is the maximum number of results. Underfilled results are accepted, and results are not backfilled from the same cluster.
Semantic deduplication does not modify stored rows or ListMemories results. Dream continues to clean up historical duplicates.
Request example
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "*",
"runId": "*"
},
"contextScope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"query": "What beverage does the user like?",
"topK": 5,
"enableRerank": true,
"includeEvidence": true,
"metadata": {
"source": "chat"
}
}
Response fields
|
Field |
Description |
|
|
The list of search results. |
|
|
The long-term memory unit. See the following table for field definitions. |
|
|
The canonical relevance score in the range |
|
|
The normalized cosine similarity between the query and memory in the range |
|
|
The optional final ranking score. This field is returned only when the server-side session affinity mode is |
|
|
Optional ranking details that include |
|
|
The hit source. Example: |
|
|
The list of short-term source evidence returned when |
|
|
The Scope used for the query. |
|
|
The memory store name. |
The following table describes the fields in results[].unit. ListMemories and GetMemory return the same memory fields. Embedding vectors are not returned.
|
Field |
Description |
|
|
The long-term memory unit ID. |
|
|
The associated conversation key. |
|
|
The Scope to which the memory belongs. The object contains |
|
|
The memcell ID. |
|
|
The memory type, such as |
|
|
The memory title. Maximum length: 64 characters. For legacy data or an empty field, clients can display |
|
|
The memory text. |
|
|
The text used for search. |
|
|
A list of up to eight keywords. Each keyword can be up to 32 characters in length. |
|
|
The list of source message IDs. |
|
|
The type label. |
|
|
The date bucket. |
|
|
The metadata object that contains the key-value pairs provided during the write. |
|
|
The metadata in JSON string format. |
|
|
The flattened metadata string used for filtering. |
|
|
Indicates whether the memory is deleted. |
|
|
The creation time. |
|
|
The effective time described by the fact, event, or plan. This time can be earlier or later than the memory write time. |
|
|
The time when the memory was last updated on the server. |
|
|
The time source, such as |
|
|
The original precision of |
|
|
The salience score. |
|
|
The version number. |
|
|
The speaker associated with the memory. Returned when this field is not empty. |
|
|
The topic label. Returned when this field is not empty. |
|
|
The list of related entities. Returned when this field is not empty. |
|
|
The time anchor information. Returned when this field is not empty. |
|
|
The list of source message references. Each element contains |
|
|
The supersession chain created when a memory is merged or updated. Returned when this field is not empty. |
|
|
The provenance fields for a memory that was generated or modified by Dream. Returned when these fields are not empty. |
The same session receives bounded soft weighting. For an exact match with the complete contextScope, rankingScore = score + (1-score) × sessionAffinityWeight. For other results, rankingScore equals score. The server controls the weight, which defaults to 0.10 and can be up to 0.25. Requests cannot override the weight. This signal breaks ties among candidates with similar relevance and does not replace semantic relevance or the minSimilarity threshold.
Compatibility note: Legacy servers strictly reject unknown JSON fields, including contextScope. During a rolling upgrade, upgrade all service replicas before clients send this field. A read-only SDK can retry once without contextScope only after it receives an explicit unknown-field error. Do not use this fallback for write APIs.
ListMemories
Lists long-term memories.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. The wildcard |
|
|
int |
No |
The maximum number of entries to return. |
|
|
string |
No |
The pagination token for the next page. |
Request example
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "*",
"agentId": "*",
"runId": "*"
},
"limit": 20
}
The response returns long-term memories in the memories array. Each memory has the same fields as results[].unit in SearchMemories. Paginated responses include nextToken.
GetMemory
Retrieves a long-term memory entry.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The memory ID. |
|
|
object |
Yes |
The complete Scope. All four fields are required. The wildcard |
UpdateMemory
Updates a long-term memory by using PATCH semantics. Fields that are not provided remain unchanged. Pass an empty string for title or an empty array for keywords to clear the field. At least one updatable field is required.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The memory ID. |
|
|
object |
Yes |
The complete Scope. All four fields are required. The wildcard |
|
|
string |
No |
The new memory text. |
|
|
object |
No |
The new metadata. |
|
|
string |
No |
The new memory title. Maximum length: 64 characters. |
|
|
array |
No |
A list of up to eight new keywords. Each keyword can be up to 32 characters in length. |
|
|
string |
Provide with |
The new effective time. Use RFC 3339 when the precision is |
|
|
string |
Provide with |
The time precision: |
If memory_unit_v2_write_enabled is disabled on the server, an update that includes title, keywords, effectiveAt, or timePrecision returns 409 CONFLICT. This behavior prevents mixed-version replicas from overwriting each other's V2 fields.
DeleteMemory
Deletes a long-term memory entry.
Deleting a long-term memory entry is irreversible. Proceed with caution in production environments.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The memory ID. |
|
|
object |
Yes |
The complete Scope. All four fields are required. The wildcard |
Short-term memory and audit
ListMemoryStoreMessages
Queries short-term memories (original conversation messages).
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The complete Scope. All four fields are required. The wildcard |
|
|
int |
No |
The maximum number of entries to return. |
|
|
string |
No |
The pagination token for the next page. |
|
|
string |
No |
The earliest time in RFC 3339 format. |
|
|
string |
No |
The latest time in RFC 3339 format. |
Request example
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"limit": 100
}
Response example
{
"session": {
"scope": { "appId": "app-001", "tenantId": "user-001", "agentId": "assistant", "runId": "session-001" },
"messages": [
{
"messageId": "d0d9dd778a27e8cde773a243a5bab13c",
"role": "user",
"speaker": "user",
"content": "[10:00 AM on May 13, 2026] I prefer a window seat for future business trips.",
"timestamp": "2026-05-13T10:00:00Z",
"metadata": { "channel": "chat", "source": "chat" }
}
]
}
}
If the memory store exists but no messages exist for the Scope, the operation returns 200 with an empty messages list.
ListMemoryStoreRequests
Queries audit records of memory store requests.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. The wildcard |
|
|
string |
No |
The operation name, such as |
|
|
int |
No |
The maximum number of entries to return. |
|
|
string |
No |
The pagination token for the next page. |
|
|
string |
No |
The earliest time in RFC 3339 format. |
|
|
string |
No |
The latest time in RFC 3339 format. |
Request example
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "*",
"agentId": "*",
"runId": "*"
},
"operation": "AddMemories",
"limit": 50
}
Response fields
|
Field |
Description |
|
|
The request ID. |
|
|
The operation name. |
|
|
The Scope used in the request. |
|
|
The request summary. |
|
|
The response status. |
|
|
The processing latency in milliseconds. |
|
|
The target ID of the operation, such as a memory ID. |
|
|
The creation time of the record. |
Asynchronous tasks and Scope
GetMemoryTask
Queries the status and result of an asynchronous extraction task. Pass the requestId returned by AddMemories.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The request ID returned by |
|
|
object |
No |
Validates the Scope of the task. The wildcard |
Request example
{
"memoryStoreName": "agent_memory",
"requestId": "4b41a912f8c8a66202896e880a505d4a"
}
Response example
{
"memoryStoreName": "agent_memory",
"task": {
"requestId": "4b41a912f8c8a66202896e880a505d4a",
"eventType": "ingest",
"memoryStoreName": "agent_memory",
"conversationKey": "app-001/user-001/assistant/session-001",
"scope": { "appId": "app-001", "tenantId": "user-001", "agentId": "assistant", "runId": "session-001" },
"status": "completed",
"acceptedMessages": 2,
"derivedMemcellId": "98ebdf1de01b620bfa96f55c8925061f",
"derivedUnitIds": ["9ce29432d101aab04253a862c8a11022", "6172bac2ca37b6b82f5224de116f030f"],
"createdAt": "2026-06-17T07:19:59.962Z",
"updatedAt": "2026-06-17T07:20:08.749Z",
"finishedAt": "2026-06-17T07:20:08.749Z"
}
}
Valid values for the task status: queued, running, completed, failed, and needs_reconcile. While the ingest task index is being built after the first write, this API may return 409 CONFLICT (ingest task index is still building, please retry shortly). Retry the request after a short delay.
ListMemoryTasks
Lists async extraction tasks.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. The wildcard |
|
|
string |
No |
The task status filter: |
|
|
int |
No |
The maximum number of entries to return. Default: |
|
|
string |
No |
The pagination token for the next page. |
|
|
string |
No |
The earliest time as a Unix timestamp in milliseconds (RFC 3339 is not supported). |
|
|
string |
No |
The latest time as a Unix timestamp in milliseconds (RFC 3339 is not supported). |
Request example
{
"memoryStoreName": "agent_memory",
"scope": { "appId": "app-001", "tenantId": "user-001", "agentId": "assistant", "runId": "session-001" },
"limit": 5
}
The response returns task objects in the tasks array. Each object has the same fields as the task object returned by GetMemoryTask.
ListMemoryStoreScopes
Lists existing Scopes in a memory store to identify the agents and sessions that generated memories for an application or tenant.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. The wildcard |
|
|
int |
No |
The maximum number of entries to return. Default: |
|
|
string |
No |
The pagination token for the next page. |
Request example
{
"memoryStoreName": "agent_memory",
"scope": { "appId": "app-001", "tenantId": "*", "agentId": "*", "runId": "*" },
"limit": 10
}
Response example
{
"memoryStoreName": "agent_memory",
"scope": { "appId": "app-001", "tenantId": "*", "agentId": "*", "runId": "*" },
"scopes": [
{ "appId": "app-001", "tenantId": "user-001", "agentId": "__default__", "runId": "__default__" },
{ "appId": "app-001", "tenantId": "user-001", "agentId": "assistant", "runId": "session-001" }
]
}
Memory consolidation (Dream)
CreateMemoryDreamTask
Creates an asynchronous memory consolidation (Dream) task to refine and merge stored memories and extract skills or profiles. For the complete workflow, see Memory consolidation.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
array |
Yes |
The list of Scopes to organize. Up to 20 Scopes. |
|
|
string |
No |
The task type: |
|
|
string |
No |
The application mode: |
|
|
string |
No |
The Scope for consolidation results: |
|
|
object |
No |
The confidence thresholds for automatically applying each action. Valid keys are |
|
|
string |
No |
The time range for organization, as Unix timestamps in milliseconds (RFC 3339 is not supported). |
|
|
int |
No |
The maximum input scale. For valid ranges, see the limits documentation. |
|
|
int |
No |
The Scope expansion limit in the range |
|
|
string |
No |
Custom consolidation instructions. Maximum length: 4,000 bytes in UTF-8. |
|
|
boolean |
No |
Specifies whether to continue incremental consolidation from the last successful high-water mark. Default: |
|
|
string |
No |
The idempotency token. |
Request example
{
"memoryStoreName": "agent_memory",
"scopes": [ { "appId": "app-001", "tenantId": "user-001" } ],
"taskType": "memory",
"applyMode": "proposal"
}
Response example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"status": "queued",
"createdAt": "2026-06-17T07:21:25.329Z"
}
GetMemoryDreamTask
Queries the progress and result summary of a memory consolidation task.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the memory consolidation task. |
Response example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"taskType": "memory",
"applyMode": "proposal",
"scopeOutputMode": "preserve_scope",
"status": "completed",
"actions": { "total": 2, "proposed": 2, "applied": 0, "skipped": 0, "failed": 0 },
"input": { "scopes": [ { "appId": "app-001", "tenantId": "user-001", "agentId": "__default__", "runId": "__default__" } ], "sessionCount": 1, "messageCount": 1, "memoryCount": 2, "incremental": false },
"lastError": "",
"createdAt": "2026-06-17T07:21:25.329Z",
"updatedAt": "2026-06-17T07:21:32.276Z",
"finishedAt": "2026-06-17T07:21:32.276Z"
}
Valid values for the task status: queued, running, planning, applying, completed, completed_with_failures, failed, and cancelled.
ListMemoryDreamTasks
Lists memory consolidation tasks.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. The wildcard |
|
|
string |
No |
Filters by task status. |
|
|
int |
No |
The maximum number of entries to return. Default: |
|
|
string |
No |
The pagination token for the next page. |
|
|
string |
No |
The time range as Unix timestamps in milliseconds. RFC 3339 is not supported. |
The response returns task objects in the tasks array. Each object includes fields such as dreamId, status, taskType, actionCount, proposedCount, confidenceThresholds, and createdAt.
ListMemoryDreamActions
Lists proposed actions generated by consolidation tasks. Use one of two mutually exclusive query modes: query by dreamId, or query by scope and actionType for EMIT_SKILL or EMIT_PROFILE actions.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
No |
The ID of the memory consolidation task. This parameter is mutually exclusive with |
|
|
object |
No |
The Scope query, mutually exclusive with |
|
|
string |
No |
Required for a query by |
|
|
object |
No |
Filters by the target Scope of the action. The wildcard |
|
|
string |
No |
Filters by the source memory ID of the action. |
|
|
string |
No |
The action status filter: |
|
|
string |
No |
The action type filter: |
|
|
float |
No |
The confidence filter in the range |
|
|
string |
No |
The sort order: |
|
|
int |
No |
The maximum number of entries to return. Default: |
|
|
string |
No |
The pagination token for the next page. |
Request example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"limit": 20
}
Response example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"actions": [
{
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"actionId": "968768529cdfde8d56686a71e1c28227",
"action": "UPDATE",
"status": "proposed",
"targetScope": { "appId": "app-001", "tenantId": "user-001", "agentId": "__default__", "runId": "__default__" },
"targetMemoryId": "d16fd038835d89ae8586f7814e5256c1",
"newMemory": { "text": "User prefers concise responses.", "unitType": "atomic_fact" },
"reason": "Rewritten as a more accurate atomic_fact.",
"confidence": 0.95,
"createdAt": "2026-06-17T07:21:32.161Z"
}
]
}
ApplyMemoryDreamActions
Applies the proposed actions generated by a memory consolidation task when applyMode=proposal.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the memory consolidation task. |
|
|
array |
Yes |
The list of action IDs to apply. Maximum: 100 IDs per request. |
|
|
string |
No |
The identifier of the applier. This value is recorded in the audit log. |
Request example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"actionIds": ["968768529cdfde8d56686a71e1c28227", "a0f4715245920ea7b6a34c1828c6f1ae"]
}
Response example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"applied": 2,
"failed": 0,
"results": [
{ "actionId": "968768529cdfde8d56686a71e1c28227", "status": "applied", "memoryId": "bd14a67ed215c114896325d912c8fa71" },
{ "actionId": "a0f4715245920ea7b6a34c1828c6f1ae", "status": "applied", "memoryId": "fa253856113f78d51a3b84a1fdf2d110" }
]
}
EMIT_SKILL and EMIT_PROFILE actions are written directly by the consolidation task and do not support manual application. A request that includes either type of action ID is rejected.
CancelMemoryDreamTask
Cancels a memory consolidation task that has not finished.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the memory consolidation task. |
File memory and file view APIs
File memory and file views share eight Item APIs. Each API uses a POST request with a JSON body and a fixed URL. Dynamic URL paths and query parameters are not used.
For directly added memory files, you can add, read, update, rename, and delete files, and query or redact historical versions.
For structured memories, use the same list and read APIs to access read-only file views generated by the service.
readOnly: truein aListItemsresponse indicates that the view is read-only.
The Agent Storage SDK automatically supplies the Item type. When you call the HTTP API directly, explicitly provide the following common fields.
Common request fields
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The value is fixed at |
|
|
string |
Yes |
The target memory store name. |
|
|
object |
Yes |
The Scope that owns the file. Provide exact values for |
Example common fields:
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
}
}
Item response object
|
Field |
Type |
Description |
|
|
string |
The fixed value |
|
|
string |
The stable file identifier used to query historical versions. |
|
|
string |
The file path within the Scope. |
|
|
string |
The file content. |
|
|
string |
The content SHA-256 digest as lowercase hexadecimal without a prefix. |
|
|
int64 |
The content size in UTF-8 bytes. |
|
|
int64 |
The sequence number of the latest file change. |
|
|
string |
The file creation time in RFC 3339 format. |
|
|
string |
The latest file update time in RFC 3339 format. |
ItemVersion response object
|
Field |
Type |
Description |
|
|
string |
The fixed value |
|
|
string |
The version ID. |
|
|
string |
The file ID. |
|
|
int64 |
The version sequence number. Provide this field with |
|
|
string |
The operation that created the version: |
|
|
string |
The file path for the version. The value is an empty string after redaction. |
|
|
string |
The content of the version. Version lists and redacted versions do not return this field. |
|
|
string |
The content digest of the version. The value is an empty string after redaction. |
|
|
int64 |
The content size of the version in bytes. The value is |
|
|
string |
The identifier of the caller session that created the version. This field is omitted if no value was provided. |
|
|
string |
The version creation time in RFC 3339 format. |
|
|
bool |
Indicates whether the version is redacted. Returned only after redaction. |
|
|
string |
The time of the first redaction in RFC 3339 format. Returned only after redaction. |
|
|
string |
The |
AddItem
Adds a memory file. File paths must be unique within the same Scope.
Request parameters
In addition to the common request fields, this API supports the following fields.
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The file path. The service adds a leading |
|
|
string |
No |
The UTF-8 file content, which can be empty. If this field is omitted, an empty file is created. |
|
|
string |
No |
The caller session or operation identifier to record in the version. |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"path": "/profile/preferences.md",
"content": "# User preferences\n\n- Prefers Americano coffee\n",
"sessionId": "session-001"
}
Response example
{
"type": "memoryfile",
"itemId": "fmem_019c12345678abcd1234",
"path": "/profile/preferences.md",
"content": "# User preferences\n\n- Prefers Americano coffee\n",
"contentSha256": "40556ec6bfcf74438386488feea9221a99adbb1e8d2950720c4e228b532b1ece",
"contentSizeBytes": 37,
"latestSeq": 1784786400123456,
"createdAt": "2026-07-23T10:00:00Z",
"updatedAt": "2026-07-23T10:00:00Z"
}
ListItems
Lists files in bytewise path order with pagination. List entries do not include content.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
No |
Lists only files under the specified path prefix. An empty value lists all files. |
|
|
string |
No |
The opaque pagination token returned on the previous page. Use the token with the original |
|
|
int |
No |
The number of entries per page. Default: |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"pathPrefix": "/profile/",
"limit": 100
}
Response example
{
"type": "memoryfile",
"items": [
{
"itemId": "fmem_019c12345678abcd1234",
"path": "/profile/preferences.md",
"contentSha256": "40556ec6bfcf74438386488feea9221a99adbb1e8d2950720c4e228b532b1ece",
"contentSizeBytes": 37,
"latestSeq": 1784786400123456,
"createdAt": "2026-07-23T10:00:00Z",
"updatedAt": "2026-07-23T10:00:00Z"
}
],
"nextToken": "L3Byb2ZpbGUvcHJlZmVyZW5jZXMubWQ"
}
An empty or omitted nextToken indicates that no more files remain. A read-only file view generated from structured memories also returns "readOnly": true at the top level. Directly added file memory does not return this field.
GetItem
Retrieves a file by path. By default, the response includes file content. You can also retrieve metadata only.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The file path. |
|
|
bool |
No |
Specifies whether to return |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"path": "/profile/preferences.md"
}
Response example
{
"type": "memoryfile",
"itemId": "fmem_019c12345678abcd1234",
"path": "/profile/preferences.md",
"content": "# User preferences\n\n- Prefers Americano coffee\n",
"contentSha256": "40556ec6bfcf74438386488feea9221a99adbb1e8d2950720c4e228b532b1ece",
"contentSizeBytes": 37,
"latestSeq": 1784786400123456,
"createdAt": "2026-07-23T10:00:00Z",
"updatedAt": "2026-07-23T10:00:00Z"
}
When includeContent=false, the response has the same structure but omits content. A content read of an empty file explicitly returns "content": "".
UpdateItem
Updates file content or renames a file. Provide exactly one of content and newPath. Providing both or neither returns 400 VALIDATION_ERROR.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The current file path. |
|
|
string |
Conditionally required |
The new UTF-8 content, which can be an empty string. Mutually exclusive with |
|
|
string |
Conditionally required |
The new path after the file is renamed. Mutually exclusive with |
|
|
bool |
No |
Specifies whether a rename can replace an existing destination file. Default: |
|
|
string |
No |
The current content digest. If this value does not match, the API returns |
|
|
string |
No |
The caller session or operation identifier. |
Update content example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"path": "/profile/preferences.md",
"content": "# User preferences\n\n- Prefers latte\n",
"expectedSha256": "40556ec6bfcf74438386488feea9221a99adbb1e8d2950720c4e228b532b1ece"
}
Rename example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"path": "/profile/preferences.md",
"newPath": "/profile/user-preferences.md",
"overwrite": false,
"expectedSha256": "b43e966f005c2ada265e69892da99a473648cad24dea25cdd13848e586f1a7dc"
}
Both operations return the complete updated Item, including content. If expectedSha256 is omitted, the service performs a limited number of protected retries against the latest state instead of overwriting the file unconditionally. High concurrency can still result in 409 SHA_MISMATCH. If multiple writers modify the same path, pass the digest from the latest read.
DeleteItem
Deletes the current file and retains a queryable deletion version.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The path of the file to delete. |
|
|
string |
No |
The current content digest used for concurrency protection. |
|
|
string |
No |
The caller session or operation identifier. |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"path": "/profile/user-preferences.md",
"expectedSha256": "b43e966f005c2ada265e69892da99a473648cad24dea25cdd13848e586f1a7dc"
}
Response example
{
"type": "memoryfile"
}
ListItemVersions
Lists historical versions of a file in reverse chronological order with pagination. List entries do not include content.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The file ID. |
|
|
string |
No |
The current file path. This field is typically not required. |
|
|
string |
No |
The opaque pagination token returned on the previous page. |
|
|
int |
No |
The number of entries per page. Default: |
|
|
string |
No |
Filters by |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"itemId": "fmem_019c12345678abcd1234",
"limit": 20
}
Response example
{
"type": "memoryfile",
"versions": [
{
"versionId": "fmver_019c12349999abcd5678",
"itemId": "fmem_019c12345678abcd1234",
"versionSeq": 1784786700123456,
"operation": "modified",
"path": "/profile/user-preferences.md",
"contentSha256": "b43e966f005c2ada265e69892da99a473648cad24dea25cdd13848e586f1a7dc",
"contentSizeBytes": 31,
"sessionId": "session-001",
"createdAt": "2026-07-23T10:05:00Z"
}
]
}
GetItemVersion
Retrieves a historical version. Provide itemId, versionId, and versionSeq from a list response.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The file ID. |
|
|
string |
Yes |
The version ID. |
|
|
int64 |
Yes |
The version sequence number, which must be greater than |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"itemId": "fmem_019c12345678abcd1234",
"versionId": "fmver_019c12349999abcd5678",
"versionSeq": 1784786700123456
}
Response example
{
"type": "memoryfile",
"versionId": "fmver_019c12349999abcd5678",
"itemId": "fmem_019c12345678abcd1234",
"versionSeq": 1784786700123456,
"operation": "modified",
"path": "/profile/user-preferences.md",
"content": "# User preferences\n\n- Prefers latte\n",
"contentSha256": "b43e966f005c2ada265e69892da99a473648cad24dea25cdd13848e586f1a7dc",
"contentSizeBytes": 31,
"sessionId": "session-001",
"createdAt": "2026-07-23T10:05:00Z"
}
A redacted version still returns 200 and includes redaction and audit fields, but does not return content.
RedactItemVersion
Irreversibly redacts a historical version. Redaction does not modify the current file, change latestSeq, or create a new version.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The file ID. |
|
|
string |
Yes |
The version ID. |
|
|
int64 |
Yes |
The version sequence number, which must be greater than |
|
|
string |
No |
The identifier of the redaction caller, recorded in |
Request example
{
"type": "memoryfile",
"memoryStoreName": "agent_files",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
},
"itemId": "fmem_019c12345678abcd1234",
"versionId": "fmver_019c12349999abcd5678",
"versionSeq": 1784786700123456,
"sessionId": "privacy-job-001"
}
Response example
{
"type": "memoryfile",
"versionId": "fmver_019c12349999abcd5678",
"itemId": "fmem_019c12345678abcd1234",
"versionSeq": 1784786700123456,
"operation": "modified",
"path": "",
"contentSha256": "",
"contentSizeBytes": 0,
"sessionId": "session-001",
"createdAt": "2026-07-23T10:05:00Z",
"redacted": true,
"redactedAt": "2026-07-23T11:00:00Z",
"redactedBy": "privacy-job-001"
}
Redaction requests are idempotent. A repeated request returns the current redaction state. redactedAt and redactedBy retain the values from the first successful request.
File capability differences
|
Operation |
File memory |
File views of structured memories |
|
Add, update, rename, or delete |
Supported |
Returns |
|
List or read |
Supported |
Supported. |
|
List, read, or redact historical versions |
Supported |
Not available. Returns |
Common file API errors
|
HTTP status code |
Error code |
Condition |
|
|
|
The Item type, Scope, path, pagination cursor, update branch, or version parameters are invalid, or the current file view does not provide version capabilities. |
|
|
|
An Item API is called for a memory store that does not provide file capabilities. |
|
|
|
The file or historical version does not exist. |
|
|
|
The new path or rename destination already exists. |
|
|
|
|
|
|
|
A concurrent change is in progress for the same Scope. Retry after a short backoff. |
|
|
|
The file count in the current Scope has reached the limit. |
|
|
|
A request attempts to modify a read-only file view generated from structured memories. |
|
|
|
The file content exceeds the per-file size limit. |
If SHA_MISMATCH or LOCK_CONFLICT occurs, read the latest file before you decide whether to retry. For all file API limits, see Limitations and notes. For SDK integration, see Agent Storage SDK.