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,