2026/04/16 - Amazon Bedrock AgentCore - 2 updated api methods
Changes Introducing NamespacePath in AgentCore Memory to support hierarchical prefix based memory record retrieval.
{'namespacePath': 'string'}
Lists memory records in an AgentCore Memory resource based on specified criteria. We recommend using pagination to ensure that the operation returns quickly and successfully.
To use this operation, you must have the bedrock-agentcore:ListMemoryRecords permission.
See also: AWS API Documentation
Request Syntax
client.list_memory_records(
memoryId='string',
namespace='string',
namespacePath='string',
memoryStrategyId='string',
maxResults=123,
nextToken='string'
)
string
[REQUIRED]
The identifier of the AgentCore Memory resource for which to list memory records.
string
The namespace prefix to filter memory records by. Returns all memory records in namespaces that start with the provided prefix.
string
Use namespacePath for hierarchical retrievals. Return all memory records where namespace falls under the same parent hierarchy.
string
The memory strategy identifier to filter memory records by. If specified, only memory records with this strategy ID are returned.
integer
The maximum number of results to return in a single call. The default value is 20.
string
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
dict
Response Syntax
{
'memoryRecordSummaries': [
{
'memoryRecordId': 'string',
'content': {
'text': 'string'
},
'memoryStrategyId': 'string',
'namespaces': [
'string',
],
'createdAt': datetime(2015, 1, 1),
'score': 123.0,
'metadata': {
'string': {
'stringValue': 'string'
}
}
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
memoryRecordSummaries (list) --
The list of memory record summaries that match the specified criteria.
(dict) --
Contains summary information about a memory record.
memoryRecordId (string) --
The unique identifier of the memory record.
content (dict) --
The content of the memory record.
text (string) --
The text content of the memory record.
memoryStrategyId (string) --
The identifier of the memory strategy associated with this record.
namespaces (list) --
The namespaces associated with this memory record.
(string) --
createdAt (datetime) --
The timestamp when the memory record was created.
score (float) --
The relevance score of the memory record when returned as part of a search result. Higher values indicate greater relevance to the search query.
metadata (dict) --
A map of metadata key-value pairs associated with a memory record.
(string) --
(dict) --
Value associated with the eventMetadata key.
stringValue (string) --
Value associated with the eventMetadata key.
nextToken (string) --
The token to use in a subsequent request to get the next set of results. This value is null when there are no more results to return.
{'namespacePath': 'string'}
Searches for and retrieves memory records from an AgentCore Memory resource based on specified search criteria. We recommend using pagination to ensure that the operation returns quickly and successfully.
To use this operation, you must have the bedrock-agentcore:RetrieveMemoryRecords permission.
See also: AWS API Documentation
Request Syntax
client.retrieve_memory_records(
memoryId='string',
namespace='string',
namespacePath='string',
searchCriteria={
'searchQuery': 'string',
'memoryStrategyId': 'string',
'topK': 123,
'metadataFilters': [
{
'left': {
'metadataKey': 'string'
},
'operator': 'EQUALS_TO'|'EXISTS'|'NOT_EXISTS',
'right': {
'metadataValue': {
'stringValue': 'string'
}
}
},
]
},
nextToken='string',
maxResults=123
)
string
[REQUIRED]
The identifier of the AgentCore Memory resource from which to retrieve memory records.
string
The namespace prefix to filter memory records by. Searches for memory records in namespaces that start with the provided prefix.
string
Use namespacePath for hierarchical retrievals. Return all memory records where namespace falls under the same parent hierarchy.
dict
[REQUIRED]
The search criteria to use for finding relevant memory records. This includes the search query, memory strategy ID, and other search parameters.
searchQuery (string) -- [REQUIRED]
The search query to use for finding relevant memory records.
memoryStrategyId (string) --
The memory strategy identifier to filter memory records by.
topK (integer) --
The maximum number of top-scoring memory records to return. This value is used for semantic search ranking.
metadataFilters (list) --
Filters to apply to metadata associated with a memory.
(dict) --
Filters to apply to metadata associated with a memory. Specify the metadata key and value in the left and right fields and use the operator field to define the relationship to match.
left (dict) -- [REQUIRED]
Left expression of the event metadata filter.
metadataKey (string) --
Key associated with the metadata in an event.
operator (string) -- [REQUIRED]
The relationship between the metadata key and value to match when applying the metadata filter.
right (dict) --
Right expression of the ``eventMetadata``filter.
metadataValue (dict) --
Value associated with the key in eventMetadata.
stringValue (string) --
Value associated with the eventMetadata key.
string
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
integer
The maximum number of results to return in a single call. The default value is 20.
dict
Response Syntax
{
'memoryRecordSummaries': [
{
'memoryRecordId': 'string',
'content': {
'text': 'string'
},
'memoryStrategyId': 'string',
'namespaces': [
'string',
],
'createdAt': datetime(2015, 1, 1),
'score': 123.0,
'metadata': {
'string': {
'stringValue': 'string'
}
}
},
],
'nextToken': 'string'
}
Response Structure
(dict) --
memoryRecordSummaries (list) --
The list of memory record summaries that match the search criteria, ordered by relevance.
(dict) --
Contains summary information about a memory record.
memoryRecordId (string) --
The unique identifier of the memory record.
content (dict) --
The content of the memory record.
text (string) --
The text content of the memory record.
memoryStrategyId (string) --
The identifier of the memory strategy associated with this record.
namespaces (list) --
The namespaces associated with this memory record.
(string) --
createdAt (datetime) --
The timestamp when the memory record was created.
score (float) --
The relevance score of the memory record when returned as part of a search result. Higher values indicate greater relevance to the search query.
metadata (dict) --
A map of metadata key-value pairs associated with a memory record.
(string) --
(dict) --
Value associated with the eventMetadata key.
stringValue (string) --
Value associated with the eventMetadata key.
nextToken (string) --
The token to use in a subsequent request to get the next set of results. This value is null when there are no more results to return.