Skip to content

refactor(python): type google adk class swaps - #1505

Merged
greysonlalonde merged 3 commits into
NVIDIA:mainfrom
greysonlalonde:refactor/google-adk-swap-typing
Oct 26, 2026
Merged

greysonlalonde merged 3 commits into
NVIDIA:mainfrom
greysonlalonde:refactor/google-adk-swap-typing

Conversation

@greysonlalonde

@greysonlalonde greysonlalonde commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Overview

This change improves type checking for the Google ADK integration. It helps the type checker match each wrapped method to the correct Google ADK class.

No user-facing behavior changes are expected.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Add a shared type for wrapped method groups.
  • Apply the type across models, providers, tools, and workflow nodes.
  • Handle agent roots separately from other workflow roots.

Where should the reviewer start?

Start in python/nemo_relay/integrations/google_adk/_swap.py with the Methods and _Builder type aliases.

Next, review observe_root, _root_methods, and _agent_root_methods in python/nemo_relay/integrations/google_adk/_root.py.

Summary by CodeRabbit

  • Bug Fixes
    • Agent root nodes in the Google ADK integration now use asynchronous execution. Other root nodes continue to use their existing execution behavior, preserving their established handling while aligning agent nodes with the asynchronous run path.

- type swap method sets as `Methods[Cls]` so each replacement takes its class as `self`
- split root swaps into node and agent builders

Signed-off-by: Greyson Lalonde <[email protected]>
@greysonlalonde greysonlalonde self-assigned this Oct 25, 2026
@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 2d3974f and 247686b.

Files selected for processing: 9
  • python/nemo_relay/integrations/google_adk/_backends/_anthropic.py
  • python/nemo_relay/integrations/google_adk/_backends/_apigee.py
  • python/nemo_relay/integrations/google_adk/_backends/_gemini.py
  • python/nemo_relay/integrations/google_adk/_backends/_openai.py
  • python/nemo_relay/integrations/google_adk/_models.py
  • python/nemo_relay/integrations/google_adk/_nodes.py
  • python/nemo_relay/integrations/google_adk/_root.py
  • python/nemo_relay/integrations/google_adk/_swap.py
  • python/nemo_relay/integrations/google_adk/_tools.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.

Recent review details
Context from checks skipped due to timeout: 14
  • GitHub Check: Python / Package (linux-musl-arm64)
  • GitHub Check: Python / Package (linux-amd64)
  • GitHub Check: Python / Package (linux-musl-amd64)
  • GitHub Check: Python / Package (windows-arm64)
  • GitHub Check: Python / Package (windows-amd64)
  • GitHub Check: Python / Test (linux-arm64)
  • GitHub Check: Python / Package (linux-arm64)
  • GitHub Check: Python / Package (macos-arm64)
  • GitHub Check: Python / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-arm64)
  • GitHub Check: Python / Test (windows-amd64)
  • GitHub Check: Python / Test (macos-arm64)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
Additional context used
Code guidelines: 1
.agents/skills/contribute-integration/SKILL.md — configured
Path-based instructions: 2
Review Python wrapper changes for typed API consistency, contextvars-based scope isolation, async behavior, and parity with the native extension.

CodeRabbit configuration file

Files:

  • python/nemo_relay/integrations/google_adk/_backends/_gemini.py
  • python/nemo_relay/integrations/google_adk/_backends/_anthropic.py
  • python/nemo_relay/integrations/google_adk/_nodes.py
  • python/nemo_relay/integrations/google_adk/_backends/_apigee.py
  • python/nemo_relay/integrations/google_adk/_models.py
  • python/nemo_relay/integrations/google_adk/_tools.py
  • python/nemo_relay/integrations/google_adk/_root.py
  • python/nemo_relay/integrations/google_adk/_swap.py
  • python/nemo_relay/integrations/google_adk/_backends/_openai.py
Source excerpt: Keep NeMo Relay optional Source excerpt: Use stable, documented framework or plugin APIs Source excerpt: Wrap tool and LLM paths at the correct framework boundary Source excerpt: Preserve the framework's original behavior wh...

CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)

