Slack Send and Wait for Response, AI Agent uses wrong input

Describe the problem/error/question

I Have a workflow that pulls data from a bunch of google sheets, then does some data manipulation and updates the rows. Before updating the rows, I have a Slack node with a Send and Wait for Response operation, with Response type Approval. If approved in Slack, the changes are made, otherwise the workflow returns a message saying nothing was done. All of this works fine if I run the workflow itself.

The problem is when I tie this workflow as a tool to a AI Agent. When the AI Agent runs the tool and hits the Slack node, I can see the workflow tool is marked as “completed” and the input the AI Agent gets back is the output message the Slack node sends, asking me to approve. The AI Agent still waits for the workflow to complete, but it doesnt get the final workflow output, it only has this “intermediary” output which is wrong and not relevant.

Please share your workflow

Share the output returned by the last node

{
“message”: “I want to update the following rows:\nRow 22: Student 2: X → Y (Suggested)”
}
This is the output of the sub-workflow given to the AI Agent while its waiting for me to approve. There shouldnt be any output at this stage to the AI Agent, it should wait for the final step.

Information on your n8n setup

  • n8n version: 1.78.0
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own, main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): WSL, Ubuntu
  • Operating system: Windows (but running on WSL)

You can adjust your subworkflow to return data from the last executed node.

Subworkflows always return data from the last node executed.

The visual placement of nodes affects the execution order.

  • Nodes at the top execute first.
  • The last node executed is always at the bottom.

See the images below—nodes circled in red are the last executed in each scenario.

:muscle: If my reply answers your question or helps to solve your problem, please remember to mark it as a solution.

hello, To keep everything in one workflow, you can use a Wait for Slack Approval node before the final return. Here’s how you can do it:

After the Slack node that sends the approval, add a Wait node. (consider the time according to your workflow)
Set the Wait node to pause until Slack sends the response.
When the user in Slack approves or rejects, trigger the continuation of the workflow.
Only after receiving the approval or rejection, return an output to the AI ​​agent.
This way, the AI ​​agent doesn’t receive an incorrect intermediate response.
I hope this solution helps you

Uploading: Response.png…

Hi, I dont think a wait node can be set to wait for Slack output.

The way I solved this was to change my subworkflow to trigger on a Webhook, then the final node is a Respond to Webhook. The AI agent will wait for the response from the Webhook. Not ideal because the output of the Webook is stringyfied and put in a json “response” key/value, instead of the actual json output.

Hi, am I understanding correctly that inside the workflows that are called as tools, you are trying to use the wait for response option? If so, that will not work, currently. The called workflows will be put into waiting, but that waiting is not propagated back properly to the agent.

For now, try to keep the “wait for response” nodes in your main flow, and only do the updates after that.

Hey @HedgeCRM please close this topic by choosing the answer that is the solution to your problem.

I’m also running into this issue. The “send and wait for response” functionality doesn’t seem to work properly when used as a sub-workflow or tool. The agent ends up waiting after calling the tool, instead of at the tool level, where it should be pausing for the human response. I’ve found it only really works as expected if everything stays within a single workflow—trying to handle the approval across multiple workflows breaks the flow.

Yup, n8n doesnt support this currently. There is a github issue where I highlight the code that causes this: https://github.com/n8n-io/n8n/issues/13135#issuecomment-2676184601

I have had to migrate away from n8n because of this, as most production ready Agent + tools need a approval step, if you can’t do that with tools, then tools cannot be used for most of my use cases. Otherwise the tools are basically YOLOing the changes they make.

Btw your videos introduced me to n8n Nate, they are great.

1 Like

Gotcha, thanks for clearing that up. Appreciate the kind words!