Custom Tool / Sub-Workflow Iteration with AI Agent

Describe the problem/error/question

Hello, I would like the ability to loop through a custom tool / sub-workflow with an AI agent. In the workflow below, the sub-workflow iterates through the loop but the AI agent only receives the first iteration. Ideally, the sub-workflow would feed the agent each iteration, allowing for the agent to provide an item-by-item response with less error and more specific focus than cramming all the items in at once or using an arbitrary (character/token) splitter. How can I go about this? Thank you

Please share your workflow

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

hey @Jonathan_Sherman
Not exactly what you’re asking for but looping tools is probably not advisable. Agents have something called a max iteration rate which the agent will force-stop when this is reached - eg. 32 is the current limit would be inadequate for say 100 student assignments. The max iteration rate is adjustable however but consider the following example.

  • Agent scores on all criteria at the same time.
  • Much simpler than using a scoring custom workflow tool.

Hey @Jim_Le, thanks for the examples. I agree in the case I presented that this makes sense, but I am still curious about how to possibly loop a tool, even if it’s not a good idea, ha. I can think of some interesting scenarios I’d just like to experiment with. Any ideas on how to implement/force it?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.