Skip to content

create_act async

create_act(
    workflow_definition_name: WorkflowDefinitionName,
    workflow_run_id: UuidString,
    session_id: UuidString,
    task: Task,
    *,
    config_overrides: Optional[AsyncNovaActClientConfig] = None,
    tool_specs: Optional[ToolSpecs] = None,
    client_token: Optional[ClientToken] = None,
) -> CreateActResponse

Creates a new AI task (act) within a session that can interact with tools and perform specific actions.

Parameters:

  • workflow_definition_name (WorkflowDefinitionName) –

    The name of the workflow definition containing the session.

  • workflow_run_id (UuidString) –

    The unique identifier of the workflow run containing the session.

  • session_id (UuidString) –

    The unique identifier of the session to create the act in.

  • task (Task) –

    The task description that defines what the act should accomplish.

  • tool_specs (Optional[ToolSpecs], default: None ) –

    A list of tool specifications that the act can invoke to complete its task.

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

    A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

Raises:

Source code in docs_src/capo_nova_act/_services/async_nova_act.py
async def create_act(
    self,
    workflow_definition_name: "capo_nova_act.types.workflow_definition_name.WorkflowDefinitionName",
    workflow_run_id: "capo_nova_act.types.uuid_string.UuidString",
    session_id: "capo_nova_act.types.uuid_string.UuidString",
    task: "capo_nova_act.types.task.Task",
    *,
    config_overrides: Optional[AsyncNovaActClientConfig] = None,
    tool_specs: Optional["capo_nova_act.types.tool_specs.ToolSpecs"] = None,
    client_token: Optional["capo_nova_act.types.client_token.ClientToken"] = None,
) -> "capo_nova_act.types.create_act_response.CreateActResponse":
    """<p>Creates a new AI task (act) within a session that can interact with tools and perform specific actions.</p>

    Args:
        workflow_definition_name: <p>The name of the workflow definition containing the session.</p>
        workflow_run_id: <p>The unique identifier of the workflow run containing the session.</p>
        session_id: <p>The unique identifier of the session to create the act in.</p>
        task: <p>The task description that defines what the act should accomplish.</p>
        tool_specs: <p>A list of tool specifications that the act can invoke to complete its task.</p>
        client_token: <p>A unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>

    Raises:
        capo_nova_act.errors.access_denied_exception.AccessDeniedException: <p>You don't have sufficient permissions to perform this action.</p>
        capo_nova_act.errors.conflict_exception.ConflictException: <p>The request could not be completed due to a conflict with the current state of the resource.</p>
        capo_nova_act.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Please try again later.</p>
        capo_nova_act.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_nova_act.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota limit.</p>
        capo_nova_act.errors.throttling_exception.ThrottlingException: <p>The request was throttled due to too many requests. Please try again later.</p>
        capo_nova_act.errors.validation_exception.ValidationException: <p>The input parameters for the request are invalid.</p>
        capo_nova_act.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_nova_act.types.create_act_request.CreateActRequest]",
    ) -> AsyncOperationResponse[
        "capo_nova_act.types.create_act_response.CreateActResponse"
    ]:
        import capo_nova_act._operations.amazon_nova_agents_data_plane.create_act

        (
            output,
            http_response,
        ) = await capo_nova_act._operations.amazon_nova_agents_data_plane.create_act.async_create_act(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_nova_act.types.create_act_request.CreateActRequest",
    ) -> dict[str, Any]:
        import capo_nova_act.types.create_act_request

        return capo_nova_act.types.create_act_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateAct", redact_input=_redact_input)
    )
    input_: capo_nova_act.types.create_act_request.CreateActRequest = {
        "workflow_definition_name": workflow_definition_name,
        "workflow_run_id": workflow_run_id,
        "session_id": session_id,
        "task": task,
    }
    if tool_specs is not None:
        input_["tool_specs"] = tool_specs
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token

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