mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-02 07:42:40 +00:00
Fix issue #2434: Allow tools to specify if they permit repeated usage
Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
@@ -279,6 +279,10 @@ class ToolUsage:
|
||||
if not self.tools_handler:
|
||||
return False # type: ignore # No return value expected
|
||||
if last_tool_usage := self.tools_handler.last_used_tool:
|
||||
tool = self._select_tool(calling.tool_name)
|
||||
# If the tool allows repeated usage, don't check arguments
|
||||
if getattr(tool, "allow_repeated_usage", False):
|
||||
return False # type: ignore # No return value expected
|
||||
return (calling.tool_name == last_tool_usage.tool_name) and ( # type: ignore # No return value expected
|
||||
calling.arguments == last_tool_usage.arguments
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user