Issue with Node as Tools calling several times with the same arguments

Describe the problem/error/question

I’ve been trying to use Notion Create Database Page “Node as Tools” with several AI Agents (React, Tools, OpenAI Functions) with the fromAI param

Configuration:
I’m getting items from a Notion Database Page and iterating on them with an AI agent. It has several tools. One of them is creating new items in Notion.

I have a recurring problem:

  1. the tool is called twice for each input item

  1. The $fromAI param seems to be using only the params from the initial item (2 different input items created 4 times the same entry in Notion)


Please share your workflow

I need to clean up my workflow because it has many other nodes. I’m wondering if anyone is experiencing it as well?

Information on your n8n setup

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

Hi, we made some fixes around similar issues in 1.67.

Would you mind upgrading and confirming you still have the same problem? If so, we‘ll prioritise looking into it.

Hi David,

Thanks for the quick reply!

No, I’m on the latest release 1.66. I’ll test it with 1.67 when released and let you know.
In the mean time, I’ve used a “call n8n workflow tool” and it works well.

Hi @sirdavidoff,
I just updated my version and rerun my workflow and add a similar issue.

The agent has 7 input items.

The Notion “create insight” node is called once in the whole execution (based on the logs).

The input contains only one element, which is great as the agent only needs to create one insight

but it creates 7 entries in my Notion database. The output contains 7 elements - like if the tool was called for each input item, instead of for only one


Thanks for continuing to investigate, Baptiste.

We’ve identified the issue and are working on a fix. I know you’ve already found a workaround, but another one would be to put the agent inside a loop so that it’s only called with one item at a time.

Thank you!
At the moment, I’m using a sub workflow to create the insight. That’s the great thing about having multiple options.
FYI: I’ve retested it again with the latest version, still having the issue

1 Like

Hi @sirdavidoff
Im also facing similar issue.
I have a MYSQL Tool node connected to Tools AI Agent which executes query generated by Tools AI Agent.
For repetitive calls to the this tool,it executes the first query only.
In logs it shows the second query.But in backend it executes the first query.

You’re probably aware of it at this stage…
I’ve also tested it with Airtable node tool - “delete record”, it has exactly the same behavior: it only delete the first record (identified by another Airtable node tool - search records)
Same workaround, I use an HTTP request instead which works like a charm.

Thanks for the extra context, @Baptiste_JACQUEMET and @AasimK. We’re working on a fix for this and hope to have it ready soon.

2 Likes

Hi, it’s the same with nocoDB for create, delete, and with Google calendar.
Thanks

1 Like

I’m facing the same problem here, I could do it using the HTTP request Tool. I face the same issue with Supabase Tool. Looking forward to fix this problem, will be so much easier.

Just here to say I am facing the same issue with the Google Calendar tool.

Mostly leaving a message so I can know when the fix is published :blush:

Thanks n8n devs for all the work you do!!!

n8n is an AMAZING tool!

First of: +1 to @theJoshMuller! Fully agree this is an amazing tool, the community is awesome and I’m so impressed by the work the team is putting together! :clap::clap:

I wanted to pointed to another issue with the Airtable node as tool.
I’m not sure if it’s completely related to this bug or not. Please let me know if I should create another thread.

When my agent calls several times the same tool with different params, it does return the same object as the one of the first call.
I first thought it was a visual bug, but inspecting the chat model logs, I see it’s passed to the LLM too.

Context:
I have a airtable node as tool that search into airtable records.

Example (this is a research by keyword, it returns items that have this word in the Description field)

When the agent queries the tool, it seems to be querying it with different params but I think it doesn’t.


You can see in this last screenshot that the description doesn’t have the word “efficiency”, but does the word “productivity” (1st call term)
I’ve just checked, I do have other records in my Airtable table that have the word “efficiency” in the Description field, so it should return other results.

Lastly, you can see in this log that the chat model node receives 3 times the same response from the agent

Sorry for the long message, I hope this is understandable.

Any news on this one?

@sirdavidoff
I have encountered a similar issue. Is there any new progress?

These issues should be mainly fixed in version 1.72 (which is available now) and fully fixed in 1.72.1 (which will be released tomorrow).

Please do let us know if that’s not the case!

2 Likes

Hi @sirdavidoff ,
I’ve tested a couple of examples and it seems to work great!
Thanks a lot!
Happy end of the year :christmas_tree:

Thanks for confirming! You too :santa:

I still seem to have the problem on 1.73.1
I have a simple flow with 1 AI Agent, and a sub-flow to be able to call BigQuery with an SQL Query.

I asked the Agent a simple question, and I see it coming up with different queries to find answers, but the sub-flow only receives the very first one each time.

The only thing the query tool is doing is passing along the {{ $fromAI(‘query’) }}, but it always seem to pass the very first query it generates instead of the new ones after that.



HI @Thijs_Morlion

It seems that you’re calling a sub workflow. If I’m not mistaken, the fromAI function is only available in Node as tools

With Call n8n workflow tool, you can specify the value in the call subworflow description.

For example, here is part of my prompt:

You will send the following fields to the tool: issue_type, date, criticality, description and user_name

and the execute workflow trigger receives the following query
image

Does it make sense?