Hello, I have an infinite loop between the AI Agent and the chat model. I tried a lot of different situations and found out that certain nodes before the ai agent was creating the bug. On my workflow, the trigger is manual, the matrix node get the messages, the Editfields node create a string named action and the AI agent use it = Infinite loop.
Then if I just turn off matrix node, it doesn’t change what the Editfields node create and AI Agent receive but then it only runs once and stop perfectly.
From the attached workflow, the matrix node gets the messages (“Get many messages”) and is configured to return 100:
This means the node output will be 100 items, which causes the Set node to execute 100 times, and as a result, the AI Agent will also execute 100 times..
Infinite loop means it goes from AI Agent to to the chat model, then go back to ai agent, then back to chat model, then back to ai agent, … infinitely.
Neither the Editfields node or AI Agent get any item from the matrix node. Edit fields 1 create a string the AI Agent get “{{ $json.action }}”.
Then if I turn off the Matrix node, it doesn’t change anything to Edit Fields 1 and AI Agent but the AI Agent only ask the chat model once and it is done.
Edit : OK that is it, even if the data isn’t used, it get items anyway so I need to clean the number of items before it reach the AI Agent.