GetMemory

Updated at:
Copy as MD

Queries the content, associated scope, metadata, source, type, and validity status based on the memory ID.

Operation description

Queries a long-term memory based on the memory ID.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

agentcore:GetMemory

get

*MemoryStore

acs:agentcore:{#regionId}:{#accountId}:workspace/{#workspaceId}/memorystore/{#memoryStoreName}

None None

Request syntax

GET /workspaces/{workspaceId}/memorystores/{memoryStoreName}/memories/{memoryId} HTTP/1.1

Path Parameters

Parameter

Type

Required

Description

Example

workspaceId

string

Yes

The AgentCore workspace ID.

ws-2f5f9c5a8d0e4c3b

memoryStoreName

string

Yes

The MemoryStore name.

customer-memory

memoryId

string

Yes

The long-term memory ID.

mem-2f5f9c5a8d0e4c3b

Request parameters

Parameter

Type

Required

Description

Example

No parameters required.

Response elements

Element

Type

Description

Example

object

requestId

string

The request ID.

01A00000-0000-0000-0000-000000000001

message

string

The response message.

success

httpStatusCode

integer

The HTTP status code.

200

code

string

The business status code.

SUCCESS

success

boolean

Indicates whether the request is successful.

data

object

The long-term memory details.

memoryId

string

The long-term memory ID.

mem-2f5f9c5a8d0e4c3b

content

object

The memory content.

text

string

The memory text.

The user likes hiking

scope

object

The memory scope.

userId

string

The user ID. The length is limited to 1 to 128 UTF-8 bytes. The value cannot contain a forward slash (/) or an asterisk (*). This field is not returned if the memory is not associated with a user ID.

user-001

teamId

string

The business team ID defined by the caller. The value cannot be empty when provided and can be up to 128 UTF-8 bytes in length.

team-001

agentId

string

The agent ID. The length is limited to 1 to 128 UTF-8 bytes. The value cannot contain a forward slash (/) or an asterisk (*). This field is not returned if the memory is not associated with an agent ID.

agent-001

sessionId

string

The session ID. The length is limited to 1 to 128 UTF-8 bytes. The value cannot contain a forward slash (/) or an asterisk (*). This field is not returned if the memory is not associated with a session ID.

session-001

metadata

object

The memory metadata.

{"topic":"hiking"}

string

The metadata value.

hiking

source

string

The memory source. Valid values:

  • session_extraction: extracted from session events

  • content_extraction: extracted from text or messages

  • direct: written directly

Valid values:

  • session_extraction
  • content_extraction
  • direct

session_extraction

type

string

The memory content type. Valid values:

  • semantic: semantic memory

  • skill: skill

  • user_profile: user preference

  • session_summary: session summary

Valid values:

  • session_summary
  • semantic
  • user_profile
  • skill

semantic

valid

boolean

Indicates whether the memory is valid. A value of false indicates that the memory is revoked and is not included in valid memory retrieval.

createdAt

string

The creation time. The time is in RFC 3339 format. The Z at the end of the example indicates the UTC time zone.

2026-09-23T10:00:00Z

updatedAt

string

The last updated time. The time is in RFC 3339 format. The Z at the end of the example indicates the UTC time zone.

2026-09-23T10:05:00Z

Examples

Success response

JSON format

{
  "requestId": "01A00000-0000-0000-0000-000000000001",
  "message": "success",
  "httpStatusCode": 200,
  "code": "SUCCESS",
  "success": false,
  "data": {
    "memoryId": "mem-2f5f9c5a8d0e4c3b",
    "content": {
      "text": "The user likes hiking"
    },
    "scope": {
      "userId": "user-001",
      "teamId": "team-001",
      "agentId": "agent-001",
      "sessionId": "session-001"
    },
    "metadata": {
      "key": "hiking"
    },
    "source": "session_extraction",
    "type": "semantic",
    "valid": false,
    "createdAt": "2026-09-23T10:00:00Z",
    "updatedAt": "2026-09-23T10:05:00Z"
  }
}

Error codes

HTTP status code

Error code

Error message

Description

400 InvalidParameter The specified request parameter is invalid.
400 UnsupportedOperation The memory store does not support this operation.
500 UnknownError The request processing has failed due to some unknown error.
403 Forbidden You are not authorized to perform this operation.
404 Resource.NotFound The specified memory store does not exist.
429 Throttling Request was denied due to request throttling.
409 Operation.Conflict The memory store is not in a state that permits this operation.

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.