Add hard limit of tool usage. #1641

Closed
opened 2026-02-21 17:36:05 -05:00 by yindo · 0 comments
Owner

Originally created by @YuanfengZhang on GitHub (Mar 28, 2024).

Self Checks

  • 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).
  • Pleas do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing?

When tools are included in the assistant, it may use tools multiple times and even loops forever. I have tried limiting the usage in instrution, but sometime it doesn't work very well.

2. Describe the feature you'd like to see

For tools, especially paid ones, add a parameter in setting, refuse the requests from assistant after certain tries (e.g. send fake 404 error back).

3. How will this feature improve your workflow or experience?

Hard limit will strongly prevent unexpected api consumption and block from providers. For example, some searching tools would block IP addresses with frequent requests. But the LLM assistant won't listen.

4. Additional context or comments

This behavior has been observed on Llama2, Mistral, Phi and so on. I believe this could influence many people.

5. Can you help us with this feature?

  • I am interested in contributing to this feature.
Originally created by @YuanfengZhang on GitHub (Mar 28, 2024). ### Self Checks - [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] Pleas do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? When tools are included in the assistant, it may use tools multiple times and even loops forever. I have tried limiting the usage in instrution, but sometime it doesn't work very well. ### 2. Describe the feature you'd like to see For tools, especially paid ones, add a parameter in setting, refuse the requests from assistant after certain tries (e.g. send fake 404 error back). ### 3. How will this feature improve your workflow or experience? Hard limit will strongly prevent unexpected api consumption and block from providers. For example, some searching tools would block IP addresses with frequent requests. But the LLM assistant won't listen. ### 4. Additional context or comments This behavior has been observed on Llama2, Mistral, Phi and so on. I believe this could influence many people. ### 5. Can you help us with this feature? - [ ] I am interested in contributing to this feature.
yindo added the 💪 enhancement label 2026-02-21 17:36:05 -05:00
yindo closed this issue 2026-02-21 17:36:05 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#1641