Skip to content

start_agent_recommendation_generation

start_agent_recommendation_generation(
    profile_arn: AgentProfileArn,
    types: RecommendationTypes,
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    name: Optional[str] = None,
    additional_context: Optional[SensitiveDocument] = None,
    scope: Optional[Scope] = None,
) -> StartAgentRecommendationGenerationResponse

Starts a recommendation generation process for the specified agent profile. This asynchronous operation returns immediately. Use GetAgentRecommendationGeneration to check the status of the generation.

Currently, only the ARCHITECTURE recommendation type is supported. RESOURCE and APPLICATION recommendations are generated only by the scheduled generation cycle and cannot be started with this operation.

For the ARCHITECTURE type, the generation analyzes the infrastructure as code (IaC) template that you specify in additionalContext, and returns updated templates with best practice fixes applied. You must specify scope and additionalContext. You can optionally specify name.

Architecture review generations are subject to a daily quota for each profile. For more information, see Quotas and limits in the Amazon Web Services Well-Architected User Guide.

Parameters:

  • profile_arn (AgentProfileArn) –

    The Amazon Resource Name (ARN) of the optimization profile to use for generating recommendations.

  • types (RecommendationTypes) –

    The types of recommendations to generate. You can specify up to two types in a single request. Currently, only ARCHITECTURE is supported for this operation.

  • name (Optional[str], default: None ) –

    An optional name for this generation that identifies the architecture review in the console and in ListAgentRecommendationGenerations results. Applies to ARCHITECTURE type only. Must be absent for other types.

  • additional_context (Optional[SensitiveDocument], default: None ) –

    The location of the infrastructure as code (IaC) template to review, and the lenses to review it against. Required for the ARCHITECTURE type. Must be absent for other types. Specify a JSON object with the following members:

    • s3Uri: The Amazon S3 URI of the IaC template, .zip archive, or folder to review.

    • s3VersionId: The version ID of the Amazon S3 object. If you omit this member, the current version is used.

    • lensArns: The ARNs of the lenses to review against. Only arn:aws:wellarchitected::aws:lens/wellarchitected is supported.

  • scope (Optional[Scope], default: None ) –

    Defines which pillars, goals, and items the review covers. Required for the ARCHITECTURE type. Must be absent for other types.

Raises:

Source code in docs_src/capo_wellarchitected/_services/well_architected.py
def start_agent_recommendation_generation(
    self,
    profile_arn: "capo_wellarchitected.types.agent_profile_arn.AgentProfileArn",
    types: "capo_wellarchitected.types.recommendation_types.RecommendationTypes",
    *,
    config_overrides: Optional[WellArchitectedClientConfig] = None,
    name: Optional[str] = None,
    additional_context: Optional[
        "capo_wellarchitected.types.sensitive_document.SensitiveDocument"
    ] = None,
    scope: Optional["capo_wellarchitected.types.scope.Scope"] = None,
) -> "capo_wellarchitected.types.start_agent_recommendation_generation_response.StartAgentRecommendationGenerationResponse":
    """<p>Starts a recommendation generation process for the specified agent profile. This asynchronous operation returns immediately. Use <code>GetAgentRecommendationGeneration</code> to check the status of the generation.</p> <p>Currently, only the <code>ARCHITECTURE</code> recommendation type is supported. <code>RESOURCE</code> and <code>APPLICATION</code> recommendations are generated only by the scheduled generation cycle and cannot be started with this operation.</p> <p>For the <code>ARCHITECTURE</code> type, the generation analyzes the infrastructure as code (IaC) template that you specify in <code>additionalContext</code>, and returns updated templates with best practice fixes applied. You must specify <code>scope</code> and <code>additionalContext</code>. You can optionally specify <code>name</code>.</p> <p>Architecture review generations are subject to a daily quota for each profile. For more information, see <a href="https://docs.aws.amazon.com/wellarchitected/latest/userguide/agent-quotas.html">Quotas and limits</a> in the Amazon Web Services Well-Architected User Guide.</p>

    Args:
        profile_arn: <p>The Amazon Resource Name (ARN) of the optimization profile to use for generating recommendations.</p>
        types: <p>The types of recommendations to generate. You can specify up to two types in a single request. Currently, only <code>ARCHITECTURE</code> is supported for this operation.</p>
        name: <p>An optional name for this generation that identifies the architecture review in the console and in <code>ListAgentRecommendationGenerations</code> results. Applies to <code>ARCHITECTURE</code> type only. Must be absent for other types.</p>
        additional_context: <p>The location of the infrastructure as code (IaC) template to review, and the lenses to review it against. Required for the <code>ARCHITECTURE</code> type. Must be absent for other types. Specify a JSON object with the following members:</p> <ul> <li> <p> <code>s3Uri</code>: The Amazon S3 URI of the IaC template, .zip archive, or folder to review.</p> </li> <li> <p> <code>s3VersionId</code>: The version ID of the Amazon S3 object. If you omit this member, the current version is used.</p> </li> <li> <p> <code>lensArns</code>: The ARNs of the lenses to review against. Only <code>arn:aws:wellarchitected::aws:lens/wellarchitected</code> is supported.</p> </li> </ul>
        scope: <p>Defines which pillars, goals, and items the review covers. Required for the <code>ARCHITECTURE</code> type. Must be absent for other types.</p>

    Raises:
        capo_wellarchitected.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_wellarchitected.errors.conflict_exception.ConflictException: <p>The resource has already been processed, was deleted, or is too large.</p>
        capo_wellarchitected.errors.internal_server_exception.InternalServerException: <p>There is a problem with the Well-Architected Tool API service.</p>
        capo_wellarchitected.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The user has reached their resource quota.</p>
        capo_wellarchitected.errors.throttling_exception.ThrottlingException: <p>Request was denied due to request throttling.</p>
        capo_wellarchitected.errors.validation_exception.ValidationException: <p>The user input is not valid.</p>
        capo_wellarchitected.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_wellarchitected.types.start_agent_recommendation_generation_request.StartAgentRecommendationGenerationRequest]",
    ) -> OperationResponse[
        "capo_wellarchitected.types.start_agent_recommendation_generation_response.StartAgentRecommendationGenerationResponse"
    ]:
        import capo_wellarchitected._operations.well_architected_api_service_lambda.start_agent_recommendation_generation

        output, http_response = (
            capo_wellarchitected._operations.well_architected_api_service_lambda.start_agent_recommendation_generation.start_agent_recommendation_generation(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_wellarchitected.types.start_agent_recommendation_generation_request.StartAgentRecommendationGenerationRequest",
    ) -> dict[str, Any]:
        import capo_wellarchitected.types.start_agent_recommendation_generation_request

        return capo_wellarchitected.types.start_agent_recommendation_generation_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "StartAgentRecommendationGeneration", redact_input=_redact_input
        ),
    )
    input_: capo_wellarchitected.types.start_agent_recommendation_generation_request.StartAgentRecommendationGenerationRequest = {
        "profile_arn": profile_arn,
        "types": types,
    }
    if name is not None:
        input_["name"] = name
    if additional_context is not None:
        input_["additional_context"] = additional_context
    if scope is not None:
        input_["scope"] = scope

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