Issue Call n8n Workflow Tool

I’m creating this Workflow, which will call another flow as a tool within the agent:

Edit fields

The subworkflow is not being called and no value is being displayed

Hello @testn8n_Santiago,

the setup looks fundamentally correct. A few things to check:

  1. In the Sub-Workflow Tool node (the “Random Number Generator” as a tool on the AI Agent): Is it clearly described in the “Tool Description” field what the agent should use this tool for? The agent decides based on this description whether it will call the tool at all. A vague description often leads to the agent simply ignoring the tool.
  2. In the Sub-Workflow itself: Does the “When Executed by Another Workflow” trigger expect certain input parameters? If so, they must match exactly what the agent passes as tool input.
  3. Can you test the sub-workflow in isolation, meaning call it directly with an “Execute Workflow” node and a test input, without the AI Agent in between? That would show whether the sub-workflow itself works, or if the problem lies with the tool integration to the agent.

If you’d like, you could also share the content of the AI Agent’s system prompt — that often helps understand why the agent isn’t calling a tool.

In the Sub-Workflow Tool node (the “Random Number Generator” as a tool in the AI Agent) I have this description:

In the Sub-Workflow itself: Does the “When Executed by Another Workflow” trigger expect specific input parameters? If so, do they need to match exactly what the agent provides as Tool-Input?

This is the system prompt

  • ALWAYS use the tool
  • NEVER create the number manually
  • Pass the following parameters:
    • min: 1
    • max: {{ $json.max_random_number }}

Return only the numeric result.

I also share the JSON

WSANTIAG_Llamada de Agentes (1).json (5,9 KB)

Hi @testn8n_Santiago,

thanks for the JSON, the error is now clearly visible. Two issues:

  1. The tool workflow is calling itself. In the “Random Number Generator” tool node, the workflowId points to exactly this workflow (x2ClIhsa1nxXALcp), not to a separate sub-workflow. The tool must point to a standalone workflow that starts exclusively with “When Executed by Another Workflow” and contains the code node. As it’s currently set up, calling the tool restarts the entire workflow, including the manual trigger and edit fields, which is not the desired behavior.
  2. matchingColumns contains “hola”, a value that doesn’t match the schema (the schema only defines max_random_number). This is probably a test leftover and should be removed or corrected to max_random_number.

Solution: Separate the sub-workflow (“When Executed by Another Workflow” + code node) into its own, separate workflow. Save it, copy its workflow ID, and have the tool node in the main workflow point to this new ID instead of to itself.

Hi Rene

I’ve made the recommendation to create two workflows:

And in the Output of Random Number Generator this error is generated.
[

{

“response”: “There was an error: \“Workflow is not active and cannot be executed.\””

}

]

And I’m now sharing the two workflows in JSON

SubFlujo.json (1,5 KB)

WSANTIAG_Llamada de Agentes.json (4,3 KB)

Hi Santiago,

the separation into two workflows is correct. The error is literal and simple to fix: the SubFlow is saved but not activated ("active": false in the JSON).

To fix it: open the SubFlow in n8n and activate the “Active” toggle at the top right of the editor. A Tool Workflow must be active for another workflow to invoke it, even if you run it manually to test it, that doesn’t count as “active” for external calls.

After activating it, run the AI Agent again and it should work.

1 Like