Agent Node Context #15941

Open
opened 2026-02-21 19:24:03 -05:00 by yindo · 11 comments
Owner

Originally created by @DavideDelbianco on GitHub (Aug 6, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.9.1

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create a chatflow
Add an Agent Node
Select the function calling strategy
Bind something to the Context input
Ask a question that could be answere with the context
Remove the context binding

Have Dify Agent Strategies 0.0.23+ because "Context" appears only with that version

✔️ Expected Behavior

It should be possible to link the context in the system prompt like we do in LLM node
It should use the context to answer questions
It should be possible to remove the context variable

Actual Behavior

The Context, when bound, is ignored... probably because I cannot link it in the system prompt

That part present in LLM:
Image
Image

Is missing in Agent Node
Image

Removing the variable from Context will throw an exception the next round reporting that "" cannot be resolved (seems like it is trying to evaluate the empty input.

Image
Originally created by @DavideDelbianco on GitHub (Aug 6, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.9.1 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Create a chatflow Add an Agent Node Select the function calling strategy Bind something to the Context input Ask a question that could be answere with the context Remove the context binding Have Dify Agent Strategies 0.0.23+ because "Context" appears only with that version ### ✔️ Expected Behavior It should be possible to link the context in the system prompt like we do in LLM node It should use the context to answer questions It should be possible to remove the context variable ### ❌ Actual Behavior The Context, when bound, is ignored... probably because I cannot link it in the system prompt That part present in LLM: <img width="873" height="94" alt="Image" src="https://github.com/user-attachments/assets/3f466930-64e5-4395-b399-468507374a97" /> <img width="375" height="450" alt="Image" src="https://github.com/user-attachments/assets/21042b14-74ca-4aa0-b714-7d6e632bf895" /> Is missing in Agent Node <img width="773" height="785" alt="Image" src="https://github.com/user-attachments/assets/5676db9e-d1be-44b4-b612-b43df7d0e348" /> Removing the variable from Context will throw an exception the next round reporting that "" cannot be resolved (seems like it is trying to evaluate the empty input. <img width="826" height="336" alt="Image" src="https://github.com/user-attachments/assets/f3505eeb-5f4a-4a39-80b9-83ad4848f25e" />
yindo added the 🐞 bug label 2026-02-21 19:24:03 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 6, 2025):

The difference you’re seeing is due to how Agent Nodes handle parameters like "context" compared to LLM nodes. In Agent Nodes, all parameters—including context—are treated generically and only used if the selected agent strategy/plugin is designed to use them. There’s no built-in mechanism to link the context variable into the system prompt like you can with LLM nodes, so the context is ignored unless the agent strategy explicitly integrates it. This is why you can’t link context in the prompt and why removing the variable causes an exception: the backend expects a value and throws an error if it’s missing or empty [source].

The presence of the context input in self-hosted but not in cloud is likely due to differences in agent strategy/plugin configuration or feature flags, not a core product difference. There’s no special handling for context in the Agent Node UI, so what you see depends on the agent strategy’s parameter definitions [source].

If you want to avoid the exception, make sure to either keep the context variable mapped to a valid value or remove it from the agent strategy’s parameter list entirely. If you need context to be available in the prompt, you’ll need to use an LLM node or customize your agent strategy/plugin to support it.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Aug 6, 2025): <!-- Answer --> The difference you’re seeing is due to how Agent Nodes handle parameters like "context" compared to LLM nodes. In Agent Nodes, all parameters—including context—are treated generically and only used if the selected agent strategy/plugin is designed to use them. There’s no built-in mechanism to link the context variable into the system prompt like you can with LLM nodes, so the context is ignored unless the agent strategy explicitly integrates it. This is why you can’t link context in the prompt and why removing the variable causes an exception: the backend expects a value and throws an error if it’s missing or empty [[source](https://github.com/langgenius/dify/blob/c95761f4e6234a27a31446bec768da72826d3324/api/core/workflow/nodes/agent/agent_node.py)]. The presence of the context input in self-hosted but not in cloud is likely due to differences in agent strategy/plugin configuration or feature flags, not a core product difference. There’s no special handling for context in the Agent Node UI, so what you see depends on the agent strategy’s parameter definitions [[source](https://github.com/langgenius/dify/blob/c95761f4e6234a27a31446bec768da72826d3324/web/app/components/workflow/nodes/agent/panel.tsx)]. If you want to avoid the exception, make sure to either keep the context variable mapped to a valid value or remove it from the agent strategy’s parameter list entirely. If you need context to be available in the prompt, you’ll need to use an LLM node or customize your agent strategy/plugin to support it. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/39fcbbde-4bef-456c-8d27-45e9c5357674?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/23510)
Author
Owner

@DavideDelbianco commented on GitHub (Aug 7, 2025):

@crazywoola Dosu erroneously tagged this as a feature request, to me, it's a bug..

@DavideDelbianco commented on GitHub (Aug 7, 2025): @crazywoola Dosu erroneously tagged this as a feature request, to me, it's a bug..
Author
Owner

@crazywoola commented on GitHub (Aug 8, 2025):

@crazywoola Dosu erroneously tagged this as a feature request, to me, it's a bug..

Neither, feat:agent means it's related to the functions with agent.

@crazywoola commented on GitHub (Aug 8, 2025): > [@crazywoola](https://github.com/crazywoola) Dosu erroneously tagged this as a feature request, to me, it's a bug.. Neither, feat:agent means it's related to the functions with agent.
Author
Owner

@DavideDelbianco commented on GitHub (Sep 1, 2025):

@crazywoola
Should this issue be moved or copied to dify-official-plugins?
It's a feature appeared in LLM node after updating CoT agent to 0.0.23 not sure if it's a bug in dify or the plugin

@DavideDelbianco commented on GitHub (Sep 1, 2025): @crazywoola Should this issue be moved or copied to dify-official-plugins? It's a feature appeared in LLM node after updating CoT agent to 0.0.23 not sure if it's a bug in dify or the plugin
Author
Owner

@dosubot[bot] commented on GitHub (Oct 2, 2025):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.7.1 self-hosted, the Agent Node does not link the Context input in the system prompt like the LLM node does.
  • The Agent Node ignores the Context input unless the agent strategy or plugin explicitly supports it, which differs from LLM nodes that have built-in context linking.
  • You consider this behavior a bug, while others clarified that the "feat:agent" label refers to agent functions, not a feature request.
  • You asked whether this issue should be moved to the dify-official-plugins repository since context linking appeared after updating the CoT agent plugin.
  • The issue remains unresolved with no further updates.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of Dify and whether it should be moved to the dify-official-plugins repository.
  • If it is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 15 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Oct 2, 2025): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.7.1 self-hosted, the Agent Node does not link the Context input in the system prompt like the LLM node does. - The Agent Node ignores the Context input unless the agent strategy or plugin explicitly supports it, which differs from LLM nodes that have built-in context linking. - You consider this behavior a bug, while others clarified that the "feat:agent" label refers to agent functions, not a feature request. - You asked whether this issue should be moved to the dify-official-plugins repository since context linking appeared after updating the CoT agent plugin. - The issue remains unresolved with no further updates. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of Dify and whether it should be moved to the dify-official-plugins repository. - If it is still relevant, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 15 days. Thank you for your understanding and contribution!
Author
Owner

@DavideDelbianco commented on GitHub (Oct 8, 2025):

@crazywoola
Any updates? Knowledge in Agent nodes cannot be consumed.

@DavideDelbianco commented on GitHub (Oct 8, 2025): @crazywoola Any updates? Knowledge in Agent nodes cannot be consumed.
Author
Owner

@DavideDelbianco commented on GitHub (Oct 8, 2025):

@dosu yes bug is still there in 1.9.1 with latest CoT Agent version

@DavideDelbianco commented on GitHub (Oct 8, 2025): @dosu yes bug is still there in 1.9.1 with latest CoT Agent version
Author
Owner

@nicho2 commented on GitHub (Nov 27, 2025):

I don't understand how to use this context field for the agent, and the online documentation doesn't mention it.

@nicho2 commented on GitHub (Nov 27, 2025): I don't understand how to use this context field for the agent, and the online documentation doesn't mention it.
Author
Owner

@dosubot[bot] commented on GitHub (Jan 15, 2026):

Hi, @DavideDelbianco. I'm Dosu, and I'm helping the Dify team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.9.1 self-hosted, the Agent Node does not properly handle the Context input, which is ignored and causes exceptions if removed.
  • It was clarified that Agent Nodes treat context generically and only use it if supported by the agent strategy or plugin, unlike LLM nodes that have built-in context linking.
  • You confirmed the bug persists with the latest CoT Agent version.
  • There is uncertainty whether this issue should be addressed in the core Dify repository or the dify-official-plugins repository.
  • Another user noted the lack of documentation on how to use the context field for agents.

Next Steps:

  • Please let me know if this issue is still relevant with the latest version of Dify and if you have any additional information or updates.
  • If I do not hear back within 15 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 15, 2026): Hi, @DavideDelbianco. I'm [Dosu](https://dosu.dev), and I'm helping the Dify team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.9.1 self-hosted, the Agent Node does not properly handle the Context input, which is ignored and causes exceptions if removed. - It was clarified that Agent Nodes treat context generically and only use it if supported by the agent strategy or plugin, unlike LLM nodes that have built-in context linking. - You confirmed the bug persists with the latest CoT Agent version. - There is uncertainty whether this issue should be addressed in the core Dify repository or the dify-official-plugins repository. - Another user noted the lack of documentation on how to use the context field for agents. **Next Steps:** - Please let me know if this issue is still relevant with the latest version of Dify and if you have any additional information or updates. - If I do not hear back within 15 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@ZSiltitan commented on GitHub (Jan 29, 2026):

The issue is still not solved. The Agent Node in chatflow's context cannot add variables, and the ⓘ hint shows nothing.

Image
@ZSiltitan commented on GitHub (Jan 29, 2026): The issue is still not solved. The Agent Node in chatflow's context cannot add variables, and the ⓘ hint shows nothing. <img width="1572" height="636" alt="Image" src="https://github.com/user-attachments/assets/a799d12a-eb6e-48af-b8d7-4cd97b714960" />
Author
Owner

@davidkhala commented on GitHub (Feb 3, 2026):

The issue is still not solved. The Agent Node in chatflow's context cannot add variables, and the ⓘ hint shows nothing.

Image

+1, same on dify cloud 1.11.4

@davidkhala commented on GitHub (Feb 3, 2026): > The issue is still not solved. The Agent Node in chatflow's context cannot add variables, and the ⓘ hint shows nothing. > > <img alt="Image" width="1572" height="636" src="https://private-user-images.githubusercontent.com/22924947/542038471-a799d12a-eb6e-48af-b8d7-4cd97b714960.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzAxNTc5ODksIm5iZiI6MTc3MDE1NzY4OSwicGF0aCI6Ii8yMjkyNDk0Ny81NDIwMzg0NzEtYTc5OWQxMmEtZWI2ZS00OGFmLWI4ZDctNGNkOTdiNzE0OTYwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAyMDMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMjAzVDIyMjgwOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgyZjdhZjk1ZmIzZjFkNjBlMzg4MWE0YTg0NmRkZDNlOGNlMGJiOWRhYzNjZTJjMDVhODAyM2NjZjBjMzRkNjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wiGHz7sli51jILTi1dkMfA6oInZGNe-42josDuUxeAg"> +1, same on dify cloud 1.11.4
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#15941