2026/10/12 - Amazon Bedrock AgentCore - 5 updated api methods
Changes AgentCore Memory now supports Long-Term Memory Time-to-Live on Batch APIs.
{'recordExpirySpecification': {'action': 'REMOVE',
'recordExpiryDurationDays': 'integer'}}
Creates multiple memory records in a single batch operation for the specified memory with custom content.
See also: AWS API Documentation
Request Syntax
client.batch_create_memory_records(
memoryId='string',
records=[
{
'requestIdentifier': 'string',
'namespaces': [
'string',
],
'content': {
'text': 'string'
},
'timestamp': datetime(2015, 1, 1),
'memoryStrategyId': 'string',
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
],
clientToken='string',
recordExpirySpecification={
'recordExpiryDurationDays': 123,
'action': 'REMOVE'
}
)
string
[REQUIRED]
The unique ID of the memory resource where records will be created.
list
[REQUIRED]
A list of memory record creation inputs to be processed in the batch operation.
(dict) --
Input structure to create a new memory record.
requestIdentifier (string) -- [REQUIRED]
A client-provided identifier for tracking this specific record creation request.
namespaces (list) -- [REQUIRED]
A list of namespace identifiers that categorize or group the memory record.
(string) --
content (dict) -- [REQUIRED]
The content to be stored within the memory record.
text (string) --
The text content of the memory record.
timestamp (datetime) -- [REQUIRED]
Time at which the memory record was created.
memoryStrategyId (string) --
The ID of the memory strategy that defines how this memory record is grouped.
metadata (dict) --
Metadata key-value pairs to be stored with the memory record.
(string) --
(dict) --
The value of a memory record metadata entry.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
string
A unique, case-sensitive identifier to ensure idempotent processing of the batch request.
This field is autopopulated if not provided.
dict
The record expiry (long-term memory time-to-live) applied to every record created by this request. Set recordExpiryDurationDays to the number of days after which the records expire. Only the expiry provided here is applied; the records' strategy association has no effect on their expiry. If you do not provide this value, the records do not expire. The REMOVE action does not apply when creating records.
recordExpiryDurationDays (integer) --
The duration, in days, after which the records in this request expire. The minimum is 31 days.
action (string) --
The action to apply to the existing record expiry configuration. Set to REMOVE to remove a previously configured expiry so that the records no longer expire. This value does not apply when creating records.
dict
Response Syntax
{
'successfulRecords': [
{
'memoryRecordId': 'string',
'status': 'SUCCEEDED'|'FAILED',
'requestIdentifier': 'string',
'errorCode': 123,
'errorMessage': 'string'
},
],
'failedRecords': [
{
'memoryRecordId': 'string',
'status': 'SUCCEEDED'|'FAILED',
'requestIdentifier': 'string',
'errorCode': 123,
'errorMessage': 'string'
},
]
}
Response Structure
(dict) --
successfulRecords (list) --
A list of memory records that were successfully created during the batch operation.
(dict) --
Output information returned after processing a memory record operation.
memoryRecordId (string) --
The unique ID associated to the memory record.
status (string) --
The status of the memory record operation (e.g., SUCCEEDED, FAILED).
requestIdentifier (string) --
The client-provided identifier that was used to track this record operation.
errorCode (integer) --
The error code returned when the memory record operation fails.
errorMessage (string) --
A human-readable error message describing why the memory record operation failed.
failedRecords (list) --
A list of memory records that failed to be created, including error details for each failure.
(dict) --
Output information returned after processing a memory record operation.
memoryRecordId (string) --
The unique ID associated to the memory record.
status (string) --
The status of the memory record operation (e.g., SUCCEEDED, FAILED).
requestIdentifier (string) --
The client-provided identifier that was used to track this record operation.
errorCode (integer) --
The error code returned when the memory record operation fails.
errorMessage (string) --
A human-readable error message describing why the memory record operation failed.
{'recordExpirySpecification': {'action': 'REMOVE',
'recordExpiryDurationDays': 'integer'}}
Updates multiple memory records with custom content in a single batch operation within the specified memory.
See also: AWS API Documentation
Request Syntax
client.batch_update_memory_records(
memoryId='string',
records=[
{
'memoryRecordId': 'string',
'timestamp': datetime(2015, 1, 1),
'content': {
'text': 'string'
},
'namespaces': [
'string',
],
'sourceNamespaces': [
'string',
],
'memoryStrategyId': 'string',
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
],
recordExpirySpecification={
'recordExpiryDurationDays': 123,
'action': 'REMOVE'
}
)
string
[REQUIRED]
The unique ID of the memory resource where records will be updated.
list
[REQUIRED]
A list of memory record update inputs to be processed in the batch operation.
(dict) --
Input structure to update an existing memory record.
memoryRecordId (string) -- [REQUIRED]
The unique ID of the memory record to be updated.
timestamp (datetime) -- [REQUIRED]
Time at which the memory record was updated
content (dict) --
The content to be stored within the memory record.
text (string) --
The text content of the memory record.
namespaces (list) --
The updated list of namespace identifiers for categorizing the memory record.
(string) --
sourceNamespaces (list) --
The namespaces of the source memory record being updated. This value is used for IAM condition key authorization.
(string) --
memoryStrategyId (string) --
The updated ID of the memory strategy that defines how this memory record is grouped.
metadata (dict) --
Metadata key-value pairs to be stored with the memory record.
(string) --
(dict) --
The value of a memory record metadata entry.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
dict
The record expiry (long-term memory time-to-live) applied to every record updated by this request. Set recordExpiryDurationDays to configure or overwrite the number of days after which the records expire, or set action to REMOVE to clear a previously configured expiry so that the records no longer expire.
When you do not provide this value, the service determines each record's expiry from its current state:
If the record already has an expiry configured, the service resets and reapplies the expiry based on the last applied recordExpiryDurationDays.
If the record does not have an expiry configured, no expiry is applied and the record remains non-expiring. This is the outcome regardless of whether the record's strategy configures an expiry.
Providing an explicit recordExpiryDurationDays always takes precedence: it overwrites an existing expiry, or sets one on a record that previously had none.
recordExpiryDurationDays (integer) --
The duration, in days, after which the records in this request expire. The minimum is 31 days.
action (string) --
The action to apply to the existing record expiry configuration. Set to REMOVE to remove a previously configured expiry so that the records no longer expire. This value does not apply when creating records.
dict
Response Syntax
{
'successfulRecords': [
{
'memoryRecordId': 'string',
'status': 'SUCCEEDED'|'FAILED',
'requestIdentifier': 'string',
'errorCode': 123,
'errorMessage': 'string'
},
],
'failedRecords': [
{
'memoryRecordId': 'string',
'status': 'SUCCEEDED'|'FAILED',
'requestIdentifier': 'string',
'errorCode': 123,
'errorMessage': 'string'
},
]
}
Response Structure
(dict) --
successfulRecords (list) --
A list of memory records that were successfully updated during the batch operation.
(dict) --
Output information returned after processing a memory record operation.
memoryRecordId (string) --
The unique ID associated to the memory record.
status (string) --
The status of the memory record operation (e.g., SUCCEEDED, FAILED).
requestIdentifier (string) --
The client-provided identifier that was used to track this record operation.
errorCode (integer) --
The error code returned when the memory record operation fails.
errorMessage (string) --
A human-readable error message describing why the memory record operation failed.
failedRecords (list) --
A list of memory records that failed to be updated, including error details for each failure.
(dict) --
Output information returned after processing a memory record operation.
memoryRecordId (string) --
The unique ID associated to the memory record.
status (string) --
The status of the memory record operation (e.g., SUCCEEDED, FAILED).
requestIdentifier (string) --
The client-provided identifier that was used to track this record operation.
errorCode (integer) --
The error code returned when the memory record operation fails.
errorMessage (string) --
A human-readable error message describing why the memory record operation failed.
{'memoryRecord': {'expiresAt': 'timestamp', 'timestamp': 'timestamp'}}
Retrieves a specific memory record from an AgentCore Memory resource.
To use this operation, you must have the bedrock-agentcore:GetMemoryRecord permission.
See also: AWS API Documentation
Request Syntax
client.get_memory_record(
memoryId='string',
memoryRecordId='string',
namespace='string'
)
string
[REQUIRED]
The identifier of the AgentCore Memory resource containing the memory record.
string
[REQUIRED]
The identifier of the memory record to retrieve.
string
The namespace of the memory record to retrieve. This value is used for IAM condition key authorization.
dict
Response Syntax
{
'memoryRecord': {
'memoryRecordId': 'string',
'content': {
'text': 'string'
},
'memoryStrategyId': 'string',
'namespaces': [
'string',
],
'createdAt': datetime(2015, 1, 1),
'timestamp': datetime(2015, 1, 1),
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
},
'expiresAt': datetime(2015, 1, 1)
}
}
Response Structure
(dict) --
memoryRecord (dict) --
The requested 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. Namespaces help organize and categorize memory records.
(string) --
createdAt (datetime) --
The timestamp when the memory record was created.
timestamp (datetime) --
The timestamp based on which the memory record was ingested. This reflects the time of the source content that the record was derived from, which can differ from createdAt, the time the record itself was written.
metadata (dict) --
A map of metadata key-value pairs associated with a memory record.
(string) --
(dict) --
The value of a memory record metadata entry.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
expiresAt (datetime) --
The timestamp at which the memory record expires and becomes eligible for deletion. This value is set when a record expiry (long-term memory time-to-live) applies to the record, either from the strategy the record belongs to or from a record expiry provided on the batch request that created or updated it. If the record has no expiry configured, this value is not present and the record does not expire.
{'memoryRecordSummaries': {'timestamp': 'timestamp'}}
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',
metadataFilters=[
{
'left': {
'metadataKey': 'string'
},
'operator': 'EQUALS_TO'|'EXISTS'|'NOT_EXISTS'|'BEFORE'|'AFTER'|'CONTAINS'|'GREATER_THAN'|'GREATER_THAN_OR_EQUALS'|'LESS_THAN'|'LESS_THAN_OR_EQUALS',
'right': {
'metadataValue': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
]
)
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. Either namespace or namespacePath is required.
string
Use namespacePath for hierarchical retrievals. Return all memory records where namespace falls under the same parent hierarchy. Either namespace or namespacePath is required.
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.
list
A list of metadata filter expressions to scope the returned memory records.
(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]
The metadata key to evaluate.
metadataKey (string) --
The metadata key to filter on.
operator (string) -- [REQUIRED]
The relationship between the metadata key and value to match when applying the metadata filter.
right (dict) --
The value to compare against. Required for all operators except EXISTS and NOT_EXISTS.
metadataValue (dict) --
The metadata value to compare against.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
dict
Response Syntax
{
'memoryRecordSummaries': [
{
'memoryRecordId': 'string',
'content': {
'text': 'string'
},
'memoryStrategyId': 'string',
'namespaces': [
'string',
],
'createdAt': datetime(2015, 1, 1),
'score': 123.0,
'timestamp': datetime(2015, 1, 1),
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
],
'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.
timestamp (datetime) --
The timestamp based on which the memory record was ingested. This reflects the time of the source content that the record was derived from, which can differ from createdAt, the time the record itself was written.
metadata (dict) --
A map of metadata key-value pairs associated with a memory record.
(string) --
(dict) --
The value of a memory record metadata entry.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
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.
{'memoryRecordSummaries': {'timestamp': 'timestamp'}}
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'|'BEFORE'|'AFTER'|'CONTAINS'|'GREATER_THAN'|'GREATER_THAN_OR_EQUALS'|'LESS_THAN'|'LESS_THAN_OR_EQUALS',
'right': {
'metadataValue': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
]
},
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. Either namespace or namespacePath is required.
string
Use namespacePath for hierarchical retrievals. Return all memory records where namespace falls under the same parent hierarchy. Either namespace or namespacePath is required.
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]
The metadata key to evaluate.
metadataKey (string) --
The metadata key to filter on.
operator (string) -- [REQUIRED]
The relationship between the metadata key and value to match when applying the metadata filter.
right (dict) --
The value to compare against. Required for all operators except EXISTS and NOT_EXISTS.
metadataValue (dict) --
The metadata value to compare against.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
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,
'timestamp': datetime(2015, 1, 1),
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
],
'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.
timestamp (datetime) --
The timestamp based on which the memory record was ingested. This reflects the time of the source content that the record was derived from, which can differ from createdAt, the time the record itself was written.
metadata (dict) --
A map of metadata key-value pairs associated with a memory record.
(string) --
(dict) --
The value of a memory record metadata entry.
stringValue (string) --
A string value.
stringListValue (list) --
A list of string values.
(string) --
numberValue (float) --
A numeric value.
dateTimeValue (datetime) --
A timestamp value in ISO 8601 UTC format.
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.