Skip to content

start_q_app_session async

start_q_app_session(
    instance_id: InstanceId,
    app_id: UUID,
    app_version: AppVersion,
    *,
    config_overrides: Optional[AsyncQAppsClientConfig] = None,
    initial_values: Optional[CardValueList] = None,
    session_id: Optional[str] = None,
    tags: Optional[TagMap] = None,
) -> StartQAppSessionOutput

Starts a new session for an Amazon Q App, allowing inputs to be provided and the app to be run.

Each Q App session will be condensed into a single conversation in the web experience.

Parameters:

  • instance_id (InstanceId) –

    The unique identifier of the Amazon Q Business application environment instance.

  • app_id (UUID) –

    The unique identifier of the Q App to start a session for.

  • app_version (AppVersion) –

    The version of the Q App to use for the session.

  • initial_values (Optional[CardValueList], default: None ) –

    Optional initial input values to provide for the Q App session.

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

    The unique identifier of the a Q App session.

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

    Optional tags to associate with the new Q App session.

Raises:

Examples:

Start a session for an Amazon Q App using version 1, passing in initial values for one card

>>> await client.start_q_app_session(instance_id='4cc5e4c2-d2a2-4188-a114-9ca125b4aedc', app_id='65e7dce7-226a-47f9-b689-22850becef89', app_version=1, initial_values=[{'cardId': '6fb5b404-3b7b-48a4-8a8b-56406922a606', 'value': 'What is the circumference of Earth?'}])
Source code in docs_src/capo_qapps/_services/async_q_apps.py
async def start_q_app_session(
    self,
    instance_id: "capo_qapps.types.instance_id.InstanceId",
    app_id: "capo_qapps.types.uuid.UUID",
    app_version: "capo_qapps.types.app_version.AppVersion",
    *,
    config_overrides: Optional[AsyncQAppsClientConfig] = None,
    initial_values: Optional[
        "capo_qapps.types.card_value_list.CardValueList"
    ] = None,
    session_id: Optional[str] = None,
    tags: Optional["capo_qapps.types.tag_map.TagMap"] = None,
) -> "capo_qapps.types.start_q_app_session_output.StartQAppSessionOutput":
    """<p>Starts a new session for an Amazon Q App, allowing inputs to be provided and the app to be run.</p> <note> <p>Each Q App session will be condensed into a single conversation in the web experience.</p> </note>

    Args:
        instance_id: <p>The unique identifier of the Amazon Q Business application environment instance.</p>
        app_id: <p>The unique identifier of the Q App to start a session for.</p>
        app_version: <p>The version of the Q App to use for the session.</p>
        initial_values: <p>Optional initial input values to provide for the Q App session.</p>
        session_id: <p>The unique identifier of the a Q App session.</p>
        tags: <p>Optional tags to associate with the new Q App session.</p>

    Raises:
        capo_qapps.errors.access_denied_exception.AccessDeniedException: <p>The client is not authorized to perform the requested operation.</p>
        capo_qapps.errors.internal_server_exception.InternalServerException: <p>An internal service error occurred while processing the request.</p>
        capo_qapps.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource could not be found.</p>
        capo_qapps.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The requested operation could not be completed because it would exceed the service's quota or limit.</p>
        capo_qapps.errors.throttling_exception.ThrottlingException: <p>The requested operation could not be completed because too many requests were sent at once. Wait a bit and try again later.</p>
        capo_qapps.errors.unauthorized_exception.UnauthorizedException: <p>The client is not authenticated or authorized to perform the requested operation.</p>
        capo_qapps.errors.validation_exception.ValidationException: <p>The input failed to satisfy the constraints specified by the service.</p>
        capo_qapps.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Start a session for an Amazon Q App using version 1, passing in initial values for one card

        >>> await client.start_q_app_session(instance_id='4cc5e4c2-d2a2-4188-a114-9ca125b4aedc', app_id='65e7dce7-226a-47f9-b689-22850becef89', app_version=1, initial_values=[{'cardId': '6fb5b404-3b7b-48a4-8a8b-56406922a606', 'value': 'What is the circumference of Earth?'}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_qapps.types.start_q_app_session_input.StartQAppSessionInput]",
    ) -> AsyncOperationResponse[
        "capo_qapps.types.start_q_app_session_output.StartQAppSessionOutput"
    ]:
        import capo_qapps._operations.q_apps_service.start_q_app_session

        (
            output,
            http_response,
        ) = await capo_qapps._operations.q_apps_service.start_q_app_session.async_start_q_app_session(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("StartQAppSession")
    )
    input_: capo_qapps.types.start_q_app_session_input.StartQAppSessionInput = {
        "instance_id": instance_id,
        "app_id": app_id,
        "app_version": app_version,
    }
    if initial_values is not None:
        input_["initial_values"] = initial_values
    if session_id is not None:
        input_["session_id"] = session_id
    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