Hello, welcome to the community!
From what I can see, you’re using the callin.io 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 there!
First, thanks for your response. Let me explain it better: All the input fields are declared (there are 5 in total). The issue is that I'm not getting the correct expression. When I test my workflow, incorrect information is being sent to my 'When executed by another workflow' node in my sub-workflow. If I use fixed expressions, I get the correct response. I'm not sure if you understand exactly what I mean.
It seems the problem isn't with missing input fields in the schema, but rather how the AI Agent is generating or passing these values dynamically when initiating the sub-workflow.
-
Examine the AI agent's output
In the execution logs, expand the AI Agent node and look undertool_calls → inputs
to verify the values it's actually sending. This will confirm ifprovider_name
,target_month
, etc., are present and not empty. -
Log the inputs immediately before the Call Workflow Tool
Insert a simple Set node just before the Call Workflow Tool and log the values from$fromAI(...)
. This will allow you to see what the AI has actually parsed and is passing to the workflow. -
Occasionally, AI Agents return values in a nested structure (for instance, a tool input named
"inputs": { ... }
rather than flat keys). This means$fromAI("provider_name")
won't resolve unless the nesting is managed properly.
As mentioned, the primary challenge lies in how the “AI Agent” node passes dynamic values when invoking my sub-workflow, which is responsible for the Snowflake logic.
Here’s an update on my progress and the specific point where I’m encountering difficulties:
-
The
AI Agent
node IS correctly parsing arguments: I’ve examined the complete JSON output from theAI Agent
node, and it accurately generates the required information. The arguments intended for the tool (let’s refer to it asSnowflakeTPVAnalyzer
) are clearly present within aintermediateSteps[0].action.toolInput
structure, and also in a more nested location underkwargs.messageLog.kwargs.tool_calls[0].args
. For instance, when processing “TPV de Cielo en marzo 2024”, thetoolInput
correctly displays{ "provider_name": "Cielo", "target_month": "2024-03", "view_type": "monthly_summary" }
. The “Return Intermediate Steps” option is enabled on theAI Agent
node. -
The Sub-Workflow functions with static values: I’ve set up a test sub-workflow (“Echo Test”) with its trigger configured to “Define using JSON example”. This setup includes the fields I anticipate (
provider_name
,view_type
, etc.). When I navigate to theSnowflakeTPVAnalyzer
tool configuration within theAI Agent
node and input fixed values for these parameters (e.g., settingprovider_name
to “Cielo”), the test sub-workflow successfully receives and displays them. This confirms that the sub-workflow invocation and the sub-workflow itself are functioning correctly when provided with data. -
The Core Issue: Mapping Dynamic Inputs in the
AI Agent
’s Tool Configuration:
-
- When I attempt to utilize dynamic expressions within the “Value” fields under “Workflow Inputs” for the
SnowflakeTPVAnalyzer
tool (for parameters likeprovider_name
,view_type
, etc.), I am unable to access the arguments that the AI has parsed.
- When I attempt to utilize dynamic expressions within the “Value” fields under “Workflow Inputs” for the
-
- I’ve experimented with expressions such as
{{ $json[0].intermediateSteps[0].action.toolInput.provider_name }}
and{{ $json.intermediateSteps[0].action.toolInput.provider_name }}
. Both yield an “undefined” preview in the expression editor, and consequently, the sub-workflow receives “undefined”. The first expression was even highlighted in red within the editor.
- I’ve experimented with expressions such as
-
- Crucial Observation: If I input
{{ $json }}
as the value in these mapping fields, the sub-workflow receives the original input provided to theAI Agent
node (for example, the complete Slack event object), rather than the processed output or theintermediateSteps
from the AI Agent.
- Crucial Observation: If I input
-
- I also tried using
{{ JSON.stringify($CurrentNode) }}
, but the sub-workflow received"{}"
(a stringified empty object). This suggests that$CurrentNode
in this specific context does not appear to contain theintermediateSteps
in an accessible manner.
- I also tried using
My primary question is: Considering that $json
within the “Value” fields for “Workflow Inputs” (in the AI Agent’s tool configuration) refers to the node’s initial input, how can I access the intermediateSteps[0].action.toolInput
structure (or a similar structure containing the arguments parsed by the LLM for the current tool) from these mapping expressions? Is there a specific context variable that the “AI Agent” node makes available for this purpose when configuring a tool/sub-workflow call?
Any insights or guidance on which context variable I might explore within the expression editor for these mapping fields would be immensely valuable. I’ve been stuck at this stage for the past three days…
Hello,
thanks for all the details.
i suspect this is a bug that I've also encountered occasionally: both with drag and drop and when manually entering variables, they sometimes ended up as "undefined".
Unfortunately, I don't have a scientific method to make them work; I tried several times, and eventually, it started working.
I'm not sure if you have the latest version of the tool updated. If not, I recommend doing so.
Save the workflow and try again.
Another test you could perform is to try creating the workflow from scratch by importing the old one via JSON and see if you encounter the same error in the new workflow.