Files:

  • python/nemo_relay/integrations/google_adk/_backends/_gemini.py
  • python/nemo_relay/integrations/google_adk/_backends/_anthropic.py
  • python/nemo_relay/integrations/google_adk/_nodes.py
  • python/nemo_relay/integrations/google_adk/_backends/_apigee.py
  • python/nemo_relay/integrations/google_adk/_models.py
  • python/nemo_relay/integrations/google_adk/_tools.py
  • python/nemo_relay/integrations/google_adk/_root.py
  • python/nemo_relay/integrations/google_adk/_swap.py
  • python/nemo_relay/integrations/google_adk/_backends/_openai.py
Additional comments: 9
python/nemo_relay/integrations/google_adk/_swap.py: 1

16-17: LGTM!

Also applies to: 23-23, 38-38, 42-42

python/nemo_relay/integrations/google_adk/_backends/_anthropic.py: 1

35-35: LGTM!

python/nemo_relay/integrations/google_adk/_backends/_apigee.py: 1

16-16: LGTM!

python/nemo_relay/integrations/google_adk/_backends/_gemini.py: 1

25-25: LGTM!

Also applies to: 28-28

python/nemo_relay/integrations/google_adk/_backends/_openai.py: 1

27-27: LGTM!

Also applies to: 30-30

python/nemo_relay/integrations/google_adk/_models.py: 1

29-29: LGTM!

python/nemo_relay/integrations/google_adk/_nodes.py: 1

29-29: LGTM!

Also applies to: 52-52

python/nemo_relay/integrations/google_adk/_tools.py: 1

18-18: LGTM!

Also applies to: 94-94

python/nemo_relay/integrations/google_adk/_root.py: 1

32-35: LGTM!

Also applies to: 38-38, 47-47, 50-50, 60-60

Walkthrough

The Google ADK integration replaces broad method-mapping annotations with instance-aware Methods types. Root observation now selects separate method sets for agents and non-agents.

Changes

Google ADK method integration

Layer / File(s) Summary
:--- :---
Typed method mapping contract
python/nemo_relay/integrations/google_adk/_swap.py
Method mappings and builder callbacks now use instance-aware callable types.
Typed method factories
python/nemo_relay/integrations/google_adk/_backends/*, python/nemo_relay/integrations/google_adk/_models.py, python/nemo_relay/integrations/google_adk/_nodes.py, python/nemo_relay/integrations/google_adk/_tools.py
Backend, model, node, and tool method factories now declare their corresponding Methods return types.
Root method selection
python/nemo_relay/integrations/google_adk/_root.py
Root observation selects agent-specific or non-agent method sets. The agent method set combines the base root methods with a wrapped run_async method.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related PRs

  • NVIDIA/NeMo-Relay#1498: Updates repository type annotations, which this PR continues in the Google ADK integration.
Merge Risk: Minimal · up to 24768

The change is limited to typing and preserves the existing Google ADK wrapper behavior, so it is mergeable with normal checks.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 33 functions across 9 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title follows Conventional Commits format, uses the allowed lowercase type and scope, summarizes the type-checking refactor, stays under 72 characters, and has no trailing period.
Description check Passed The description explains the objective, implementation details, expected behavior, review starting points, and both overview confirmations. It omits the template's Related Issues section, but the desc…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the objective, implementation details, expected behavior, review starting points, and both overview confirmations. It omits the template's Related Issues section, but the description is otherwise complete and relevant.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added size:S PR is small Improvement improvement to existing functionality lang:python PR changes/introduces Python code labels Oct 25, 2026
@github-actions

Copy link
Copy Markdown

@greysonlalonde greysonlalonde added this to the 0.11 milestone Oct 26, 2026
@greysonlalonde
greysonlalonde marked this pull request as ready for review October 26, 2026 19:02
@greysonlalonde
greysonlalonde requested a review from a team as a code owner October 26, 2026 19:02
@greysonlalonde
greysonlalonde enabled auto-merge (squash) October 26, 2026 19:06
@greysonlalonde
greysonlalonde merged commit 2fd4e94 into NVIDIA:main Oct 26, 2026
47 checks passed

This branch was previously deployed

1 inactive deployment
fern — 247686bd Deployed Oct 26, 2026 by greysonlalonde via Clean up docs preview #6619
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Improvement improvement to existing functionality lang:python PR changes/introduces Python code size:S PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants