Cannot get streaming answer in workflow when that include branch node #7110

Closed
opened 2026-02-21 18:18:58 -05:00 by yindo · 5 comments
Owner

Originally created by @wxjttxs on GitHub (Dec 8, 2024).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.11.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

when the workflow has the if-else or code-execution, then call its API, it only output blocking answer even it looks like streaming. this is my screenshot:
image

✔️ Expected Behavior

streaming answer

Actual Behavior

block answer

Originally created by @wxjttxs on GitHub (Dec 8, 2024). ### Self Checks - [X] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [X] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [X] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.11.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce when the workflow has the if-else or code-execution, then call its API, it only output blocking answer even it looks like streaming. this is my screenshot: ![image](https://github.com/user-attachments/assets/e4b1bb8b-e00d-48ca-83a1-80b16370f8dc) ### ✔️ Expected Behavior streaming answer ### ❌ Actual Behavior block answer
yindo added the 🌊 feat:workflow label 2026-02-21 18:18:58 -05:00
yindo closed this issue 2026-02-21 18:18:58 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 8, 2024):

Hello @wxjttxs! I'm here to assist you with any bugs, questions, or contributions you may have for Dify. I'm a bot and I'm ready to help while we wait for a human maintainer.

I found a similar unsolved discussion titled "Help:agent not support blocking mode in restful api,why?" which might be related to your issue [1].

Regarding your issue, the Dify codebase handles API requests for workflows with branch nodes using the WorkflowAppGenerateResponseConverter class, which manages both streaming and blocking responses. The streaming behavior can be influenced by the stream parameter in the generate method of the CompletionAppGenerator class. If streaming is set to True, the method returns a generator that streams the response; otherwise, it returns a complete dictionary response [2].

Additionally, the AnswerStreamProcessor class plays a significant role in managing streaming behavior by processing events related to node execution in a workflow, including handling streaming chunks of data [3].

If your workflow includes branch nodes like if-else, it might be defaulting to blocking mode due to specific conditions or configurations that are not explicitly documented. You might want to check the configurations related to the stream parameter and ensure that the workflow is set up to handle streaming responses correctly.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 8, 2024): <!-- Greeting --> Hello @wxjttxs! I'm here to assist you with any bugs, questions, or contributions you may have for Dify. I'm a bot and I'm ready to help while we wait for a human maintainer. <!-- Answer --> I found a similar unsolved discussion titled "[Help:agent not support blocking mode in restful api,why?](https://github.com/langgenius/dify/discussions/7805)" which might be related to your issue <sup>[[1]](https://github.com/langgenius/dify/discussions/7805)</sup>. Regarding your issue, the Dify codebase handles API requests for workflows with branch nodes using the `WorkflowAppGenerateResponseConverter` class, which manages both streaming and blocking responses. The streaming behavior can be influenced by the `stream` parameter in the `generate` method of the `CompletionAppGenerator` class. If `streaming` is set to `True`, the method returns a generator that streams the response; otherwise, it returns a complete dictionary response <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/core/app/apps/completion/app_generator.py)</sup>. Additionally, the `AnswerStreamProcessor` class plays a significant role in managing streaming behavior by processing events related to node execution in a workflow, including handling streaming chunks of data <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/workflow/nodes/answer/answer_stream_processor.py)</sup>. If your workflow includes branch nodes like if-else, it might be defaulting to blocking mode due to specific conditions or configurations that are not explicitly documented. You might want to check the configurations related to the `stream` parameter and ensure that the workflow is set up to handle streaming responses correctly. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/1eff5197-728c-423e-8ae8-7f3308522907?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Dec 8, 2024):

Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now.

@crazywoola commented on GitHub (Dec 8, 2024): Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now.
Author
Owner

@wxjttxs commented on GitHub (Dec 8, 2024):

Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now.

Thank you for your reply. but My workflow just like this situation, if-else before and LLM after then output, but it still does not output the streaming answer. this is my screenshot of workflow :
image

@wxjttxs commented on GitHub (Dec 8, 2024): > Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now. Thank you for your reply. but My workflow just like this situation, if-else before and LLM after then output, but it still does not output the streaming answer. this is my screenshot of workflow : ![image](https://github.com/user-attachments/assets/26b83408-d761-4a97-8732-a25d49284e1a)
Author
Owner

@wxjttxs commented on GitHub (Dec 8, 2024):

Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now.

Thank you for your reply. but My workflow just like this situation, if-else before and LLM after then output, but it still does not output the streaming answer. this is my screenshot of workflow : image

I have already sloved this problem by change the order of Variable assignment and output .

@wxjttxs commented on GitHub (Dec 8, 2024): > > Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now. > > Thank you for your reply. but My workflow just like this situation, if-else before and LLM after then output, but it still does not output the streaming answer. this is my screenshot of workflow : ![image](https://private-user-images.githubusercontent.com/12609388/393690226-26b83408-d761-4a97-8732-a25d49284e1a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzM3MTUzMDksIm5iZiI6MTczMzcxNTAwOSwicGF0aCI6Ii8xMjYwOTM4OC8zOTM2OTAyMjYtMjZiODM0MDgtZDc2MS00YTk3LTg3MzItYTI1ZDQ5Mjg0ZTFhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDEyMDklMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQxMjA5VDAzMzAwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRlYWE2MGNiZjY1ZWM3MDBhNTY3YmJjNDRkODE5OTE5NGZhMjQ0YWQyNTEyOGRhMTk2NDRkZDQ4OWE0MWFjOWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.djcUk6aRz1AtXN9nyzUGBo-mM1BZh4H-5kH6-PKzYRM) I have already sloved this problem by change the order of Variable assignment and output .
Author
Owner

@wxjttxs commented on GitHub (Dec 8, 2024):

Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now.

Thank you so much!

@wxjttxs commented on GitHub (Dec 8, 2024): > Some nodes can produce answers like blocking only, for example, you append a code node before the answer, then it should behave like this. Only LLM can produce streaming like event for now. Thank you so much!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7110