Feature: Supports the "return_direct" mechanism and fixes a potential issue in api\core\agent\fc_agent_runner.py #20788

Closed
opened 2026-02-21 20:08:59 -05:00 by yindo · 1 comment
Owner

Originally created by @Cursx on GitHub (Dec 4, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

I am using the Agent module to generate ECharts visualizations and large Markdown tables. While Dify handles small datasets well, I encounter significant challenges when dealing with large datasets (e.g., sensor trend graphs with 2500+ data points).

Currently, the tool's output must pass through the LLM before being returned. For large structured data, this leads to:

Unnecessary Token Consumption: The LLM consumes a huge amount of tokens to process raw data that doesn't need interpretation.

High Latency: Processing large JSON strings slows down the response significantly.

Context Window Issues: Large datasets risk exceeding the LLM's context limit.

Therefore, I would like to introduce a return_direct mechanism (similar to LangChain/LangGraph). This allows specific tools to return outputs directly to the user, bypassing the subsequent LLM processing.

Note: While implementing this, I also discovered and fixed a high-severity bug in fc_agent_runner.py related to data loss in multi-tool calls.

Image

2. Additional context or comments

No response

3. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @Cursx on GitHub (Dec 4, 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] 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] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. I am using the Agent module to generate ECharts visualizations and large Markdown tables. While Dify handles small datasets well, I encounter significant challenges when dealing with large datasets (e.g., sensor trend graphs with 2500+ data points). Currently, the tool's output must pass through the LLM before being returned. For large structured data, this leads to: Unnecessary Token Consumption: The LLM consumes a huge amount of tokens to process raw data that doesn't need interpretation. High Latency: Processing large JSON strings slows down the response significantly. Context Window Issues: Large datasets risk exceeding the LLM's context limit. Therefore, I would like to introduce a return_direct mechanism (similar to LangChain/LangGraph). This allows specific tools to return outputs directly to the user, bypassing the subsequent LLM processing. Note: While implementing this, I also discovered and fixed a high-severity bug in fc_agent_runner.py related to data loss in multi-tool calls. <img width="1080" height="417" alt="Image" src="https://github.com/user-attachments/assets/b4c9bd69-984e-4a78-a74b-a92ab7ffb491" /> ### 2. Additional context or comments _No response_ ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the 🤖 feat:agent label 2026-02-21 20:08:59 -05:00
yindo closed this issue 2026-02-21 20:08:59 -05:00
Author
Owner

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

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

Issue Summary:

  • You requested a "return_direct" feature in the Agent module to bypass LLM processing for large structured data.
  • The goal is to reduce token usage, latency, and context window issues.
  • You also fixed a critical bug in fc_agent_runner.py related to data loss during multi-tool calls.
  • There has been no further activity or discussion on this feature request since your last update.

Next Steps:

  • Please let me know if this feature is still relevant to the latest version of Dify by commenting on this issue.
  • If I don’t hear back within 15 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 18, 2026): Hi, @Cursx. 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 requested a "return_direct" feature in the Agent module to bypass LLM processing for large structured data. - The goal is to reduce token usage, latency, and context window issues. - You also fixed a critical bug in `fc_agent_runner.py` related to data loss during multi-tool calls. - There has been no further activity or discussion on this feature request since your last update. **Next Steps:** - Please let me know if this feature is still relevant to the latest version of Dify by commenting on this issue. - If I don’t hear back within 15 days, I will automatically close this issue. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20788