Can the ai agent clear and re-use the same $fromAI() variable?

I’m using an AI agent to retrieve a member list form google sheets and create a sheet for each member using {{ $fromAI(“username”) }}
Even though the ai agent is cycling through and creating the sheets 1 by 1 with the correct variable.

Google sheets just creates the same sheet over and over.

Lead’s me to believe ai agent cannot clear and re-use the same variable. Is this correct? Is there a workaround?

1 Like

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:

Hi @Troy_Remelski

In your last screenshot you’re sharing the username of Run 1 of 6.
Is it the same for all 6 ? Could you share your workflow so that we can recreate this issue?

Thanks :slight_smile:

Tip for sharing your workflow in the forum

Pasting your n8n workflow


Ensure to copy your n8n workflow and paste it in the code block, that is in between the pairs of triple backticks, which also could be achieved by clicking </> (preformatted text) in the editor and pasting in your workflow.

```
<your workflow>
```

Make sure that you’ve removed any sensitive information from your workflow and include dummy data or pinned data as much as you can!


Each of the 6 usernames is different, thus the question
Can I run $fromA(“username”) but have the variable cleared/reset/replaced for each iteration.

The ai agent get’s the list of usernames, then attempts to create sheets for each of the 6 users. But it seems it can’t clear/overwrite the variable so it will only ever create the first username sheet.

I solved this, but creating a loop, but it’s annoying.

I solved this a second way by creating a lot of google sheet tools and variables so that I could have:
sheet tool1 handle $fromAI(“username1”)
sheet tool2 handle $fromAI(“username2”)
etc.
Also, annoying and limited by how many tools/variables I provide for it

Hi @Troy_Remelski

This was indeed a bug and we have just released a fix for this with version 1.72.0

Please let us know if this resolves it for you :pray:

2 Likes

I have the same issue with the latest version of n8n. Any idea?

Hi @alexanderl

Could you share a minimal workflow so we can reproduce this?

Same issue for me on the latest version (1.76.3) and the one before (last week).

Minimal reproduction is:

  • Create an ai agent
  • Let it call an n8n workflow
  • Have an input that should be different for both runs (via fromAi())
  • The query of both runs are different, however the workflow is triggered with only the query from the first run.

See screenshots

You can see that in the execution logs, it has different query prompts (today and tomorrow), but the resolved value is identical (2x today)

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