BedrockAgentCore / Client / batch_update_memory_records

batch_update_memory_records

BedrockAgentCore.Client.batch_update_memory_records(**kwargs)

Updates multiple memory records with custom content in a single batch operation within the specified memory.

See also: AWS API Documentation

Request Syntax

response = 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'
    }
)
Parameters:
  • memoryId (string) –

    [REQUIRED]

    The unique ID of the memory resource where records will be updated.

  • records (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.

        Note

        This is a Tagged Union structure. Only one of the following top level keys can be set: text.

        • 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.

            Note

            This is a Tagged Union structure. Only one of the following top level keys can be set: stringValue, stringListValue, numberValue, dateTimeValue.

            • 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.

  • recordExpirySpecification (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.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: recordExpiryDurationDays, action.

    • 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.

Return type:

dict

Returns:

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.

Exceptions