Workflow tools repeatedly return multiple results #7474

Closed
opened 2026-02-21 18:20:47 -05:00 by yindo · 2 comments
Owner

Originally created by @yangcunkuan on GitHub (Dec 31, 2024).

Self Checks

  • 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 (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.14.2

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

1、Create a workflow and call custom tools in between
2、Publish workflow as a tool
3、Call workflow tools in agent
4、The workflow tool returns the result of the custom tool and the concatenation of the two results of the workflow tool

✔️ Expected Behavior

This will cause the LLM cost to double, and we hope to fix it

Actual Behavior

No response

Originally created by @yangcunkuan on GitHub (Dec 31, 2024). ### Self Checks - [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 (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [X] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [X] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.14.2 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce 1、Create a workflow and call custom tools in between 2、Publish workflow as a tool 3、Call workflow tools in agent 4、The workflow tool returns the result of the custom tool and the concatenation of the two results of the workflow tool ### ✔️ Expected Behavior This will cause the LLM cost to double, and we hope to fix it ### ❌ Actual Behavior _No response_
yindo added the 🌊 feat:workflow label 2026-02-21 18:20:47 -05:00
yindo closed this issue 2026-02-21 18:20:47 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 31, 2024):

Hello @yangcunkuan! I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm a bot designed to assist you while you wait for a human maintainer.

I found a similar unsolved discussion titled "Why do workflow tools need to return JSON and TEXT two same results?" which might be related to the issue you're experiencing. It was last updated on November 18, 2024 [1].

Regarding your issue, it seems that the workflow tool is returning both the result of the custom tool and a concatenated result, which is causing an increase in LLM costs. This behavior might be related to how the agent in Dify processes results from workflow tools. The agent compiles information about each tool call, including the tool's input and output, and appends this to the result's iterations [2].

To address this, you might want to review the configuration of your workflow to ensure that it is not unintentionally duplicating results. Additionally, check if there are any specific settings or logic in your workflow that might be causing this concatenation. If the issue persists, it might be beneficial to look into the specific logic handling result concatenation in the code node, as it could be related to how data is being combined [3].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@dosubot[bot] commented on GitHub (Dec 31, 2024): <!-- Greeting --> Hello @yangcunkuan! I'm here to help you with any bugs, questions, or contributions you have for Dify. I'm a bot designed to assist you while you wait for a human maintainer. <!-- Answer --> I found a similar unsolved discussion titled "Why do workflow tools need to return JSON and TEXT two same results?" which might be related to the issue you're experiencing. It was last updated on November 18, 2024 <sup>[[1]](https://github.com/langgenius/dify/discussions/10794)</sup>. Regarding your issue, it seems that the workflow tool is returning both the result of the custom tool and a concatenated result, which is causing an increase in LLM costs. This behavior might be related to how the agent in Dify processes results from workflow tools. The agent compiles information about each tool call, including the tool's input and output, and appends this to the result's iterations <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/services/agent_service.py)</sup>. To address this, you might want to review the configuration of your workflow to ensure that it is not unintentionally duplicating results. Additionally, check if there are any specific settings or logic in your workflow that might be causing this concatenation. If the issue persists, it might be beneficial to look into the specific logic handling result concatenation in the code node, as it could be related to how data is being combined <sup>[[3]](https://github.com/langgenius/dify-docs/blob/main/en/guides/workflow/node/code.md)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/bc7fe360-6ada-4828-b7ae-b5902ff0e78c?feedback_type=other)</sup>
Author
Owner

@crazywoola commented on GitHub (Jan 1, 2025):

Duplicated https://github.com/langgenius/dify/discussions/10794

@crazywoola commented on GitHub (Jan 1, 2025): Duplicated https://github.com/langgenius/dify/discussions/10794
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7474