AI Agent - add ID from Input json to output

Hey All, New to n8n and have not been able to find the right search terms or what I should look for to achieve this.

Describe the problem/error/question

I am passing in outlook messages to the ai agent (from the template of ai categorization), processing with openAI and then outputting.

However I am struggling to keep the message ID from the input json.

I would really like to be able to append the current id to the output but cannot work out a way to do this.

I tried giving specific instructions to include this in the output, this works, however about every 5 or so responses, the ai is adding extra data into the ID field or a sentence about something and causes the workflow to fail.

Appreciate some advice :slight_smile:

What is the error message (if any)?

Example of where it has added extra random stuff.
image

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

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

Nevermind this can be closed now!

I worked out that I can use the json from previous steps in further along steps without needing to get the response from the ai agent.
It was that there was a step in the mix that was causing the id to be the same for each item which had made me try to get the ID back from the ai to fix it.

So answer is you can use the JSON from a specific previous node and it still lines up with the item that is being run :slight_smile:

1 Like