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
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:
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
Return only the numeric result.
I also share the JSON
WSANTIAG_Llamada de Agentes (1).json (5,9 KB)
thanks for the JSON, the error is now clearly visible. Two issues:
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.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.