Skip to content

Commit f358194

Browse files
ted-taiDwij1704
andauthored
Prevent errors when instrumenting an agent using MCPToolset (#1147)
Co-authored-by: Dwij <[email protected]>
1 parent 2ec6e79 commit f358194

File tree

1 file changed

+4
-2
lines changed
  • agentops/instrumentation/agentic/google_adk

1 file changed

+4
-2
lines changed

agentops/instrumentation/agentic/google_adk/patch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,10 @@ def extract_agent_attributes(instance):
360360
attributes["agent.instruction"] = instance.instruction
361361
if hasattr(instance, "tools"):
362362
for tool in instance.tools:
363-
attributes[ToolAttributes.TOOL_NAME] = tool.name
364-
attributes[ToolAttributes.TOOL_DESCRIPTION] = tool.description
363+
if hasattr(tool, "name"):
364+
attributes[ToolAttributes.TOOL_NAME] = tool.name
365+
if hasattr(tool, "description"):
366+
attributes[ToolAttributes.TOOL_DESCRIPTION] = tool.description
365367
if hasattr(instance, "output_key"):
366368
attributes["agent.output_key"] = instance.output_key
367369
# Subagents

0 commit comments

Comments
 (0)