Feature/newnew workflow loop node - #14863
Merged
laipz8200 merged 25 commits intoMar 5, 2025
Merged
Conversation
Woo0ood
force-pushed
the
feature/newnew-workflow-loop-node
branch
from
March 4, 2025 07:20
b443478 to
305e051
Compare
Member
2025-03-04.22.37.46.movSuggestion:
|
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.
Export the formatNode functions for both Iteration and Loop, and merge them into a unified method called formatIterationAndLoopNode. This method will handle the NodeTracing List uniformly, addressing the timing issues in the tracing logs caused by the previous categorized handling.
Woo0ood
force-pushed
the
feature/newnew-workflow-loop-node
branch
from
March 4, 2025 16:51
04aaacf to
6588bfd
Compare
Contributor
Author
I have addressed the first suggestion. The second suggestion will be handled later (maybe🌚..). append: all done |
Member
|
laipz8200
approved these changes
Mar 5, 2025
4 tasks
jackzhuo
pushed a commit
to jackzhuo/dify
that referenced
this pull request
Mar 14, 2025
Co-authored-by: arkunzz <4873204@qq.com>
5 tasks
parambharat
pushed a commit
to parambharat/dify
that referenced
this pull request
Mar 31, 2025
Co-authored-by: arkunzz <4873204@qq.com>
5 tasks
jsincorporated
pushed a commit
to jsincorporated/asaAi
that referenced
this pull request
Jul 8, 2025
Co-authored-by: arkunzz <4873204@qq.com>
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>
Ssazurov
pushed a commit
to Ssazurov/dify
that referenced
this pull request
Aug 8, 2026
Co-authored-by: arkunzz <4873204@qq.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
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.
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.
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