Skip to content

create_agent_alias async

create_agent_alias(
    agent_id: Id,
    agent_alias_name: Name,
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[Description] = None,
    routing_configuration: Optional[AgentAliasRoutingConfiguration] = None,
    tags: Optional[TagsMap] = None,
) -> CreateAgentAliasResponse

Creates an alias of an agent that can be used to deploy the agent.

Parameters:

  • agent_id (Id) –

    The unique identifier of the agent.

  • agent_alias_name (Name) –

    The name of the alias.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see Ensuring idempotency.

  • description (Optional[Description], default: None ) –

    A description of the alias of the agent.

  • routing_configuration (Optional[AgentAliasRoutingConfiguration], default: None ) –

    Contains details about the routing configuration of the alias.

  • tags (Optional[TagsMap], default: None ) –

    Any tags that you want to attach to the alias of the agent.

Raises:

Source code in docs_src/capo_bedrock_agent/_services/async_bedrock_agent.py
async def create_agent_alias(
    self,
    agent_id: "capo_bedrock_agent.types.id.Id",
    agent_alias_name: "capo_bedrock_agent.types.name.Name",
    *,
    config_overrides: Optional[AsyncBedrockAgentClientConfig] = None,
    client_token: Optional[
        "capo_bedrock_agent.types.client_token.ClientToken"
    ] = None,
    description: Optional[
        "capo_bedrock_agent.types.description.Description"
    ] = None,
    routing_configuration: Optional[
        "capo_bedrock_agent.types.agent_alias_routing_configuration.AgentAliasRoutingConfiguration"
    ] = None,
    tags: Optional["capo_bedrock_agent.types.tags_map.TagsMap"] = None,
) -> (
    "capo_bedrock_agent.types.create_agent_alias_response.CreateAgentAliasResponse"
):
    """<p>Creates an alias of an agent that can be used to deploy the agent.</p>

    Args:
        agent_id: <p>The unique identifier of the agent.</p>
        agent_alias_name: <p>The name of the alias.</p>
        client_token: <p>A unique, case-sensitive identifier to ensure that the API request completes no more than one time. If this token matches a previous request, Amazon Bedrock ignores the request, but does not return an error. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring idempotency</a>.</p>
        description: <p>A description of the alias of the agent.</p>
        routing_configuration: <p>Contains details about the routing configuration of the alias.</p>
        tags: <p>Any tags that you want to attach to the alias of the agent.</p>

    Raises:
        capo_bedrock_agent.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions.</p>
        capo_bedrock_agent.errors.conflict_exception.ConflictException: <p>There was a conflict performing an operation.</p>
        capo_bedrock_agent.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock_agent.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.</p>
        capo_bedrock_agent.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock_agent.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock_agent.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock_agent.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agent.types.create_agent_alias_request.CreateAgentAliasRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agent.types.create_agent_alias_response.CreateAgentAliasResponse"
    ]:
        import capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_agent_alias

        (
            output,
            http_response,
        ) = await capo_bedrock_agent._operations.amazon_bedrock_agent_build_time_lambda.create_agent_alias.async_create_agent_alias(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAgentAlias")
    )
    input_: capo_bedrock_agent.types.create_agent_alias_request.CreateAgentAliasRequest = {
        "agent_id": agent_id,
        "agent_alias_name": agent_alias_name,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description
    if routing_configuration is not None:
        input_["routing_configuration"] = routing_configuration
    if tags is not None:
        input_["tags"] = tags

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