fix(weave): support google-adk 2.3.0+ trace_inference_result signature#7560
Merged
Conversation
ADK prepended a leading invocation_context argument to trace_inference_result in 2.3.0, turning (span, llm_response) into (invocation_context, span, llm_response). The wrapper still called the original with the old 2-arg form, so every inference against google-adk >=2.3.0 (e.g. 2.4.0) raised TypeError. Forward *args verbatim to the same-version original and read the span and response off the tail two positions, whose relative order is stable across both shapes. Works for ADK >=1.36 without a signature mismatch.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
The *args-based wrapper lost the concrete types of span and llm_response, so mypy flagged .partial access and the _unwrap_inference_span / set_llm_response_attributes calls as object-typed. Cast the tail two positional args to their known types (ADK only prepended invocation_context; span/llm_response keep their relative order).
gtarpenning
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Weave's Google ADK integration is incompatible with
google-adk >= 2.3.0(including 2.4.0). ADK prepended a leadinginvocation_contextargument totrace_inference_resultin 2.3.0:trace_inference_result(span, llm_response)trace_inference_result(invocation_context, span, llm_response)_wrap_trace_inference_resultstill declared and called the original with the old 2-arg form (original(span, llm_response)), so once Weave's patch is applied on ADK ≥ 2.3.0, every ADK inference raisesTypeError. The test shard installsgoogle-adk>=2.2.0, which now resolves to 2.4.0.Fix
weave/integrations/google_adk/google_adk_sdk.py:*argsand forwards them verbatim to the same-version original — so it calls ADK with exactly the arguments ADK handed it, regardless of shape.args[-2],args[-1]). ADK keptspanandllm_responsein the same relative order and only prependedinvocation_context, so tail-based extraction is correct for both the 2-arg and 3-arg forms. ADK always calls this function positionally, so*argscaptures every case._TraceInferenceResultis broadened to the openCallable[..., None], matching the existing_TraceToolCallpattern already used in this file for ADK's cross-release signature churn.This keeps compatibility with ADK
>= 1.36— no version sniffing required.Testing
test_trace_inference_result_supports_3arg_signature— drives the wrapper with the new 3-arg shape, asserts the leading arg is forwarded to the original and the span is still enriched from the trailing response.google_adkshard installsgoogle-adk 2.4.0(the exact 3-arg version from the report), andTestAdkRunnerE2E::test_emits_all_otel_attributes— which drives a real ADKInMemoryRunnerthrough a full inference loop — passes. On the old code this test raisedTypeErroron every inference.Lint (
ruff check) passes on both changed files.🤖 Opened by Fixit
Requested by: Emmanuel Turlay
Slack thread: https://weightsandbiases.slack.com/archives/C0APFJB2H5E/p1783722806526949
View session: https://fixit.withwandb.com/session/fix-6a51734a-f9df9fc3