-
Notifications
You must be signed in to change notification settings - Fork 53.7k
Description
Describe the problem
When using the AI Agent node version 3.1 (Latest), upstream execution context is lost when the Agent either:
- delegates to a sub-agent, or
- calls another workflow that contains an Agent
As a result, expressions referencing upstream nodes (e.g. a Telegram Trigger) stop working, even though the workflow structure remains visually unchanged.
This behavior did not occur with Agent node version 2.x, where upstream node expressions continued to work reliably.
Expected behavior
Expressions referencing upstream nodes (for example:
{{ $('Telegram Trigger').item.json.message.chat.id }}) should behave consistently regardless of whether the Agent:
- answers directly,
- uses a sub-agent, or
- calls another workflow containing an Agent.
If this behavior is expected due to execution boundaries, the UI should clearly warn about it or document it explicitly.
Actual behavior
Workflow structure:
Telegram Trigger
→ Agent (v3.1, may use sub-agent OR call another workflow with an Agent)
→ Telegram Send Message
Observed behavior:
- If the Agent does NOT delegate, the expression works correctly.
- If the Agent uses a sub-agent, the expression evaluates to
undefined. - If the Agent calls another workflow that contains an Agent, the expression also evaluates to
undefined.
This causes the Telegram Send node to fail due to a missing Chat ID.
No warning or error explains why the upstream node context is no longer available.
Why this is problematic
- The workflow is visually linear but behaves differently at runtime.
- The failure is non-deterministic, depending on LLM decisions.
- The same expression works or fails depending on Agent behavior.
- There is no UI indication that Agent v3 introduces execution boundaries.
- This represents a behavior change/regression compared to Agent v2.x.
From a user perspective, this breaks the expected mental model of how expressions and node context work in n8n.
Reproduction steps
-
Create a workflow:
- Telegram Trigger
- AI Agent node (version 3.1, Latest)
- Telegram Send Message
-
Configure the Agent so it may:
- use a sub-agent, or
- call another workflow that contains an Agent
-
In the Telegram Send node, set Chat ID to:
{{ $('Telegram Trigger').item.json.message.chat.id }}
-
Send a message to the bot:
- Case A: Agent answers directly → message is sent successfully.
- Case B: Agent delegates (sub-agent or workflow with Agent) → Chat ID is
undefinedand message fails.
Environment
- n8n version: 2.3.5
- AI Agent node version: 3.1 (Latest)
- Deployment: Docker
- OS: Linux (Docker host)
- Trigger: Telegram Trigger
Screenshots
The last node has the chat_id value when no sub-agent or workflow is called by the Main Agent:
The last node does not have the chat_id value when a sub-workflow was called:
The last node does not have the chat_id value when a sub-agent was called:
With AI Agent node version 2.x, the execution context appeared to be preserved when calling a workflow
