Call Memory Storage directly through HTTP JSON APIs, covering memory store management, long-term memory read/write, short-term memory and audit queries, and memory consolidation (Dream) tasks. Use these APIs for custom integration 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. |
Async 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 dream
|
API |
Description |
|
|
Creates a memory dream task. |
|
|
Queries the progress of a memory dream task. |
|
|
Lists memory dream tasks. |
|
|
Lists the actions (proposals) generated by a dream task. |
|
|
Applies the proposed actions from a dream task. |
|
|
Cancels a memory dream task. |
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 |
|
List queries ( |
|
The wildcard |
Example:
{
"appId": "app-001",
"tenantId": "user-001",
"agentId": "assistant",
"runId": "session-001"
}
Message
Structure for the messages field in AddMemories.
|
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"
}
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 characters. |
|
|
string |
No |
The custom extraction instructions for the memory store. Maximum length: 4,096 characters. |
Request example
{
"memoryStoreName": "agent_memory",
"description": "Long-term memory store for the agent",
"extractInstructions": "Focus on the user's dining preferences and travel habits."
}
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 description of a memory store.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The new description. Maximum length: 1,024 characters. |
|
|
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. |
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 |
Either |
An array of conversation messages. Maximum: 20 messages, 32,000 characters total. |
|
|
string |
Either |
The text content. Maximum length: 32,000 characters. |
|
|
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: |
For the complete description of limits, see Limitations and notes.
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 drinking coffee"
},
{
"role": "assistant",
"content": "OK, 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. |
|
|
int |
No |
Number of results to return. Default: |
|
|
boolean |
No |
Specifies whether to include short-term memory source evidence (the |
|
|
float |
No |
The similarity filter threshold. Valid values: |
|
|
boolean |
No |
Whether to enable reranking. Default: |
|
|
object |
No |
Metadata filters for exact matching. Keys and values must be strings. |
For the complete description of the topK limit, see Limitations and notes.
Request example
{
"memoryStoreName": "agent_memory",
"scope": {
"appId": "app-001",
"tenantId": "user-001",
"agentId": "*",
"runId": "*"
},
"query": "What beverages 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 relevance score. |
|
|
The normalized cosine similarity ( |
|
|
The hit source. Example: |
|
|
The list of short-term memory source evidence returned when |
|
|
The Scope used for the query. |
|
|
The memory store name. |
Fields in results[].unit:
|
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 unit type. |
|
|
The memory text. |
|
|
The text used for search. |
|
|
The list of source message IDs. |
|
|
The type label. |
|
|
The date bucket. |
|
|
The metadata in JSON string format. |
|
|
Indicates whether the memory is deleted. |
|
|
The creation time. |
|
|
The salience score. |
|
|
The version number. |
ListMemories
Lists long-term memories.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. |
|
|
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
}
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 entry. Specify at least one of text or metadata.
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. |
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 |
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 13 May, 2026] From now on, always book me a window seat when I travel for business.",
"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. |
GetMemoryTask
Queries the status and result of an async 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. You can use 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": "b1bb4faec235b0d55bc8830da8ffa9f2",
"derivedUnitIds": ["88432eb9d28e0787791625da916d6a20", "480230ab0806e88fd69e0804599552a4"],
"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. The response returns task objects in the tasks array. Each element has the same structure as the task field in the GetMemoryTask response.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. You can use 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 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
}
ListMemoryStoreScopes
Lists the Scopes that exist in a memory store. Use this operation to check which agents and sessions have produced memories under a given application or tenant.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. You can use 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" }
]
}
CreateMemoryDreamTask
Creates a memory dream task that performs secondary refinement, merging, and skill or profile extraction on memories that have been written. The task runs asynchronously.
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 apply mode: |
|
|
string |
No |
The result attribution mode: |
|
|
object |
No |
The confidence thresholds for automatic application, keyed by action: |
|
|
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 maximum number of expanded Scopes. Valid values: |
|
|
string |
No |
The custom organization instructions. Maximum length: 4,000 characters. |
|
|
boolean |
No |
Specifies whether to perform incremental organization. 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 dream task.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the dream task. |
Request example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7"
}
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 dream tasks. The response returns task objects in the tasks array. Each element contains fields such as dreamId, status, taskType, actionCount, proposedCount, confidenceThresholds, and createdAt.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
object |
Yes |
The Scope. You can use 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). |
Request example
{
"memoryStoreName": "agent_memory",
"scope": { "appId": "app-001", "tenantId": "*", "agentId": "*", "runId": "*" },
"limit": 10
}
ListMemoryDreamActions
Lists the actions (proposals) generated by a memory dream task.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
No |
The ID of the dream task. This parameter is mutually exclusive with |
|
|
object |
No |
Queries by Scope. This parameter is mutually exclusive with |
|
|
string |
No |
Filters by action status: |
|
|
string |
No |
Filters by action type: |
|
|
float |
No |
Filters by confidence. Valid values: |
|
|
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 precise atomic_fact statement.",
"confidence": 0.95,
"createdAt": "2026-06-17T07:21:32.161Z"
}
]
}
The two query modes are mutually exclusive. Querying by dreamId returns all actions under the task. Querying by scope and actionType (only EMIT_SKILL or EMIT_PROFILE) returns the skills or profiles accumulated within that range.
ApplyMemoryDreamActions
Applies the proposed actions generated by a memory dream task (when applyMode=proposal).
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the dream task. |
|
|
array |
Yes |
The list of action IDs to apply. This list cannot be empty. A single request supports up to 100 action IDs. |
|
|
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 dream task and do not have a manual apply flow. Including action IDs of these types causes the request to be rejected. If actionIds is an empty array, the request returns 403.
CancelMemoryDreamTask
Cancels a memory dream task that has not finished.
Request parameters
|
Field |
Type |
Required |
Description |
|
|
string |
Yes |
The memory store name. |
|
|
string |
Yes |
The ID of the dream task. |
Request example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7"
}
Response example
{
"memoryStoreName": "agent_memory",
"dreamId": "2a528008111f5dc3500c73fd965089f7",
"status": "cancelled",
"taskType": "memory"
}
Only tasks that have not finished can be canceled. For tasks that have already reached a terminal state (completed, failed, or cancelled), the response still returns 200 with the original status value, and the task itself is not modified.