AI Agent (Sub-)Workflow Tool - "The workflow did not return a response"

Hi,

I want to implement an ai agent which is using another implemented workflow as a tool.

Everything works, the workflow is called successfully, but the tool node within the main workflow fails with error message: There was an error: “The workflow did not return a response”.

When I look into executions of the (sub-) workflow, it was executed successfully and returned an respose.

Output by the last node:

[
  {
    "success": true,
    "operation": "notification",
    "collection": "notifications",
    "document_id": "notification_1749455645813",
    "correlation_id": "cs_1749455642429_731143361",
    "timestamp": "2025-06-09T07:54:05.813Z",
    "metadata": {
      "records_inserted": 1,
      "workflow": "BOA_NotificationService_v1.0",
      "version": "2.0",
      "telegram_sent": true,
      "email_sent": false
    }
  }
]

I invested already hours into that problem without any progress. Tried a SET Node instead of a Code node as last node within the sub-workflow, same result.

I don`t want to implement a HTTP Request, because the sub-workflow will only be used n8n internal.

Would be very very very happy for help :slight_smile: -

Best regards.

Information on my n8n setup

  • n8n version: 1.95.3
  • Database: postgressdb
  • Running n8n via: docker
  • Operating system:Debian GNU/Linux 12 (bookworm)

Hello @mavoe,

Even if your sub-workflow runs successfully and ends with a Set or Code node, the AI Agent still shows this kind of error.
This is because when a sub-workflow is invoked as a tool, it expects a proper response structure.

This behavior has been observed and discussed in the community previously:

Use “Respond to a Webhook” node (Respond to Webhook | n8n Docs) to control the response to incoming webhooks. Try to set “First incoming Item” as response

1 Like

Hi @Gallo_AIA ,

you mean I need to go the HTTP request /“webhook” way as there is currently no other solution?

i have done some research and I don’t think there are other solutions but I can’t give you 100% certainty of course :slight_smile:

If you want to preserve the json object, you’ll need to use a Structured output on the agent.

If no structured output, it’ll try and use something valuable from the response, else if structured, it’ll just return what the sub node produces (a json object in this case)

Maybe I don’t understand your answer, but for me the problem is not the output of the agent, but the (non-existent) output of the tool.

Its difficult to understand your problem without a workflow. Can you share the workflow in a code block? My example returns data from the sub node, so there must a problem somewhere in your workflow

Hi all,

I solved my issue. It was nothing related to the AI Agent itself, or the combination with “Execute Sub-Workflow”. It was just related to an error-prone workflow architecture.

Problem: In my workflow I had 2 parallel Workflow Streams after an implemented switch node, which both resulted later again in one “Code Node”.

The assumption, that my java script code with
.all()
deals with these potential race conditions was just wrong.

Implementing a “Merge Node” just before the Code Node which delivers also the final result solved everything.

1 Like

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