When the Agent's model is set to DeepSeek V3 Chat, the tool invocation count becomes abnormal. #7741

Closed
opened 2026-02-21 18:22:08 -05:00 by yindo · 3 comments
Owner

Originally created by @kevintsai1202 on GitHub (Jan 15, 2025).

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.15

Cloud or Self Hosted

Cloud

Steps to reproduce

When the Agent uses the DeepSeek V3 Chat model, all tool executions will continue until the maximum number of iterations is reached.

use DeepSeek V3 Chat
圖片

use gpt-4o-mini
圖片

use mistral-large
圖片

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @kevintsai1202 on GitHub (Jan 15, 2025). ### 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.15 ### Cloud or Self Hosted Cloud ### Steps to reproduce When the Agent uses the DeepSeek V3 Chat model, all tool executions will continue until the maximum number of iterations is reached. use DeepSeek V3 Chat ![圖片](https://github.com/user-attachments/assets/cc882091-41cf-4bea-b129-2291c285a756) use gpt-4o-mini ![圖片](https://github.com/user-attachments/assets/60d38b5c-d419-4d18-91a2-b09a460f263e) use mistral-large ![圖片](https://github.com/user-attachments/assets/75e60933-c8e5-473d-b4ff-a723003cd1d1) ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:22:08 -05:00
yindo closed this issue 2026-02-21 18:22:08 -05:00
Author
Owner

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

The issue you're experiencing with the DeepSeek V3 Chat model, where tool invocations continue until the maximum number of iterations is reached, might be related to the default iteration limit set for tool invocations. In the DeepSeek V3 Chat model, the default iteration limit is set to 5, as specified in the DEFAULT_AGENT_SETTING configuration [1].

This behavior could be due to the model not receiving the expected results from the tool invocations, causing it to retry until the maximum iteration limit is reached. It's important to ensure that the tools being invoked are functioning correctly and returning the expected results to prevent unnecessary retries.

Additionally, specific logging is implemented for tracking tool invocation counts, which might help in diagnosing the issue. The tool_model_invokes table logs various details about tool invocations, which could provide insights into why the invocations are not behaving as expected [2].

If the issue persists, reviewing the error handling and logging mechanisms in place for tool invocation failures might also be beneficial, as they can provide more detailed information on any errors encountered during the process [3][4].

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 (Jan 15, 2025): <!-- Answer --> The issue you're experiencing with the DeepSeek V3 Chat model, where tool invocations continue until the maximum number of iterations is reached, might be related to the default iteration limit set for tool invocations. In the DeepSeek V3 Chat model, the default iteration limit is set to 5, as specified in the `DEFAULT_AGENT_SETTING` configuration <sup>[[1]](https://github.com/langgenius/dify/blob/main/web/config/index.ts)</sup>. This behavior could be due to the model not receiving the expected results from the tool invocations, causing it to retry until the maximum iteration limit is reached. It's important to ensure that the tools being invoked are functioning correctly and returning the expected results to prevent unnecessary retries. Additionally, specific logging is implemented for tracking tool invocation counts, which might help in diagnosing the issue. The `tool_model_invokes` table logs various details about tool invocations, which could provide insights into why the invocations are not behaving as expected <sup>[[2]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/c71211c8f604_add_tool_invoke_model_log.py)</sup>. If the issue persists, reviewing the error handling and logging mechanisms in place for tool invocation failures might also be beneficial, as they can provide more detailed information on any errors encountered during the process <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/tools/tool_engine.py)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/tools/utils/model_invocation_utils.py)</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/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=other)</sup>
Author
Owner

@kevintsai1202 commented on GitHub (Jan 15, 2025):

The issue you're experiencing with the DeepSeek V3 Chat model, where tool invocations continue until the maximum number of iterations is reached, might be related to the default iteration limit set for tool invocations. In the DeepSeek V3 Chat model, the default iteration limit is set to 5, as specified in the DEFAULT_AGENT_SETTING configuration [1].

This behavior could be due to the model not receiving the expected results from the tool invocations, causing it to retry until the maximum iteration limit is reached. It's important to ensure that the tools being invoked are functioning correctly and returning the expected results to prevent unnecessary retries.

Additionally, specific logging is implemented for tracking tool invocation counts, which might help in diagnosing the issue. The tool_model_invokes table logs various details about tool invocations, which could provide insights into why the invocations are not behaving as expected [2].

If the issue persists, reviewing the error handling and logging mechanisms in place for tool invocation failures might also be beneficial, as they can provide more detailed information on any errors encountered during the process [3][4].

To continue talking to Dosu, mention @dosu.

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

Currently, testing other models capable of using function calls does not have this issue. I'm not sure if it's a problem with the model itself or the Dify program.

@kevintsai1202 commented on GitHub (Jan 15, 2025): > The issue you're experiencing with the DeepSeek V3 Chat model, where tool invocations continue until the maximum number of iterations is reached, might be related to the default iteration limit set for tool invocations. In the DeepSeek V3 Chat model, the default iteration limit is set to 5, as specified in the `DEFAULT_AGENT_SETTING` configuration [[1]](https://github.com/langgenius/dify/blob/main/web/config/index.ts). > > This behavior could be due to the model not receiving the expected results from the tool invocations, causing it to retry until the maximum iteration limit is reached. It's important to ensure that the tools being invoked are functioning correctly and returning the expected results to prevent unnecessary retries. > > Additionally, specific logging is implemented for tracking tool invocation counts, which might help in diagnosing the issue. The `tool_model_invokes` table logs various details about tool invocations, which could provide insights into why the invocations are not behaving as expected [[2]](https://github.com/langgenius/dify/blob/main/api/migrations/versions/c71211c8f604_add_tool_invoke_model_log.py). > > If the issue persists, reviewing the error handling and logging mechanisms in place for tool invocation failures might also be beneficial, as they can provide more detailed information on any errors encountered during the process [[3]](https://github.com/langgenius/dify/blob/main/api/core/tools/tool_engine.py)[[4]](https://github.com/langgenius/dify/blob/main/api/core/tools/utils/model_invocation_utils.py). > > _To continue talking to [Dosu](https://dosu.dev), mention @dosu._ > > Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/15cb8c44-1c5a-4ab2-a374-e78795132988?feedback_type=other) Currently, testing other models capable of using function calls does not have this issue. I'm not sure if it's a problem with the model itself or the Dify program.
Author
Owner

@hjlarry commented on GitHub (Jan 15, 2025):

see here https://github.com/deepseek-ai/DeepSeek-V3/issues/15

@hjlarry commented on GitHub (Jan 15, 2025): see here https://github.com/deepseek-ai/DeepSeek-V3/issues/15
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#7741