All Products
Search
Document Center

Tablestore:List short-term messages

Last Updated:Sep 24, 2026

Use the ListMemoryStoreMessages interface to query short-term memory, which consists of original session messages.

Prerequisites

  • An AgentStorage instance has been created and is in the normal state. Obtain the instance endpoint and instance name.

  • An API Key has been created.

  • Scope rule: Querying short-term memory requires a complete Scope. All four fields (appId, tenantId, agentId, runId) are required, and wildcards (*) are not allowed.

Request parameters

Field

Type

Required

Description

memoryStoreName

string

Yes

The name of the memory store.

scope

object

Yes

The complete Scope. All four fields are required, and wildcards (*) are not allowed.

limit

int

No

The number of results to return.

nextToken

string

No

The pagination token for the next page.

minTimestamp

string

No

The minimum timestamp in RFC3339 format.

maxTimestamp

string

No

The maximum timestamp in RFC3339 format.

Request example

When you use 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>/ListMemoryStoreMessages \
  -H "x-ots-instancename: <instance-name>" \
  -H "x-ots-apikey: <your-api-key>" \
  -H "Content-Type: application/json" \
  -d '{
  "memoryStoreName": "agent_memory",
  "scope": {
    "appId": "app-001",
    "tenantId": "user-001",
    "agentId": "assistant",
    "runId": "session-001"
  },
  "limit": 100
}'

Response

Field

Description

session

The session message wrapper object.

session.scope

The queried Scope.

session.messages

The message list.

session.messages[].messageId

The message ID.

session.messages[].role

The message role.

session.messages[].speaker

The speaker identifier.

session.messages[].content

The message content.

session.messages[].timestamp

The message timestamp in RFC3339 format.

session.messages[].metadata

The message metadata.

{
  "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] 我以后出差都优先订靠窗座位",
        "timestamp": "2026-05-13T10:00:00Z",
        "metadata": { "channel": "chat", "source": "chat" }
      }
    ]
  }
}

When the memory store exists but no messages are found for the specified Scope, 200 is returned with an empty messages list.