Skip to content

fix: replace nonexistent trace_tool_response with trace_merged_tool_calls in ADK patch#1289

Open
MaxwellCalkin wants to merge 1 commit intoAgentOps-AI:mainfrom
MaxwellCalkin:fix-adk-trace-tool-response
Open

fix: replace nonexistent trace_tool_response with trace_merged_tool_calls in ADK patch#1289
MaxwellCalkin wants to merge 1 commit intoAgentOps-AI:mainfrom
MaxwellCalkin:fix-adk-trace-tool-response

Conversation

@MaxwellCalkin
Copy link

Summary

Fix Google ADK instrumentation error on startup:

Could not wrap google.adk.telemetry.trace_tool_response: module 'google.adk.telemetry' has no attribute 'trace_tool_response'

Fixes #1257.

Problem

google.adk.telemetry.trace_tool_response does not exist in any supported version of google-adk (1.4.1+). The function was renamed to trace_merged_tool_calls with a different signature:

# Old (nonexistent):
trace_tool_response(invocation_context, event_id, function_response_event)

# Current:
trace_merged_tool_calls(response_event_id, function_response_event)

Additionally, _adk_trace_tool_call_wrapper incorrectly extracts args[0] as the tool arguments dict when it is actually the tool object. The current trace_tool_call signature is:

trace_tool_call(tool: BaseTool, args: dict, function_response_event: Event)

Changes

  • Replace _adk_trace_tool_response_wrapper with _adk_trace_merged_tool_calls_wrapper matching the trace_merged_tool_calls(response_event_id, function_response_event) signature
  • Fix _adk_trace_tool_call_wrapper to correctly extract the tool object from args[0] and tool arguments from args[1]
  • Update patch_adk() to wrap trace_merged_tool_calls instead of trace_tool_response

Test plan

  • Verify no more "Could not wrap trace_tool_response" warning on startup with google-adk >= 1.4.1
  • Verify tool call and merged tool call attributes are correctly set on spans
  • Verify existing ADK instrumentation continues to work (agent spans, LLM spans, tool spans)

…alls in ADK instrumentation

Fixes AgentOps-AI#1257.

google.adk.telemetry.trace_tool_response does not exist in any
supported version of google-adk (1.4.1+). The function was renamed to
trace_merged_tool_calls, causing a warning on startup:

  Could not wrap google.adk.telemetry.trace_tool_response: module
  "google.adk.telemetry" has no attribute "trace_tool_response"

Changes:
- Replace _adk_trace_tool_response_wrapper with
  _adk_trace_merged_tool_calls_wrapper matching the current
  trace_merged_tool_calls(response_event_id, function_response_event)
  signature
- Fix _adk_trace_tool_call_wrapper to correctly extract the tool
  object from args[0] and tool arguments from args[1], matching the
  current trace_tool_call(tool, args, function_response_event) signature
  (previously args[0] was incorrectly treated as the arguments dict)
- Update patch_adk() to wrap trace_merged_tool_calls instead of
  trace_tool_response
@chatgpt-codex-connector
Copy link

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant