Skip to content

create_agent async

create_agent(
    aws_account_id: AwsAccountId,
    agent_id: AgentId,
    name: AgentName,
    *,
    config_overrides: Optional[AsyncQuickSightClientConfig] = None,
    spaces: Optional[CreateAgentRequestSpacesList] = None,
    action_connectors: Optional[CreateAgentRequestActionConnectorsList] = None,
    description: Optional[AgentDescription] = None,
    icon_id: Optional[IconId] = None,
    starter_prompts: Optional[StarterPromptList] = None,
    welcome_message: Optional[WelcomeMessage] = None,
    agent_lifecycle: Optional[AgentLifecycle] = None,
    custom_prompt_input: Optional[CustomPromptInput] = None,
) -> CreateAgentResponse

Creates an agent in Amazon QuickSight.

Parameters:

  • spaces (Optional[CreateAgentRequestSpacesList], default: None ) –

    The Amazon Resource Names (ARNs) of the spaces to attach to the agent.

  • action_connectors (Optional[CreateAgentRequestActionConnectorsList], default: None ) –

    The Amazon Resource Names (ARNs) of the action connectors to attach to the agent.

  • aws_account_id (AwsAccountId) –

    The ID of the Amazon Web Services account that contains the agent.

  • agent_id (AgentId) –

    A unique identifier for the agent.

  • name (AgentName) –

    The name of the agent.

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

    A description of the agent.

  • icon_id (Optional[IconId], default: None ) –

    The icon identifier for the agent.

  • starter_prompts (Optional[StarterPromptList], default: None ) –

    A list of starter prompts that are displayed to users when they begin interacting with the agent.

  • welcome_message (Optional[WelcomeMessage], default: None ) –

    The welcome message that is displayed when a user starts a conversation with the agent.

  • agent_lifecycle (Optional[AgentLifecycle], default: None ) –

    The lifecycle state of the agent. Valid values are PREVIEW and PUBLISHED.

  • custom_prompt_input (Optional[CustomPromptInput], default: None ) –

    The custom prompt configuration for the agent.

Raises:

Source code in docs_src/capo_quicksight/_services/async_quick_sight.py
async def create_agent(
    self,
    aws_account_id: "capo_quicksight.types.aws_account_id.AwsAccountId",
    agent_id: "capo_quicksight.types.agent_id.AgentId",
    name: "capo_quicksight.types.agent_name.AgentName",
    *,
    config_overrides: Optional[AsyncQuickSightClientConfig] = None,
    spaces: Optional[
        "capo_quicksight.types.create_agent_request_spaces_list.CreateAgentRequestSpacesList"
    ] = None,
    action_connectors: Optional[
        "capo_quicksight.types.create_agent_request_action_connectors_list.CreateAgentRequestActionConnectorsList"
    ] = None,
    description: Optional[
        "capo_quicksight.types.agent_description.AgentDescription"
    ] = None,
    icon_id: Optional["capo_quicksight.types.icon_id.IconId"] = None,
    starter_prompts: Optional[
        "capo_quicksight.types.starter_prompt_list.StarterPromptList"
    ] = None,
    welcome_message: Optional[
        "capo_quicksight.types.welcome_message.WelcomeMessage"
    ] = None,
    agent_lifecycle: Optional[
        "capo_quicksight.types.agent_lifecycle.AgentLifecycle"
    ] = None,
    custom_prompt_input: Optional[
        "capo_quicksight.types.custom_prompt_input.CustomPromptInput"
    ] = None,
) -> "capo_quicksight.types.create_agent_response.CreateAgentResponse":
    """<p>Creates an agent in Amazon QuickSight.</p>

    Args:
        spaces: <p>The Amazon Resource Names (ARNs) of the spaces to attach to the agent.</p>
        action_connectors: <p>The Amazon Resource Names (ARNs) of the action connectors to attach to the agent.</p>
        aws_account_id: <p>The ID of the Amazon Web Services account that contains the agent.</p>
        agent_id: <p>A unique identifier for the agent.</p>
        name: <p>The name of the agent.</p>
        description: <p>A description of the agent.</p>
        icon_id: <p>The icon identifier for the agent.</p>
        starter_prompts: <p>A list of starter prompts that are displayed to users when they begin interacting with the agent.</p>
        welcome_message: <p>The welcome message that is displayed when a user starts a conversation with the agent.</p>
        agent_lifecycle: <p>The lifecycle state of the agent. Valid values are <code>PREVIEW</code> and <code>PUBLISHED</code>.</p>
        custom_prompt_input: <p>The custom prompt configuration for the agent.</p>

    Raises:
        capo_quicksight.errors.access_denied_exception.AccessDeniedException: <p>You don't have access to this item. The provided credentials couldn't be validated. You might not be authorized to carry out the request. Make sure that your account is authorized to use the Amazon Quick Sight service, that your policies have the correct permissions, and that you are using the correct credentials.</p>
        capo_quicksight.errors.conflict_exception.ConflictException: <p>Updating or deleting a resource can cause an inconsistent state.</p>
        capo_quicksight.errors.internal_failure_exception.InternalFailureException: <p>An internal failure occurred.</p>
        capo_quicksight.errors.invalid_parameter_value_exception.InvalidParameterValueException: <p>One or more parameters has a value that isn't valid.</p>
        capo_quicksight.errors.limit_exceeded_exception.LimitExceededException: <p>A limit is exceeded.</p>
        capo_quicksight.errors.precondition_not_met_exception.PreconditionNotMetException: <p>One or more preconditions aren't met.</p>
        capo_quicksight.errors.resource_exists_exception.ResourceExistsException: <p>The resource specified already exists. </p>
        capo_quicksight.errors.throttling_exception.ThrottlingException: <p>Access is throttled.</p>
        capo_quicksight.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_quicksight.types.create_agent_request.CreateAgentRequest]",
    ) -> AsyncOperationResponse[
        "capo_quicksight.types.create_agent_response.CreateAgentResponse"
    ]:
        import capo_quicksight._operations.quick_sight_20180401.create_agent

        (
            output,
            http_response,
        ) = await capo_quicksight._operations.quick_sight_20180401.create_agent.async_create_agent(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_quicksight.types.create_agent_request.CreateAgentRequest",
    ) -> dict[str, Any]:
        import capo_quicksight.types.create_agent_request

        return capo_quicksight.types.create_agent_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateAgent", redact_input=_redact_input),
    )
    input_: capo_quicksight.types.create_agent_request.CreateAgentRequest = {
        "aws_account_id": aws_account_id,
        "agent_id": agent_id,
        "name": name,
    }
    if spaces is not None:
        input_["spaces"] = spaces
    if action_connectors is not None:
        input_["action_connectors"] = action_connectors
    if description is not None:
        input_["description"] = description
    if icon_id is not None:
        input_["icon_id"] = icon_id
    if starter_prompts is not None:
        input_["starter_prompts"] = starter_prompts
    if welcome_message is not None:
        input_["welcome_message"] = welcome_message
    if agent_lifecycle is not None:
        input_["agent_lifecycle"] = agent_lifecycle
    if custom_prompt_input is not None:
        input_["custom_prompt_input"] = custom_prompt_input

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