All Products
Search
Document Center

Tablestore:Query memory

Last Updated:Sep 24, 2026

Use the GetMemory operation to retrieve a single long-term memory.

Prerequisites

  • An AgentStorage instance has been created and its status is normal, and you have obtained the instance endpoint and instance name.

  • An API Key has been created.

  • Scope rules: scope is an optional field. When provided, all four fields (appId, tenantId, agentId, runId) are required, and the wildcard * is not allowed.

Request parameters

Field

Type

Required

Description

memoryStoreName

string

Yes

The name of the memory store.

memoryId

string

Yes

The memory ID.

scope

object

No

Optional. The complete Scope used to verify memory ownership. When provided, all four fields are required, and the wildcard * is not allowed.

Request example

When using API Key authentication, pass the instance name and API Key through the x-ots-instancename and x-ots-apikey request headers.

curl -X POST https://<endpoint>/GetMemory \
  -H "x-ots-instancename: <instance-name>" \
  -H "x-ots-apikey: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{"memoryStoreName":"agent_memory","memoryId":"<memory-id>","scope":{"appId":"app-001","tenantId":"user-001","agentId":"assistant","runId":"session-001"}}'

Response

Field

Description

memoryStoreName

The name of the memory store.

memory

The retrieved long-term memory unit. Its field definitions are the same as results[].unit in the SearchMemories response (snake_case naming; the embedding vector is not returned).

{
  "memoryStoreName": "agent_memory",
  "memory": {
    "id": "1b88d0d65a5b6c0d9142e9b7c7347048",
    "conversation_key": "app-001/user-001/assistant/session-001",
    "scope": { "appId": "app-001", "tenantId": "user-001", "agentId": "assistant", "runId": "session-001" },
    "unit_type": "entity_fact",
    "text": "[2026-08-25T05:52:19Z] I only use Python for scripting.",
    "keywords": ["Python", "scripting", "programming language", "preference"],
    "title": "User programming language preference",
    "version": 1,
    "salience": 0.8,
    "effective_at": "2026-08-25T05:52:19Z",
    "time_precision": "second",
    "created_at": "2026-08-25T05:52:19.185Z",
    "updated_at": "2026-08-25T05:52:30.509Z"
  }
}