AI Agent generates response BEFORE Subworkflow Tool (Human-in-the-loop) finishes - Output issues

Hi everyone,

I’m having a timing and output issue with an AI Agent using a Subworkflow as a tool.

The Setup:

  1. Main Workflow: AI Agent (WhatsApp bot for a roofing company) → Tool: Subworkflow for booking.

  2. Subworkflow: Sends an approval email to me → Wait for Webhook → Books the meeting.

The Problem: Even though I instructed the Agent in the System Prompt to “wait until the tool has finished its task,” it starts generating the final response to the user as soon as the Subworkflow is triggered (specifically, right after the email is sent, but before I click ‘Approve’).

Because of this “pre-mature” response, the final output of the AI Agent node doesn’t contain the LLM text I see in the logs, but instead some weird fields: $json.status and $json.nachricht. It seems the Agent loses the connection to the actual tool result because it doesn’t wait for the Wait-Node to finish.

What I’ve observed: In the execution logs, the LLM actually writes the correct confirmation, but the Node’s output is corrupted/overwritten by these status fields from the subworkflow.

How can I force the AI Agent to truly wait for a Subworkflow that contains a “Wait for Webhook” node before it moves to the next step?

Information on your n8n setup

  • n8n version: latest(stable 2.8)
  • Running n8n via: n8n cloud instance
1 Like

Hi @Tanjuh Welcome to the n8n community!
You can try calling a sub workflow instead of calling an AI Agent as a tool , with sub workflow you not have this problem as AI Agent will wait for the output of the sub workflow before moving forward.

For better understanding, i use a sub workflow tool and this is it. but the problem is that i need the ai agent to generate its answer after the subworkflow is complete

1 Like

I guess then you are running into a known limitation @Tanjuh, consider keeping the booking/approval wait node in the main workflow instead of inside the sub-workflow that the agent calls. You can also use HITL nodes directly as tools to the AI agent

instead of calling a sub workflow todo that as shown in your workflow, and for best practice consider not using the wait node as a tool for the AI agent.

1 Like