Simplified Run Flow
Executes a specified flow by ID with support for streaming and telemetry.
This endpoint executes a flow identified by ID or name, with options for streaming the response and tracking execution metrics. It handles both streaming and non-streaming execution modes.
Args: background_tasks (BackgroundTasks): FastAPI background task manager flow (FlowRead | None): The flow to execute, loaded via dependency input_request (SimplifiedAPIRequest | None): Input parameters for the flow stream (bool): Whether to stream the response api_key_user (UserRead): Authenticated user from API key request (Request): The incoming HTTP request
Returns: Union[StreamingResponse, RunResponse]: Either a streaming response for real-time results or a RunResponse with the complete execution results
Raises: HTTPException: For flow not found (404) or invalid input (400) APIException: For internal execution errors (500)
Notes:
- Supports both streaming and non-streaming execution modes
- Tracks execution time and success/failure via telemetry
- Handles graceful client disconnection in streaming mode
- Provides detailed error handling with appropriate HTTP status codes
- In streaming mode, uses EventManager to handle events:
- "add_message": New messages during execution
- "token": Individual tokens during streaming
- "end": Final execution result
| Path Parameters |
|---|
flow_id_or_name Flow Id Or Name — REQUIRED |
| Query Parameters |
|---|
stream Stream |
user_id User Id |
| Request Body |
|---|
| undefined |
| Responses | |||||
|---|---|---|---|---|---|
200Successful Response
| |||||
422Validation Error
|