Fix: Add cache_function of a CrewStructuredTool #3078
+4
−0
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.
Problem
When tools are added,
cache_function
parameter is silently dropped. This is becauseBaseTool
is converted toCrewStructuredTool
and the latter does not containcache_function
. As a result, tools likelist_directory
appear to be permanently cached, regardless of configuration.This is a huge problem to my flow because an agent verifies the existence of newly created files and directories. It calls
list_directory
tool with the same arguments at different points in time, expecting different results. Due to caching, the result never changes.Solution
Add
cache_function
to CrewStructuredTool.Test case
Tool:
Task:
before.log
after.log