AI Agent in n8n Not Passing sessionId to Workflow Tool – How to Fix?





I have an AI agent that passes a conversation to a “call_n8n_workflow_tool” .
This conversation comes from the integrated chat in n8n, which is {{ $json.chatInput }} .
I store this conversation in a Windows Memory Buffer , which assigns an ID using the variable {{ $json.sessionId }} .
However, when calling the workflow_tool , the AI agent only sends {{ $json.chatInput }} , even though I explicitly instruct it in the system prompt to send {{ $json.chatInput }} + {{ $json.sessionId }} to the workflow_tool .
I have attached an image showing what the workflow_tool receives when a message is sent from the chat. As we can see, there is no reference to the memory ID.
This is necessary because, in order to implement memory in the workflow_tool , I need to provide the sessionId from the parent node.
Any help with this would be greatly appreciated!

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:

What you can do is just use an expression in your Workflow Tool:

This will pass on the session ID to the workflow that you’re calling. Make sure it can accept it, by specifying the fields on the Workflow Execution Trigger:

Hope this helps!

2 Likes

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