Skip to content

list_recommendations async

list_recommendations(
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional[NextToken] = None,
    status_filter: Optional[RecommendationStatus] = None,
) -> ListRecommendationsResponse

Lists all recommendations in the account, with optional filtering by status.

Parameters:

  • max_results (Optional[int], default: None ) –

    The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.

  • next_token (Optional[NextToken], default: None ) –

    If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.

  • status_filter (Optional[RecommendationStatus], default: None ) –

    Optional filter to return only recommendations with the specified status.

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.

  • InternalServerException –

    The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.

  • ThrottlingException –

    The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.

  • 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/async_bedrock_agent_core.py
async def list_recommendations(
    self,
    *,
    config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
    max_results: Optional[int] = None,
    next_token: Optional[
        "capo_bedrock_agentcore.types.next_token.NextToken"
    ] = None,
    status_filter: Optional[
        "capo_bedrock_agentcore.types.recommendation_status.RecommendationStatus"
    ] = None,
) -> "capo_bedrock_agentcore.types.list_recommendations_response.ListRecommendationsResponse":
    """<p>Lists all recommendations in the account, with optional filtering by status.</p>

    Args:
        max_results: <p>The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the <code>nextToken</code> field when making another request to return the next batch of results.</p>
        next_token: <p>If the total number of results is greater than the <code>maxResults</code> value provided in the request, enter the token returned in the <code>nextToken</code> field in the response in this field to return the next batch of results.</p>
        status_filter: <p>Optional filter to return only recommendations with the specified status.</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.internal_server_exception.InternalServerException: <p>The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.</p>
        capo_bedrock_agentcore.errors.throttling_exception.ThrottlingException: <p>The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.</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.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agentcore.types.list_recommendations_request.ListRecommendationsRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agentcore.types.list_recommendations_response.ListRecommendationsResponse"
    ]:
        import capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.list_recommendations

        (
            output,
            http_response,
        ) = await capo_bedrock_agentcore._operations.amazon_bedrock_agent_core.list_recommendations.async_list_recommendations(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("ListRecommendations")
    )
    input_: capo_bedrock_agentcore.types.list_recommendations_request.ListRecommendationsRequest = {}
    if max_results is not None:
        input_["max_results"] = max_results
    if next_token is not None:
        input_["next_token"] = next_token
    if status_filter is not None:
        input_["status_filter"] = status_filter

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output