Skip to content

get_memory_record

get_memory_record(
    memory_id: MemoryId,
    memory_record_id: MemoryRecordId,
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    namespace: Optional[Namespace] = None,
) -> GetMemoryRecordOutput

Retrieves a specific memory record from an AgentCore Memory resource.

To use this operation, you must have the bedrock-agentcore:GetMemoryRecord permission.

Parameters:

  • memory_id (MemoryId) –

    The identifier of the AgentCore Memory resource containing the memory record.

  • memory_record_id (MemoryRecordId) –

    The identifier of the memory record to retrieve.

  • namespace (Optional[Namespace], default: None ) –

    The namespace of the memory record to retrieve. This value is used for IAM condition key authorization.

Raises:

  • AccessDeniedException –

    The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.

  • InvalidInputException –

    The input fails to satisfy the constraints specified by AgentCore. Check your input values and try again.

  • ResourceNotFoundException –

    The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.

  • ServiceException –

    The service encountered an internal error. Try your request again later.

  • ServiceQuotaExceededException –

    The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.

  • ThrottledException –

    The request was denied due to request throttling. Reduce the frequency of requests and try again.

  • ValidationException –

    The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock_agentcore/_services/bedrock_agent_core.py
def get_memory_record(
    self,
    memory_id: "capo_bedrock_agentcore.types.memory_id.MemoryId",
    memory_record_id: "capo_bedrock_agentcore.types.memory_record_id.MemoryRecordId",
    *,
    config_overrides: Optional[BedrockAgentCoreClientConfig] = None,
    namespace: Optional["capo_bedrock_agentcore.types.namespace.Namespace"] = None,
) -> "capo_bedrock_agentcore.types.get_memory_record_output.GetMemoryRecordOutput":
    """<p>Retrieves a specific memory record from an AgentCore Memory resource.</p> <p>To use this operation, you must have the <code>bedrock-agentcore:GetMemoryRecord</code> permission.</p>

    Args:
        memory_id: <p>The identifier of the AgentCore Memory resource containing the memory record.</p>
        memory_record_id: <p>The identifier of the memory record to retrieve.</p>
        namespace: <p>The namespace of the memory record to retrieve. This value is used for IAM condition key authorization.</p>

    Raises:
        capo_bedrock_agentcore.errors.access_denied_exception.AccessDeniedException: <p>The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.</p>
        capo_bedrock_agentcore.errors.invalid_input_exception.InvalidInputException: <p>The input fails to satisfy the constraints specified by AgentCore. Check your input values and try again.</p>
        capo_bedrock_agentcore.errors.resource_not_found_exception.ResourceNotFoundException: <p>The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.</p>
        capo_bedrock_agentcore.errors.service_exception.ServiceException: <p>The service encountered an internal error. Try your request again later.</p>
        capo_bedrock_agentcore.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.</p>
        capo_bedrock_agentcore.errors.throttled_exception.ThrottledException: <p>The request was denied due to request throttling. Reduce the frequency of requests and try again.</p>
        capo_bedrock_agentcore.errors.validation_exception.ValidationException: <p>The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.</p>
        capo_bedrock_agentcore.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_bedrock_agentcore.types.get_memory_record_input.GetMemoryRecordInput]",
    ) -> OperationResponse[
        "capo_bedrock_agentcore.types.get_memory_record_output.GetMemoryRecordOutput"
    ]:
        import capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.get_memory_record

        output, http_response = (
            capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.get_memory_record.get_memory_record(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_bedrock_agentcore.types.get_memory_record_output.GetMemoryRecordOutput",
    ) -> dict[str, Any]:
        import capo_bedrock_agentcore.types.get_memory_record_output

        return (
            capo_bedrock_agentcore.types.get_memory_record_output.redact_sensitive(
                output
            )
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("GetMemoryRecord", redact_output=_redact_output),
    )
    input_: capo_bedrock_agentcore.types.get_memory_record_input.GetMemoryRecordInput = {
        "memory_id": memory_id,
        "memory_record_id": memory_record_id,
    }
    if namespace is not None:
        input_["namespace"] = namespace

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output