InvokeFlow - Amazon Bedrock

InvokeFlow

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 AWS CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow.

Request Syntax

POST /flows/flowIdentifier/aliases/flowAliasIdentifier HTTP/1.1 Content-type: application/json { "enableTrace": boolean, "inputs": [ { "content": { ... }, "nodeName": "string", "nodeOutputName": "string" } ] }

URI Request Parameters

The request uses the following URI parameters.

flowAliasIdentifier

The unique identifier of the flow alias.

Length Constraints: Minimum length of 0. Maximum length of 2048.

Pattern: ^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10}/alias/[0-9a-zA-Z]{10})|(\bTSTALIASID\b|[0-9a-zA-Z]+)$

Required: Yes

flowIdentifier

The unique identifier of the flow.

Length Constraints: Minimum length of 0. Maximum length of 2048.

Pattern: ^(arn:aws:bedrock:[a-z0-9-]{1,20}:[0-9]{12}:flow/[0-9a-zA-Z]{10})|([0-9a-zA-Z]{10})$

Required: Yes

Request Body

The request accepts the following data in JSON format.

enableTrace

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.

Type: Boolean

Required: No

inputs

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

Type: Array of FlowInput objects

Array Members: Fixed number of 1 item.

Required: Yes

Response Syntax

HTTP/1.1 200 Content-type: application/json { "accessDeniedException": { }, "badGatewayException": { }, "conflictException": { }, "dependencyFailedException": { }, "flowCompletionEvent": { "completionReason": "string" }, "flowOutputEvent": { "content": { ... }, "nodeName": "string", "nodeType": "string" }, "flowTraceEvent": { "trace": { ... } }, "internalServerException": { }, "resourceNotFoundException": { }, "serviceQuotaExceededException": { }, "throttlingException": { }, "validationException": { } }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

accessDeniedException

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

Type: Exception

HTTP Status Code: 403
badGatewayException

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

Type: Exception

HTTP Status Code: 502
conflictException

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

Type: Exception

HTTP Status Code: 409
dependencyFailedException

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

Type: Exception

HTTP Status Code: 424
flowCompletionEvent

Contains information about why the flow completed.

Type: FlowCompletionEvent object

flowOutputEvent

Contains information about an output from flow invocation.

Type: FlowOutputEvent object

flowTraceEvent

Contains information about a trace, which tracks an input or output for a node in the flow.

Type: FlowTraceEvent object

internalServerException

An internal server error occurred. Retry your request.

Type: Exception

HTTP Status Code: 500
resourceNotFoundException

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

Type: Exception

HTTP Status Code: 404
serviceQuotaExceededException

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

Type: Exception

HTTP Status Code: 400
throttlingException

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

Type: Exception

HTTP Status Code: 429
validationException

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

Type: Exception

HTTP Status Code: 400

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDeniedException

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

HTTP Status Code: 403

BadGatewayException

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

HTTP Status Code: 502

ConflictException

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

HTTP Status Code: 409

DependencyFailedException

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

HTTP Status Code: 424

InternalServerException

An internal server error occurred. Retry your request.

HTTP Status Code: 500

ResourceNotFoundException

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

HTTP Status Code: 404

ServiceQuotaExceededException

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

HTTP Status Code: 400

ThrottlingException

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

HTTP Status Code: 429

ValidationException

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

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: