Skip to content

Bedrock Agent Runtime  >  Operations  >  invoke_flow

invoke_flow

Operation

invoke_flow async

invoke_flow(input: InvokeFlowInput, plugins: list[Plugin] | None = None) -> OutputEventStream[FlowResponseStream, InvokeFlowOutput]

Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.

Note

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow.

Parameters:

Name Type Description Default
input InvokeFlowInput

An instance of InvokeFlowInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
OutputEventStream[FlowResponseStream, InvokeFlowOutput]

An OutputEventStream for server-to-client streaming.

Input

InvokeFlowInput dataclass

Dataclass for InvokeFlowInput structure.

Attributes

enable_trace class-attribute instance-attribute
enable_trace: bool | None = None

Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.

execution_id class-attribute instance-attribute
execution_id: str | None = None

The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you.

flow_alias_identifier class-attribute instance-attribute
flow_alias_identifier: str | None = None

The unique identifier of the flow alias.

flow_identifier class-attribute instance-attribute
flow_identifier: str | None = None

The unique identifier of the flow.

inputs class-attribute instance-attribute
inputs: list[FlowInput] | None = None

A list of objects, each containing information about an input into the flow.

model_performance_configuration class-attribute instance-attribute
model_performance_configuration: ModelPerformanceConfiguration | None = None

Model performance settings for the request.

Output

This operation returns an OutputEventStream for server-to-client streaming.

Event Stream Structure

Output Event Type

FlowResponseStream

Initial Response Structure

InvokeFlowOutput dataclass

Dataclass for InvokeFlowOutput structure.

Attributes
execution_id class-attribute instance-attribute
execution_id: str | None = None

The unique identifier for the current flow execution.