Hi! I’m building a workflow where an AI Agent processes input data and returns a response. The user can then validate or modify the response via Slack. If modified, the flow enters a loop and sends the new input back to the agent.
Problem:
Initially, the loop went directly to the AI Agent, but this didn’t work (n8n showed a successful execution, but there was no output). To fix this, I added a Function node before the agent so that in the first iteration, it takes the original input, and in the following iterations, it uses the modified version.
The problem persists: if the loop is active, the Function node returns nothing. If I remove the loop, everything works fine.
Is there a limitation with loops in n8n? How can I fix this without breaking the flow?
Unfortunately, I can’t provide any help without knowing the entire workflow and the data involved.
However, there is no limitation when it comes to loops.
Here’s a tip: You can use an “Edit Fields” node to set the data. This can also make debugging simpler.
By the way, what kind of data does this node return?
I have slightly simplified the workflow and added some sticky notes for better clarity. Additionally, I have removed or deactivated a few nodes to improve the overall setup.
Regarding the webhooks and resumes, there’s also the possibility of using a Human in the Loop node, which makes the process even more smooth.
I have a similar loop trying to modify a prompt after a telegram message using send and wait to respond, after reads you i start to think this is kind of bug, because after saw a lot of video tutorial, all do the same and works fine for they.
First i connect directly the llm basic chain to telegram and didn’t work, i use the SET no approach and didn’t work too, apperently is related with back to a node.
I hope someone knows something about it. For the moment i’ll keep testing