-
Notifications
You must be signed in to change notification settings - Fork 4.6k
feat: support tool-specific call limits #5248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
tian44200
wants to merge
49
commits into
agno-agi:main
Choose a base branch
from
tian44200:feat/single-tool-call-limit
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Feature: Add tool-specific call limits
(Currently, we only have
tool_call_limitthat applies to the total count across all tools, not for individual tools.)Why this feature: The query "search for Sherlock Holmes in the knowledge base" might trigger the
search_knowledgetool up to 8 times in a single run. But we might only want it once in some cases. See more details in link to discord discussion.Changes:
This PR only covers the following for now:
call_limitfor Function typesearch_knowledge_call_limitforAgent(..)This PR does not cover:
read_chat_history,update_knowledge...)To be discussed:
As mentioned in Discord, the DX need to be discussed. The current implementation is just a suggestion and can be changed:
Small Note: I noticed that
continue_run/acontinue_runactually resetstool_call_limit. Not sure if this is intended. This PR also followed the same implementation logic, but if not, the issue can be handled in a later PR or this if needed.Type of change
Checklist
./scripts/format.shand./scripts/validate.sh)Additional Notes
The actual implementation follows the logic of the existing
tool_call_limitlogic so it should be safe.I also tested on my personal project.
For
search_knowledge_call_limit=1andquery="search for reinforcement learning and tabular reinforcement learning":[ {'id': 'd3e1857c1f6c4cf0bc7e9a4cb3c7fb1b', 'type': 'function', 'function': {'name': 'search_knowledge_base', 'arguments': '{"query": "reinforcement learning"}'}}, {'id': 'ad3a3b6703ac4022ba4f1ad5cd766c75', 'type': 'function', 'function': {'name': 'search_knowledge_base', 'arguments': '{"query": "tabular reinforcement learning}'}}]}, {'role': 'tool', 'content': "Call limit reached for search_knowledge_base. Don't try to execute this tool again.", 'tool_call_id': 'ad3a3b6703ac4022ba4f1ad5cd766c75'}, {'role': 'tool', 'content':'[\n {\n "content" ...', 'tool_call_id': 'd3e1857c1f6c4cf0bc7e9a4cb3c7fb1b' }, ... ]