Skip to content

fix(google-adk): support GenAI 2.x and modular tracing - #270

Closed
jabrailkhalil wants to merge 3 commits into
future-agi:mainfrom
jabrailkhalil:fix/google-adk-genai-v2
Closed

jabrailkhalil wants to merge 3 commits into
future-agi:mainfrom
jabrailkhalil:fix/google-adk-genai-v2

Conversation

@jabrailkhalil

Copy link
Copy Markdown
Contributor

What does this PR do?

Fixes #269. Supports GenAI 2.x alongside 1.x and the modular tracing layout in Google ADK 2.12. Normal installation with ADK 2.7.1 currently fails dependency resolution; with ADK 2.12, supplying dependencies still leaves instrument() failing on the removed base_llm_flow.trace_call_llm binding.

Why?

Agent Learning Kit's hosted image already works around the dependency conflict with --no-deps. The adapter should install and trace a supported ADK through ordinary dependency resolution.

  • Accepts google-genai>=1,<3; Poetry 2.0.1 refreshed only the lock content hash, preserving existing locked versions.
  • Selects the imported model-call and parallel-tool bindings in either the older or modular layout.
  • Saves/restores the exact original LLM tracer and callback. Adds explicit start_span() handling to passthrough/selective tracers so SDK cleanup cannot end an outer wrapper's recording span; tool spans still use the configured provider.

How was it tested?

Linux CI and complete artifacts check out 208329d3dec4d8c51d5255332e43e479967b6fff directly and cover:

Google ADK Google GenAI Result
1.32.0 1.75.0 26 passed, 0 skipped
2.7.1 2.12.1 26 passed, 0 skipped
2.12.0 2.31.0 26 passed, 0 skipped

Four new integration cases use real LlmAgent, InMemoryRunner, function tools and OTel spans with a scripted local model. They cover single/parallel tool calls, model errors, tool-result delivery, token usage, span counts/correlation and exact uninstrumentation. Two additional cases check passthrough span ownership. The existing 20 Google ADK tests run alongside them.

The legacy mock-only tests now restore their singleton overrides with monkeypatch; CI runs them before the real integration cases to check test isolation.

  • Both GenAI 2.x jobs reproduce the original dependency-resolution failure; the 1.x job is a passing control.

  • Restoring the original adapter while keeping the new tests produces failures; each before/after report is included.

  • pip check, wheel build, Ruff correctness checks, Black and Mypy 1.18.2 pass in all three jobs.

  • Local Windows / Python 3.12 / ADK 2.12.0 / GenAI 2.31.0 also passes all 26 tests. poetry check --lock passes with existing metadata deprecation warnings.

  • A local composition of this patch with fix(google-adk): preserve async stream lifecycle and tracing context #268 passes all 52 Google ADK tests on ADK 2.12.0 / GenAI 2.31.0, with the legacy tests running first.

  • Unit and offline integration tests added.

  • README and changelog updated.

  • Branch off main; conventional commits; no API keys, TODOs or commented-out code.

Notes for reviewers

Related #268 handles stream lifecycle. This PR changes dependency and tracing setup compatibility. The adapter still hooks ADK's internal tracing bindings; future SDK reorganizations may need another compatibility update. Live Gemini/provider calls were not tested. No release/version bump is included.

Implementation and regression tests written with an OpenAI assistant under my supervision.

@jabrailkhalil

Copy link
Copy Markdown
Contributor Author

I checked #445 on current dev: installation accepts GenAI 2.x, and the native tracer adapter no longer relies on the removed base_llm_flow bindings. The maintained suite passes on ADK 1.2.1 / GenAI 1.75.0 and ADK 2.13.0 / GenAI 2.34.0 with both telemetry schemas: validation. I'm closing this older compatibility patch as superseded.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Google ADK 2.x installation conflicts and modular tracing setup fails

1 participant