Skip to content

Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI

Prevent errors when instrumenting an agent using MCPToolset (#1147)

Ted Pf358194f4451
diff --git a/agentops/instrumentation/agentic/google_adk/patch.py b/agentops/instrumentation/agentic/google_adk/patch.py
index 88d9aa2d..7fd2a79f 100644
--- a/agentops/instrumentation/agentic/google_adk/patch.py
+++ b/agentops/instrumentation/agentic/google_adk/patch.py
@@ -360,8 +360,10 @@ def extract_agent_attributes(instance):
attributes["agent.instruction"] = instance.instruction
if hasattr(instance, "tools"):
for tool in instance.tools:
- attributes[ToolAttributes.TOOL_NAME] = tool.name
- attributes[ToolAttributes.TOOL_DESCRIPTION] = tool.description
+ if hasattr(tool, "name"):
+ attributes[ToolAttributes.TOOL_NAME] = tool.name
+ if hasattr(tool, "description"):
+ attributes[ToolAttributes.TOOL_DESCRIPTION] = tool.description
if hasattr(instance, "output_key"):
attributes["agent.output_key"] = instance.output_key
# Subagents