2026/04/30 - Amazon Bedrock AgentCore - 6 updated api methods
Changes AgentCore Identity now supports on-behalf-of token exchange OAuth2. AgentCore Memory now supports metadata for LongTerm Memory Records.
{'records': {'metadata': {'string': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['string'],
'stringValue': 'string'}}}}
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'
)
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
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.
{'records': {'metadata': {'string': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['string'],
'stringValue': 'string'}}}}
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',
],
'memoryStrategyId': 'string',
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': datetime(2015, 1, 1)
}
}
},
]
)
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) --
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
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': {'metadata': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['string']}}}
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'
)
string
[REQUIRED]
The identifier of the AgentCore Memory resource containing the memory record.
string
[REQUIRED]
The identifier of the memory record to retrieve.
dict
Response Syntax
{
'memoryRecord': {
'memoryRecordId': 'string',
'content': {
'text': 'string'
},
'memoryStrategyId': 'string',
'namespaces': [
'string',
],
'createdAt': datetime(2015, 1, 1),
'metadata': {
'string': {
'stringValue': 'string',
'stringListValue': [
'string',
],
'numberValue': 123.0,
'dateTimeValue': 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.
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.
{'audiences': ['string'],
'oauth2Flow': {'ON_BEHALF_OF_TOKEN_EXCHANGE'},
'resources': ['string']}
Returns the OAuth 2.0 token of the provided resource.
See also: AWS API Documentation
Request Syntax
client.get_resource_oauth2_token(
workloadIdentityToken='string',
resourceCredentialProviderName='string',
scopes=[
'string',
],
oauth2Flow='USER_FEDERATION'|'M2M'|'ON_BEHALF_OF_TOKEN_EXCHANGE',
sessionUri='string',
resourceOauth2ReturnUrl='string',
forceAuthentication=True|False,
customParameters={
'string': 'string'
},
customState='string',
resources=[
'string',
],
audiences=[
'string',
]
)
string
[REQUIRED]
The identity token of the workload from which you want to retrieve the OAuth2 token.
string
[REQUIRED]
The name of the resource's credential provider.
list
[REQUIRED]
The OAuth scopes being requested.
(string) --
string
[REQUIRED]
The type of flow to be performed.
string
Unique identifier for the user's authentication session for retrieving OAuth2 tokens. This ID tracks the authorization flow state across multiple requests and responses during the OAuth2 authentication process.
string
The callback URL to redirect to after the OAuth 2.0 token retrieval is complete. This URL must be one of the provided URLs configured for the workload identity.
boolean
Indicates whether to always initiate a new three-legged OAuth (3LO) flow, regardless of any existing session.
dict
A map of custom parameters to include in the authorization request to the resource credential provider. These parameters are in addition to the standard OAuth 2.0 flow parameters, and will not override them.
(string) --
(string) --
string
An opaque string that will be sent back to the callback URL provided in resourceOauth2ReturnUrl. This state should be used to protect the callback URL of your application against CSRF attacks by ensuring the response corresponds to the original request.
list
The resources to include in the token request. These are used to specify the target resources for which the OAuth2 token is being requested.
(string) --
list
The audiences to include in the token request. These are used to specify the intended recipients of the OAuth2 token.
(string) --
dict
Response Syntax
{
'authorizationUrl': 'string',
'accessToken': 'string',
'sessionUri': 'string',
'sessionStatus': 'IN_PROGRESS'|'FAILED'
}
Response Structure
(dict) --
authorizationUrl (string) --
The URL to initiate the authorization process, provided when the access token requires user authorization.
accessToken (string) --
The OAuth 2.0 access token to use.
sessionUri (string) --
Unique identifier for the user's authorization session for retrieving OAuth2 tokens. This matches the sessionId from the request and can be used to track the session state.
sessionStatus (string) --
Status indicating whether the user's authorization session is in progress or has failed. This helps determine the next steps in the OAuth2 authentication flow.
{'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': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['string'],
'stringValue': 'string'}}}]}
Response {'memoryRecordSummaries': {'metadata': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['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',
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.
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.
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,
'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.
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.
{'searchCriteria': {'metadataFilters': {'operator': {'AFTER',
'BEFORE',
'CONTAINS',
'GREATER_THAN',
'GREATER_THAN_OR_EQUALS',
'LESS_THAN',
'LESS_THAN_OR_EQUALS'},
'right': {'metadataValue': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['string']}}}}}
Response {'memoryRecordSummaries': {'metadata': {'dateTimeValue': 'timestamp',
'numberValue': 'double',
'stringListValue': ['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'|'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.
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]
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,
'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.
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.