Skip to content

Feature/Update Loop Agentflow #4957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HenryHengZJ
Copy link
Contributor

Include fallback message and version increment to 1.1

  • Added a new input parameter 'fallbackMessage' to the Loop Agentflow for displaying a message when the loop count is exceeded.
  • Incremented the version of Loop Agentflow from 1.0 to 1.1.
  • Updated the processing logic to handle the fallback message appropriately when the maximum loop count is reached.

…n increment to 1.1

- Added a new input parameter 'fallbackMessage' to the Loop Agentflow for displaying a message when the loop count is exceeded.
- Incremented the version of Loop Agentflow from 1.0 to 1.1.
- Updated the processing logic to handle the fallback message appropriately when the maximum loop count is reached.
…g the runtime state during workflow execution.

- Added a method to list runtime state keys for dynamic state management.
- Implemented logic to retrieve and utilize the current loop count in variable resolution.
- Updated the Loop Agentflow output to reflect the new state and final output content.
@HenryHengZJ
Copy link
Contributor Author

This new addition allows user to specify fallback message after loop is exhaused, and use the new built in variable {{ loop_count }} to check current loop count, so a fallback action can be performed

image

The ideal way is to allow Loop node to have 2 outputs, 1 to loopback, 1 to fallback, but since we are not able to have the loopback edges, thus having just 1 fallback outgoing path is going to confuse user. Hence, we'd prefer to stick with no outgoing paths

image

@toi500
Copy link
Contributor

toi500 commented Jul 27, 2025

@HenryHengZJ following the conversation from here #4653 (comment), if what we want is simplicity for new users, the visual approach with 1 ouput works better, IMHO. This allows us to add a simple reply node, as we do in other nodes, or of if needed, create much more advanced applications by adding whatever new workflow logic we can implement after exhaustion. I don't know, it feels quite intuitive to me and provides a new dimension to the flow that it currently does not have.

chrome_TwSBe5nGmO

I know you want to get this simple, but this draft implementation I did took me 45 mins (only 2 files), just the time I needed to figure out the loop counting, but of course, as always, this is up to you.

Maybe a new toggle option to disable the visual output by default?

@toi500
Copy link
Contributor

toi500 commented Jul 27, 2025

By the way, I have never been a fan of the loopback edges, as other people suggest on Discord. In my opinion, they would just add visual complexity to the canvas, going against the data flow direction. And in any event, what prevents us from adding a non-functional, visual loopback edge (discontinued line ----) from the loop node to the target node if that is something users really want to have?

## Visual loopback edge
By "visual," I mean preserving the current logic of loop back to the target node but instead of using a drop-down menu, use it like this. It feels pointless to me (since drop-down menu works well), but could solve the 2-output scenario for the loop node you were visualizing.

chrome_0m6u2xzDng

@HenryHengZJ
Copy link
Contributor Author

Good suggestion, I think the best approach is to add another toggle option - Enable Fallback Action that when turned on, will add the outgoing connection point, allowing user to connect the edge to other nodes. This will need lil bit more work from UI as well to have that dynamic capability - but I think its probably the best we can do

@toi500
Copy link
Contributor

toi500 commented Jul 28, 2025

@HenryHengZJ For what it's worth, I have aligned the fallback implementation (now working in all the scenarios and nodes I tested out) with the original code main...toi500:Flowise:exhausted-output-loop-node, making only minimal and targeted changes. If you want, I can make a draft PR so you can wrap this out with that new UI dynamic capability to make the fallback output disabled by default.

@HenryHengZJ
Copy link
Contributor Author

thanks, that's fine we dont have to open a draft PR, I can just refer to the link you pasted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants