Skip to content

start_flow_execution async

start_flow_execution(
    flow_identifier: FlowIdentifier,
    flow_alias_identifier: FlowAliasIdentifier,
    inputs: FlowInputs,
    *,
    config_overrides: Optional[AsyncBedrockAgentRuntimeClientConfig] = None,
    flow_execution_name: Optional[FlowExecutionName] = None,
    model_performance_configuration: Optional[ModelPerformanceConfiguration] = None,
) -> StartFlowExecutionResponse

Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks.

This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution.

Flow executions is in preview release for Amazon Bedrock and is subject to change.

Parameters:

  • flow_identifier (FlowIdentifier) –

    The unique identifier of the flow to execute.

  • flow_alias_identifier (FlowAliasIdentifier) –

    The unique identifier of the flow alias to use for the flow execution.

  • flow_execution_name (Optional[FlowExecutionName], default: None ) –

    The unique name for the flow execution. If you don't provide one, a system-generated name is used.

  • inputs (FlowInputs) –

    The input data required for the flow execution. This must match the input schema defined in the flow.

  • model_performance_configuration (Optional[ModelPerformanceConfiguration], default: None ) –

    The performance settings for the foundation model used in the flow execution.

Raises:

  • AccessDeniedException –

    The request is denied because of missing access permissions. Check your permissions and retry your request.

  • BadGatewayException –

    There was an issue with a dependency due to a server issue. Retry your request.

  • ConflictException –

    There was a conflict performing an operation. Resolve the conflict and retry your request.

  • DependencyFailedException –

    There was an issue with a dependency. Check the resource configurations and retry the request.

  • InternalServerException –

    An internal server error occurred. Retry your request.

  • ResourceNotFoundException –

    The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.

  • ServiceQuotaExceededException –

    The number of requests exceeds the service quota. Resubmit your request later.

  • ThrottlingException –

    The number of requests exceeds the limit. Resubmit your request later.

  • ValidationException –

    Input validation failed. Check your request parameters and retry the request.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_bedrock_agent_runtime/_services/async_bedrock_agent_runtime.py
async def start_flow_execution(
    self,
    flow_identifier: "capo_bedrock_agent_runtime.types.flow_identifier.FlowIdentifier",
    flow_alias_identifier: "capo_bedrock_agent_runtime.types.flow_alias_identifier.FlowAliasIdentifier",
    inputs: "capo_bedrock_agent_runtime.types.flow_inputs.FlowInputs",
    *,
    config_overrides: Optional[AsyncBedrockAgentRuntimeClientConfig] = None,
    flow_execution_name: Optional[
        "capo_bedrock_agent_runtime.types.flow_execution_name.FlowExecutionName"
    ] = None,
    model_performance_configuration: Optional[
        "capo_bedrock_agent_runtime.types.model_performance_configuration.ModelPerformanceConfiguration"
    ] = None,
) -> "capo_bedrock_agent_runtime.types.start_flow_execution_response.StartFlowExecutionResponse":
    """<p>Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks.</p> <p>This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution.</p> <note> <p>Flow executions is in preview release for Amazon Bedrock and is subject to change.</p> </note>

    Args:
        flow_identifier: <p>The unique identifier of the flow to execute.</p>
        flow_alias_identifier: <p>The unique identifier of the flow alias to use for the flow execution.</p>
        flow_execution_name: <p>The unique name for the flow execution. If you don't provide one, a system-generated name is used.</p>
        inputs: <p>The input data required for the flow execution. This must match the input schema defined in the flow.</p>
        model_performance_configuration: <p>The performance settings for the foundation model used in the flow execution.</p>

    Raises:
        capo_bedrock_agent_runtime.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because of missing access permissions. Check your permissions and retry your request.</p>
        capo_bedrock_agent_runtime.errors.bad_gateway_exception.BadGatewayException: <p>There was an issue with a dependency due to a server issue. Retry your request.</p>
        capo_bedrock_agent_runtime.errors.conflict_exception.ConflictException: <p>There was a conflict performing an operation. Resolve the conflict and retry your request.</p>
        capo_bedrock_agent_runtime.errors.dependency_failed_exception.DependencyFailedException: <p>There was an issue with a dependency. Check the resource configurations and retry the request.</p>
        capo_bedrock_agent_runtime.errors.internal_server_exception.InternalServerException: <p>An internal server error occurred. Retry your request.</p>
        capo_bedrock_agent_runtime.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_runtime.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The number of requests exceeds the service quota. Resubmit your request later.</p>
        capo_bedrock_agent_runtime.errors.throttling_exception.ThrottlingException: <p>The number of requests exceeds the limit. Resubmit your request later.</p>
        capo_bedrock_agent_runtime.errors.validation_exception.ValidationException: <p>Input validation failed. Check your request parameters and retry the request.</p>
        capo_bedrock_agent_runtime.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bedrock_agent_runtime.types.start_flow_execution_request.StartFlowExecutionRequest]",
    ) -> AsyncOperationResponse[
        "capo_bedrock_agent_runtime.types.start_flow_execution_response.StartFlowExecutionResponse"
    ]:
        import capo_bedrock_agent_runtime._operations.amazon_bedrock_agent_run_time_service.start_flow_execution

        (
            output,
            http_response,
        ) = await capo_bedrock_agent_runtime._operations.amazon_bedrock_agent_run_time_service.start_flow_execution.async_start_flow_execution(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_bedrock_agent_runtime.types.start_flow_execution_request.StartFlowExecutionRequest",
    ) -> dict[str, Any]:
        import capo_bedrock_agent_runtime.types.start_flow_execution_request

        return capo_bedrock_agent_runtime.types.start_flow_execution_request.redact_sensitive(
            input_
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("StartFlowExecution", redact_input=_redact_input),
    )
    input_: capo_bedrock_agent_runtime.types.start_flow_execution_request.StartFlowExecutionRequest = {
        "flow_identifier": flow_identifier,
        "flow_alias_identifier": flow_alias_identifier,
        "inputs": inputs,
    }
    if flow_execution_name is not None:
        input_["flow_execution_name"] = flow_execution_name
    if model_performance_configuration is not None:
        input_["model_performance_configuration"] = model_performance_configuration

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