Base
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.
post/api/v1/run/advanced/{flow_id_or_name}
Path parameters
flow_id_or_namestring required
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