From 6ef3257a02178d44304145634eca8d7b5106e142 Mon Sep 17 00:00:00 2001 From: Ted Piotrowski Date: Sun, 13 Jul 2025 18:32:34 -0700 Subject: [PATCH] Prevent errors when instrumenting an agent using MCPToolset --- agentops/instrumentation/agentic/google_adk/patch.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/agentops/instrumentation/agentic/google_adk/patch.py b/agentops/instrumentation/agentic/google_adk/patch.py index 88d9aa2df..7fd2a79f8 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