From ade4e71eae067b48884a92c1e014e66b553f2f00 Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Mon, 3 Feb 2025 21:21:38 +0530 Subject: [PATCH] remove `ActionEvent` from `on_tool_use` and `on_tool_use_finished` methods --- src/crewai/agents/tools_handler.py | 14 -------------- src/crewai/tools/tool_usage.py | 13 ------------- 2 files changed, 27 deletions(-) diff --git a/src/crewai/agents/tools_handler.py b/src/crewai/agents/tools_handler.py index 4eced3f7d..140598e8c 100644 --- a/src/crewai/agents/tools_handler.py +++ b/src/crewai/agents/tools_handler.py @@ -26,20 +26,6 @@ class ToolsHandler: """Run when tool ends running.""" self.last_used_tool = calling # type: ignore # BUG?: Incompatible types in assignment (expression has type "Union[ToolCalling, InstructorToolCalling]", variable has type "ToolCalling") - if agentops: - agentops.record( - agentops.ActionEvent( - action_type="on_tool_use", - params=calling.arguments, - returns=output, - logs={ - "tool": calling.tool_name, - "tool_calling": calling, - "should_cache": should_cache, - }, - ) - ) - if self.cache and should_cache and calling.tool_name != CacheTools().name: self.cache.add( tool=calling.tool_name, diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index 9ef1c9fdd..31e4d141e 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -525,19 +525,6 @@ class ToolUsage: } ) - if agentops: - agentops.record( - agentops.ActionEvent( - action_type="on_tool_use_finished", - params=tool_calling.arguments, - returns=event_data, - logs={ - "tool": tool, - "tool_calling": tool_calling, - }, - ) - ) - events.emit(source=self, event=ToolUsageFinished(**event_data)) def _prepare_event_data(self, tool: Any, tool_calling: ToolCalling) -> dict: