Feature/new workflow loop node - #13058
Closed
Woo0ood wants to merge 17 commits into
Closed
Conversation
The main reason is that the original design only considered nodes with nested sub-nodes of type Iterator. After adding the Loop, additional checks and handling are required.
|
I'm also looking forward to this feature. What's the status? |
Closed
5 tasks
clubanderson
added a commit
to kubestellar/console-kb
that referenced
this pull request
Apr 3, 2026
The original fix PR langgenius/dify#13058 was closed without merging. Replace with langgenius/dify#14863 which was merged and implements the loop node feature. Signed-off-by: Andrew Anderson <andy@clubanderson.com>
clubanderson
added a commit
to kubestellar/console-kb
that referenced
this pull request
Apr 3, 2026
…cution and (#1886) * 🌱 Add dify: Enhancing Workflow with Loop and Sleep Nodes for Repeated mission * 🌱 Add dify: Enhancing Workflow with Loop and Sleep Nodes for Repeated mission Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * fix: replace closed dify PR #13058 with merged PR #14863 The original fix PR langgenius/dify#13058 was closed without merging. Replace with langgenius/dify#14863 which was merged and implements the loop node feature. Signed-off-by: Andrew Anderson <andy@clubanderson.com> --------- Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Signed-off-by: Andrew Anderson <andy@clubanderson.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces the Loop Node, a feature designed to enable workflows or processes to execute repeatedly until specific conditions or formats are met. The node allows users to define internal variables and outputs that determine whether to exit the loop. A maximum iteration limit can also be set to prevent infinite loops.
The addition of the Loop Node addresses the community’s and team’s demand for executing repeated HTTP interface calls or invoking LLMs multiple times in a workflow. The implementation aligns with the feedback and requirements outlined in Issue #12354.
Resolves #12354
Close #12289
Author
This PR is submitted by the AICT Team from NetDragon Websoft Inc., aiming to contribute to the open-source community. The AICT Team is dedicated to promoting the continuous optimization and functional expansion of Dify and other open-source products. By introducing practical features such as the Loop Node, the team hopes to help community users build more efficient and intelligent workflow solutions, working together to create a stronger Dify ecosystem.
Screenshots
Some Details
This pull request introduces a new feature for handling single loop runs in workflows and advanced chat applications. The changes include adding new API endpoints, updating the app generator and runner classes, and modifying the task pipeline to support loop events.
New API endpoints:
Advanc /edChatDraftRunLoopNodeApiandWorkflowDraftRunLoopNodeApiclasses to handle POST requests for running draft workflow loop nodes. (api/controllers/console/app/workflow.py)App generator updates:
single_loop_generatemethod inAdvancedChatAppGeneratorandWorkflowAppGeneratorto generate app responses for single loop runs. (api/core/app/apps/advanced_chat/app_generator.py) [1] (api/core/app/apps/workflow/app_generator.py) [2]App runner updates:
AdvancedChatAppRunnerandWorkflowAppRunnerto handle single loop runs by adding logic to fetch and process graph and variable pool for loops. (api/core/app/apps/advanced_chat/app_runner.py) [1] (api/core/app/apps/workflow/app_runner.py) [2]Task pipeline modifications:
QueueLoopStartEvent,QueueLoopNextEvent,QueueLoopCompletedEvent,QueueNodeInLoopFailedEvent) and updated the_process_stream_responsemethod to handle these events. (api/core/app/apps/advanced_chat/generate_task_pipeline.py) [1] [2] [3] (api/core/app/apps/workflow/generate_task_pipeline.py) [4] [5] [6]These changes collectively enhance the system's ability to manage and execute single loop runs within workflows and advanced chat applications.
Checklist
Important
Please review the checklist below before submitting your pull request.
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods