From c7d126ade062e236f111cd77f01f248dc469087e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Tue, 22 Apr 2025 16:49:23 +0000 Subject: [PATCH] Fix tool_utils to pass original_tools to ToolUsage Co-Authored-By: Joe Moura --- src/crewai/utilities/tool_utils.py | 1 + tests/tools/test_custom_tool_invocation.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/crewai/utilities/tool_utils.py b/src/crewai/utilities/tool_utils.py index eaf065477..9f6867a25 100644 --- a/src/crewai/utilities/tool_utils.py +++ b/src/crewai/utilities/tool_utils.py @@ -60,6 +60,7 @@ def execute_tool_and_check_finality( task=task, agent=agent, action=agent_action, + original_tools=tools, # Pass original tools to ensure custom tools work ) # Parse tool calling diff --git a/tests/tools/test_custom_tool_invocation.py b/tests/tools/test_custom_tool_invocation.py index bd1149946..6f8b1e935 100644 --- a/tests/tools/test_custom_tool_invocation.py +++ b/tests/tools/test_custom_tool_invocation.py @@ -57,12 +57,16 @@ def test_custom_tool_invocation(): ) i18n = I18N() + + mock_agent.key = "test_agent" + mock_agent.role = "test_role" + result = execute_tool_and_check_finality( agent_action=action, tools=[custom_tool], i18n=i18n, - agent_key=mock_agent.key if hasattr(mock_agent, "key") else None, - agent_role=mock_agent.role if hasattr(mock_agent, "role") else None, + agent_key=mock_agent.key, + agent_role=mock_agent.role, tools_handler=tools_handler, task=mock_task, agent=mock_agent,