From 84a16abb4ad5dfc2c9182e1f1f4599b0f1cbffec Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 10 Apr 2025 16:31:55 +0000 Subject: [PATCH] Fix type checker errors in on_tool_use call Co-Authored-By: Joe Moura --- src/crewai/tools/tool_usage.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index cf175cea0..e03313147 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -247,7 +247,7 @@ class ToolUsage: if self.tools_handler: should_cache = True - if ( + if available_tool is not None and ( hasattr(available_tool, "cache_function") and available_tool.cache_function ): @@ -255,8 +255,9 @@ class ToolUsage: calling.arguments, result ) + output_result = "" if result is None else result self.tools_handler.on_tool_use( - calling=calling, output=result, should_cache=should_cache + calling=calling, output=output_result, should_cache=should_cache ) self._telemetry.tool_usage( llm=self.function_calling_llm,