Experimental Run Flow
Executes a specified flow by ID with optional input values, output selection, tweaks, and streaming capability.
This endpoint supports running flows with caching to enhance performance and efficiency.
Parameters:
- flow (Flow): The flow object to be executed, resolved via dependency injection.
- inputs (List[InputValueRequest], optional): A list of inputs specifying the input values and components for the flow. Each input can target specific components and provide custom values.
- outputs (List[str], optional): A list of output names to retrieve from the executed flow. If not provided, all outputs are returned.
- tweaks (Optional[Tweaks], optional): A dictionary of tweaks to customize the flow execution. The tweaks can be used to modify the flow's parameters and components. Tweaks can be overridden by the input values.
- stream (bool, optional): Specifies whether the results should be streamed. Defaults to False.
- session_id (Union[None, str], optional): An optional session ID to utilize existing session data for the flow execution.
- api_key_user (User): The user associated with the current API key. Automatically resolved from the API key.
Returns:
A RunResponse object containing the selected outputs (or all if not specified) of the executed flow and the session ID. The structure of the response accommodates multiple inputs, providing a nested list of outputs for each input.
Raises:
HTTPException: Indicates issues with finding the specified flow, invalid input formats, or internal errors during flow execution.
Example usage:
POST /run/flow_id
x-api-key: YOUR_API_KEY
Payload:
{
"inputs": [
{"components": ["component1"], "input_value": "value1"},
{"components": ["component3"], "input_value": "value2"}
],
"outputs": ["Component Name", "component_id"],
"tweaks": {"parameter_name": "value", "Component Name": {"parameter_name": "value"}, "component_id": {"parameter_name": "value"}}
"stream": false
}
This endpoint facilitates complex flow executions with customized inputs, outputs, and configurations, catering to diverse application requirements.
Path parameters
Request body
Example request
{
"inputs": [
{
"components": [
"components_id",
"Component Name"
],
"input_value": "input_value",
"session": "session_id"
}
],
"tweaks": {
"Component Name": {
"parameter_name": "value"
},
"component_id": {
"parameter_name": "value"
},
"parameter_name": "value",
"stream": false,
"temperature": 0.7
}
}Response
Successful Response
Changes
Changed in 4 of the 21 revisions of this API.247
- ●
deleted the
queryrequest parameteruser_idrequest-parameter-removed
- ○
request property
tweaks/anyOf[subschema #1: Tweaks]/additionalProperties/list-of-types was widened by adding typesbooleaninteger and numberto media typeapplication/jsonrequest-property-list-of-types-widened
This revision also has 7 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ●
- ○
added the optional property
outputs/anyOf[subschema #1]/items/outputs/items/anyOf[subschema #1: ResultData]/token_usageto the response with the200statusresponse-optional-property-added
- ○
- ○
added the optional property
detail/items/ctxto the response with the422statusresponse-optional-property-added
- ○
added the optional property
detail/items/inputto the response with the422statusresponse-optional-property-added
This revision also has 12 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ○
- ▲
for the
pathrequest parameterflow_id_or_name, the type/format was changed fromstring/tostring/uuidrequest-parameter-type-changed
- ▲
request property
tweaks/anyOf[subschema #1: Tweaks]/additionalProperties/list-of-types was narrowed by removing typesbooleaninteger and numberfrom media typeapplication/jsonrequest-property-list-of-types-narrowed
- ●
removed the request property
inputs/anyOf[subschema #1]/items/client_request_timerequest-property-removed
- ●
removed the optional property
detail/items/ctxfrom the response with the422statusresponse-optional-property-removed
- ●
removed the optional property
detail/items/inputfrom the response with the422statusresponse-optional-property-removed
- ○
api operation id
experimental_run_flow_api_v1_run_advanced__flow_id_or_name__postremoved and replaced withexperimental_run_flow_api_v1_run_advanced__flow_id__postapi-operation-id-removed
- ○
added
ResultData-Outputto theoutputs/anyOf[subschema #1]/items/outputs/items/response propertyanyOflist for the response status200response-property-any-of-added
- ○
removed
ResultDatafrom theoutputs/anyOf[subschema #1]/items/outputs/items/response propertyanyOflist for the response status200response-property-any-of-removed
This revision also has 62 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog
- ▲