From fc81156cf64491f101c99395b527abd78872cdd5 Mon Sep 17 00:00:00 2001 From: Pratyush Shukla Date: Sun, 2 Feb 2025 21:38:01 +0530 Subject: [PATCH] add `ToolEvent` recording --- src/crewai/tools/tool_usage.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/crewai/tools/tool_usage.py b/src/crewai/tools/tool_usage.py index f813a0d99..9ef1c9fdd 100644 --- a/src/crewai/tools/tool_usage.py +++ b/src/crewai/tools/tool_usage.py @@ -251,6 +251,24 @@ class ToolUsage: agentops=agentops, ) + if agentops: + agentops.record( + agentops.ToolEvent( + params=calling.arguments, + returns=result, + name=tool.name, + logs={ + "tool_string": tool_string, + "tool": tool, + "tool_calling": calling, + "run_attempts": self._run_attempts, + "llm": self.function_calling_llm, + "task": self.task, + "agent": self.agent, + }, + ) + ) + self._telemetry.tool_usage( llm=self.function_calling_llm, tool_name=tool.name,