-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Fix tool remembering to avoid spamming it #3073
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
base: main
Are you sure you want to change the base?
Conversation
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #3073OverviewThis pull request primarily modifies the tool remembering functionality within the CrewAI framework, enhancing how tools are tracked and remembered during agent execution. This change is crucial as it improves user interactions with the system by making the cognitive load lighter and interactions more informative. Positive Changes
Areas for ImprovementWhile the improvements in functionality and maintainability are noted, there are several key areas where the proposed changes could be enhanced:
ConclusionThe changes in this PR are a solid step forward for the CrewAI framework. Addressing the highlighted issues—such as magic numbers, documentation, type hints, and error handling—will further enhance the quality and maintainability of the code, ensuring a robust tool usage feature. Once these suggestions are implemented, I believe the PR will be ready for approval. |
Hey @vria, this looks really interesting! I do have a few code concerns, but let's first focus on the issue you're trying to solve. Honestly, I hadn't noticed this behavior before - probably because I rarely use more than 3 tasks per agent (i'm not sure), anyway.. Could you share a bit more detail? Maybe include the LLM message logs, before and after your suggested changes. That would really help clarify the issue and give us some concrete artifacts to work with. |
Hi @lucasgomide, This is a dummy task to create 10 files. You can observe that:
We can refactor it further and exclude "You ONLY have access to the following tools..." from the first system message when we decide to put the reminder in the last message. Yes, as I have mentioned this is not very elaborate PR because I'd like to validate the approach before doing it properly. |
@vria just Just so you know, I'm talking to the internal team to get their feedback on this, since they might have more context than I do. I will back with them soon! |
Currently, there is an annoying feature to remember available tools in message history. In a typical task that requires extensive use of tools, this remembering leads to excessively repeated "You ONLY have access to the following tools..." messages. This clutters the input and distract the model from the main task.
In this PR, I propose a solution with minimal disruption to the existing behavior. In particular, once tool remembering is needed (
tool usage count > 3
), the recall message will always appear only once as the last message.N.B. This PR is intended to start a discussion. I will refine it and add/correct tests once we agree on the solution.