Call N8N workflow Tool

I am trying to use the Call N*N workflow Tool and I am having trouble for it to send the appropiate workflow inputs making my AI Agent getting errors.



Hello @Alessandra_Rospiglio, welcome to the community!

From what I can see, you’re using the Call n8n Workflow Tool inside an AI Agent to call a secondary workflow, but the AI Agent is failing because the input values aren’t arriving correctly.

The Call Workflow Tool expects the AI Agent to map its outputs to the input schema of the workflow being called. In your third screenshot are only three input fields declared or all fields that present in AI agent’s side?

Hi @Gallo_AIA
First thanks for your response.
Let me explained it better: All the inputs fields are declared (there are 5 to be exact). The problem is that I am not getting the right expression so if I test my workflow non correct information is getting to my ‘When executed by another workflow’ node in my sub-workflow. If I put Fixed expressions I will have the correct response… Don’t know if you understand what I am meaning exactly.

It sounds like the issue isn’t about missing input fields in the schema, but rather about how the AI Agent is generating or passing those values dynamically when triggering the sub-workflow.

  • Inspect the AI agent output
    In the execution logs, expand the AI Agent node and check under tool_calls → inputs to see what values it’s actually sending.
    That will confirm whether provider_name, target_month, etc. are present and non-empty.

  • Log the inputs right before the Call Workflow Tool
    Add a simple Set node before the Call Workflow Tool and log out the values from $fromAI(...). This will let you see what the AI actually parsed and is passing to the workflow.

  • Sometimes AI Agents return values in a nested format (e.g., a tool input named "inputs": { ... } instead of flat keys), which means $fromAI("provider_name") won’t resolve unless the nesting is handled correctly.

@Gallo_AIA

As you said, the main issue is how the “AI Agent” node is passing dynamic values when it calls my sub-workflow (which handles the Snowflake logic).

Here’s an update on the progress and exactly where I’m stuck:

  1. The AI Agent IS parsing arguments correctly: I checked the full JSON output of the AI Agent node, and it effectively generates the correct information. The arguments for the tool (let’s call it SnowflakeTPVAnalyzer) clearly appear within an intermediateSteps[0].action.toolInput structure (and also in a more nested structure under kwargs.messageLog.kwargs.tool_calls[0].args). For example, for “TPV de Cielo en marzo 2024”, the toolInput correctly shows { "provider_name": "Cielo", "target_month": "2024-03", "view_type": "monthly_summary" }. The “Return Intermediate Steps” option is enabled on the AI Agent node.

  2. The Sub-Workflow works with fixed values: I created a test sub-workflow (“Echo Test”) with its trigger in “Define using JSON example” mode, with the fields I expect (provider_name, view_type, etc.). If I go into the SnowflakeTPVAnalyzer tool configuration (within the AI Agent) and put fixed values for these inputs (e.g., provider_name = “Cielo”), the test sub-workflow receives them and displays them correctly. This confirms the sub-workflow call and the sub-workflow itself are fine if they receive the data.

  3. The Problem: Dynamic Input Mapping in the AI Agent’s Tool Configuration:

    • When I try to use dynamic expressions in the “Value” fields of the “Workflow Inputs” for the SnowflakeTPVAnalyzer tool (for provider_name, view_type, etc.), I can’t seem to access the arguments parsed by the AI.
    • I tried expressions like {{ $json[0].intermediateSteps[0].action.toolInput.provider_name }} and also {{ $json.intermediateSteps[0].action.toolInput.provider_name }}. Both give me an “undefined” preview in the expression editor, and the sub-workflow receives “undefined”. The first expression even appeared “in red” in the editor.
    • Key Discovery: When I put {{ $json }} as the value in those mapping fields, the sub-workflow receives the original input that the AI Agent node received (e.g., the full Slack event object), NOT the AI Agent’s processed output or its intermediateSteps!
    • I also tried {{ JSON.stringify($CurrentNode) }}, and the sub-workflow received "{}" (an empty object stringified), so $CurrentNode in that context doesn’t seem to hold the intermediateSteps in an accessible way either.

My main question is: Given that $json in the context of the “Value” fields for “Workflow Inputs” (within the AI Agent’s tool configuration) refers to the node’s original input, how can I access the intermediateSteps[0].action.toolInput structure (or an equivalent structure containing the arguments parsed by the LLM for the current tool) from those mapping expressions? Is there a special context variable that the “AI Agent” node exposes for this when it’s setting up a tool/sub-workflow call?

Any ideas or hints on what context variable I could explore in the expression editor for those mapping fields would be incredibly helpful. I have been trap in this stage for the last 3 days…

Hello @Alessandra_Rospiglio,
thanks for all details.

i suspect it is a bug that I have also encountered sometimes: both with drag and drop and by handwriting the variables sometimes went into “undefined”.

Unfortunately I don’t have a scientific method to make them work, I tried several times and in the end it worked.

I don’t know if you have the latest version of the tool updated, in case I recommend you to do it.
Save the workflow and try again.

other test you could do, try to create the workflow from scratch by importing via JSON the old one and see if you come across the same error in the new one.