Run Flow Component Only Outputs the First Chat Output of Sub-Flow and Lacks Step-by-Step Intermediate Output Support
Bug Description
I am encountering two related issues with the Run Flow component in Langflow:
Run Flow Only Outputs the First Chat Output Component of the Sub-Flow When using the Run Flow component to call a sub-flow that contains multiple Chat Output components (e.g., from multiple agents), only the output of the first Chat Output component in the sub-flow is returned to the main flow. The outputs from subsequent Chat Output components are ignored. Run Flow Does Not Support Step-by-Step Output of Intermediate Results The Run Flow component waits for the entire sub-flow to complete execution before returning any output. This means I cannot see the intermediate results (e.g., outputs from each Chat Output component or tool calls) in real-time during the sub-flow's execution. I would like to display these intermediate results step-by-step in the main flow as the sub-flow runs.
Reproduction
Steps to Reproduce Create a Sub-Flow: Build a sub-flow with two agents, each connected to a Chat Output component. Example structure: text
Copy [Input] -> [Agent1] -> [Chat Output1] -> [Agent2] -> [Chat Output2] Both Chat Output1 and Chat Output2 are expected to produce outputs during execution. Optionally, include tool calls in the agents to generate intermediate results. Create a Main Flow: In the main flow, use a Run Flow component to call the sub-flow created above. Connect the Run Flow component's output to a Chat Output component in the main flow to display the results. Example structure: text
Copy [Chat Input] -> [Run Flow] -> [Chat Output] Run the Main Flow: Execute the main flow in the Playground. Observe the output in the main flow's Chat Output component.
Expected behavior
For Issue 1: The Run Flow component should return the outputs from all Chat Output components in the sub-flow (e.g., both Chat Output1 and Chat Output2), not just the first one. For Issue 2: The Run Flow component should support streaming or step-by-step output, allowing intermediate results (e.g., each Chat Output or tool call result) to be displayed in the main flow in real-time as the sub-flow executes.
Who can help?
No response
Operating System
Ubuntu
Langflow Version
1.3.3
Python Version
None
Screenshot
No response
Flow File
No response
Hi @melodyfeifei! I'm Dosu and I’m helping the langflow team.
Based on the available information, the behavior you're seeing with the Run Flow component appears to be a limitation of the current implementation rather than a tracked bug or an intended feature.
For your first issue—only the first Chat Output of a sub-flow being returned—the Run Flow component is designed to execute a sub-flow and process its outputs using the generate_results method, which collects results via build_data_from_run_outputs. However, the way outputs are aggregated means that only the first Chat Output is typically surfaced to the main flow, and subsequent Chat Outputs are ignored. This is consistent with the current code and test coverage, which only verifies that a single output is returned even when multiple output components exist in the sub-flow (source, source).
For your second issue—lack of step-by-step or streaming intermediate output—the Run Flow component waits for the entire sub-flow to finish before returning any results. There is no built-in support for streaming or emitting intermediate outputs from sub-flows in real time. The current design processes all outputs at the end of execution (source).
I did not find any existing issues or discussions tracking these limitations. If you need to display multiple outputs or stream intermediate results, this would require changes to how the Run Flow component collects and emits outputs, as well as possible changes to the flow execution engine to support real-time output propagation.
Let me know if you need more details on the relevant parts of the code or possible workarounds.
To reply, just mention my name @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Hi @dosu,
Thank you for the detailed explanation regarding the limitations of the Run Flow component. I appreciate the insight into how the current implementation, particularly the generate_results method and the flow execution engine, results in only the first Chat Output being returned and the lack of support for step-by-step or streaming intermediate outputs. This clarification helps me understand the root cause of the issues I’ve encountered.
I have two follow-up questions based on your response:
-
Optimization in the Latest Version: Are there plans to address these limitations (i.e., returning all Chat Output components from a sub-flow and enabling step-by-step streaming of intermediate results) in the latest or an upcoming version of Langflow?
-
Workarounds for the Current Version: If optimization is not available in the current version, are there any recommended workarounds or best practices within the existing framework to achieve the desired behavior?
I’m happy to provide more details about my use case or assist with testing any proposed fixes. Looking forward to your input!
Best regards,
Based on my research, there are currently no documented plans or discussions in the Langflow repository to address the limitations of the Run Flow component regarding returning all Chat Output components from a sub-flow or enabling step-by-step streaming of intermediate results in the latest or upcoming versions.
I also did not find any official workarounds or best practices within the existing framework to achieve this behavior. The current implementation processes all outputs at the end of the sub-flow execution and only surfaces the first Chat Output to the main flow.
If you need to work around these limitations, you might consider manually aggregating outputs within your sub-flow (for example, by collecting all intermediate results into a single output structure) or implementing custom logic to simulate step-by-step output, though this would likely require changes outside the standard component configuration.
If you can share more details about your use case, I can help brainstorm more targeted strategies that might fit your workflow. Your willingness to assist with testing or provide feedback could also be valuable if the maintainers consider enhancements in the future.
To reply, just mention my name @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
Hi @melodyfeifei! Thanks for reporting this.
Issue 1 — Run Flow only returns the first Chat Output: This has been fixed in the latest version. The Run Flow component now exposes all Chat Output components from the sub-flow as selectable outputs, so you can choose which one(s) to wire into your main flow.
Issue 2 — No step-by-step/streaming intermediate output: We've created a feature request to track it — the expected behavior would be to forward token-by-token events and intermediate messages from the sub-flow execution in real-time to the parent flow's event stream. We'll update this issue once there's progress on that front.
Ticket: LFP-423