Skip to content

Conversation

@willkill07
Copy link
Member

@willkill07 willkill07 commented Oct 7, 2025

Description

Based on feedback from TMEs and SAs, move the sample ADK agent back to the ADK example.

Closes

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Summary by CodeRabbit

  • Tests

    • Expanded ADK framework coverage across key test flows, added import guards and ADK-specific branches, and streamlined ADK result handling.
    • Removed outdated ADK integration tests to reduce flakiness.
  • Chores

    • Adjusted ADK-related imports: enabled ADK agent usage in the demo while removing an unused ADK dependency elsewhere to simplify the dependency graph.
  • Refactor

    • Tightened ADK-related type annotations for clearer test interfaces without changing public behavior.

@willkill07 willkill07 requested a review from a team as a code owner October 7, 2025 20:21
@coderabbitai
Copy link

coderabbitai bot commented Oct 7, 2025

Walkthrough

Adds a local agent import to the ADK demo register, removes agent import from the core ADK plugin register, updates tests to add an ADK LLM invocation branch (and parameterization) while removing prior ADK function-integration tests, and tightens an ADK test method type annotation.

Changes

Cohort / File(s) Summary
ADK demo register import
examples/frameworks/adk_demo/src/nat_adk_demo/register.py
Added local import from . import agent.
Core ADK plugin register cleanup
packages/nvidia_nat_adk/src/nat/plugins/adk/register.py
Removed agent import; retained other imports (adk_callback_handler, llm, tool_wrapper).
Tests — add ADK LLM path & remove ADK integration tests
packages/nvidia_nat_test/tests/test_test_llm.py
Removed ADK-specific function-integration tests and related imports; added ADK branch to YAML/config-driven and programmatic tests (parameterization includes ADK), used pytest.importorskip("google.adk") when ADK selected, and implemented ADK-specific async result gathering via generate_content_async.
Tests — ADK test LLM signature change
packages/nvidia_nat_test/src/nat/test/llm.py
Tightened ADKTestLLM.generate_content_async parameter type from Any to google.adk.models.llm_request.LlmRequest (return type unchanged).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Test as Test Suite
  participant Wrapper as ADK Wrapper
  participant ADK as google.adk LLM

  Note over Test,Wrapper: iterate sequence items (e.g. "u","v","w")
  Test->>Wrapper: invoke/request per-item
  Wrapper->>ADK: generate_content_async(LlmRequest)
  ADK-->>Wrapper: stream of LlmResponse
  Wrapper-->>Test: collected text outputs (assert/append)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

improvement, non-breaking

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly describes the main change by stating “move Google ADK agent example back to ADK example,” uses the imperative mood with a concise verb form, and falls under the 72-character limit, making it both descriptive and properly formatted.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f5757a and c6a9d77.

📒 Files selected for processing (4)
  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py (1 hunks)
  • packages/nvidia_nat_adk/src/nat/plugins/adk/register.py (0 hunks)
  • packages/nvidia_nat_test/src/nat/test/llm.py (2 hunks)
  • packages/nvidia_nat_test/tests/test_test_llm.py (3 hunks)
💤 Files with no reviewable changes (1)
  • packages/nvidia_nat_adk/src/nat/plugins/adk/register.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/nvidia_nat_test/tests/test_test_llm.py
  • packages/nvidia_nat_test/src/nat/test/llm.py
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{py,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)

**/*.{py,yaml,yml}: Configure response_seq as a list of strings; values cycle per call, and [] yields an empty string.
Configure delay_ms to inject per-call artificial latency in milliseconds for nat_test_llm.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)

**/*.py: Programmatic use: create TestLLMConfig(response_seq=[...], delay_ms=...), add with builder.add_llm("", cfg).
When retrieving the test LLM wrapper, use builder.get_llm(name, wrapper_type=LLMFrameworkEnum.) and call the framework’s method (e.g., ainvoke, achat, call).

**/*.py: In code comments/identifiers use NAT abbreviations as specified: nat for API namespace/CLI, nvidia-nat for package name, NAT for env var prefixes; do not use these abbreviations in documentation
Follow PEP 20 and PEP 8; run yapf with column_limit=120; use 4-space indentation; end files with a single trailing newline
Run ruff check --fix as linter (not formatter) using pyproject.toml config; fix warnings unless explicitly ignored
Respect naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: use bare raise to re-raise; log with logger.error() when re-raising to avoid duplicate stack traces; use logger.exception() when catching without re-raising
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise and ending with a period; surround code entities with backticks
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile or mprof before optimizing; cache expensive computations with functools.lru_cache or external cache; leverage NumPy vectorized operations when beneficial

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
**/*

⚙️ CodeRabbit configuration file

**/*: # Code Review Instructions

  • Ensure the code follows best practices and coding standards. - For Python code, follow
    PEP 20 and
    PEP 8 for style guidelines.
  • Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
    Example:
    def my_function(param1: int, param2: str) -> bool:
        pass
  • For Python exception handling, ensure proper stack trace preservation:
    • When re-raising exceptions: use bare raise statements to maintain the original stack trace,
      and use logger.error() (not logger.exception()) to avoid duplicate stack trace output.
    • When catching and logging exceptions without re-raising: always use logger.exception()
      to capture the full stack trace information.

Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any

words listed in the ci/vale/styles/config/vocabularies/nat/reject.txt file, words that might appear to be
spelling mistakes but are listed in the ci/vale/styles/config/vocabularies/nat/accept.txt file are OK.

Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,

and should contain an Apache License 2.0 header comment at the top of each file.

  • Confirm that copyright years are up-to date whenever a file is changed.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
examples/**/*

⚙️ CodeRabbit configuration file

examples/**/*: - This directory contains example code and usage scenarios for the toolkit, at a minimum an example should
contain a README.md or file README.ipynb.

  • If an example contains Python code, it should be placed in a subdirectory named src/ and should
    contain a pyproject.toml file. Optionally, it might also contain scripts in a scripts/ directory.
  • If an example contains YAML files, they should be placed in a subdirectory named configs/. - If an example contains sample data files, they should be placed in a subdirectory named data/, and should
    be checked into git-lfs.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
🔇 Additional comments (1)
examples/frameworks/adk_demo/src/nat_adk_demo/register.py (1)

19-21: Approve addition of agent import

The agent.py module exists and follows the established pattern.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@willkill07 willkill07 added improvement Improvement to existing functionality non-breaking Non-breaking change labels Oct 7, 2025
@willkill07 willkill07 self-assigned this Oct 7, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
examples/frameworks/adk_demo/src/nat_adk_demo/register.py (2)

15-21: Consider adding a module docstring.

Per coding guidelines, public modules should have Google-style docstrings. A brief description would clarify this module's purpose as a registration/re-export point.

Example:

 # limitations under the License.
+
+"""Registration module for ADK demo components.
+
+This module re-exports the agent, tools, and other components
+for convenient access via the nat_adk_demo package.
+"""

 # pylint: disable=unused-import

19-19: Agent module import is valid

  • The file examples/frameworks/adk_demo/src/nat_adk_demo/agent.py exists; the from . import agent statement is correct and ordered.
  • Consider adding a module‐level docstring to register.py to document its public API.
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6461d86 and 4274b78.

📒 Files selected for processing (3)
  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py (1 hunks)
  • packages/nvidia_nat_adk/src/nat/plugins/adk/register.py (0 hunks)
  • packages/nvidia_nat_test/tests/test_test_llm.py (2 hunks)
💤 Files with no reviewable changes (1)
  • packages/nvidia_nat_adk/src/nat/plugins/adk/register.py
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{py,yaml,yml}

📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)

**/*.{py,yaml,yml}: Configure response_seq as a list of strings; values cycle per call, and [] yields an empty string.
Configure delay_ms to inject per-call artificial latency in milliseconds for nat_test_llm.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
  • packages/nvidia_nat_test/tests/test_test_llm.py
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)

**/*.py: Programmatic use: create TestLLMConfig(response_seq=[...], delay_ms=...), add with builder.add_llm("", cfg).
When retrieving the test LLM wrapper, use builder.get_llm(name, wrapper_type=LLMFrameworkEnum.) and call the framework’s method (e.g., ainvoke, achat, call).

**/*.py: In code comments/identifiers use NAT abbreviations as specified: nat for API namespace/CLI, nvidia-nat for package name, NAT for env var prefixes; do not use these abbreviations in documentation
Follow PEP 20 and PEP 8; run yapf with column_limit=120; use 4-space indentation; end files with a single trailing newline
Run ruff check --fix as linter (not formatter) using pyproject.toml config; fix warnings unless explicitly ignored
Respect naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: use bare raise to re-raise; log with logger.error() when re-raising to avoid duplicate stack traces; use logger.exception() when catching without re-raising
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise and ending with a period; surround code entities with backticks
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile or mprof before optimizing; cache expensive computations with functools.lru_cache or external cache; leverage NumPy vectorized operations when beneficial

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
  • packages/nvidia_nat_test/tests/test_test_llm.py
**/*

⚙️ CodeRabbit configuration file

**/*: # Code Review Instructions

  • Ensure the code follows best practices and coding standards. - For Python code, follow
    PEP 20 and
    PEP 8 for style guidelines.
  • Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
    Example:
    def my_function(param1: int, param2: str) -> bool:
        pass
  • For Python exception handling, ensure proper stack trace preservation:
    • When re-raising exceptions: use bare raise statements to maintain the original stack trace,
      and use logger.error() (not logger.exception()) to avoid duplicate stack trace output.
    • When catching and logging exceptions without re-raising: always use logger.exception()
      to capture the full stack trace information.

Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any

words listed in the ci/vale/styles/config/vocabularies/nat/reject.txt file, words that might appear to be
spelling mistakes but are listed in the ci/vale/styles/config/vocabularies/nat/accept.txt file are OK.

Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,

and should contain an Apache License 2.0 header comment at the top of each file.

  • Confirm that copyright years are up-to date whenever a file is changed.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
  • packages/nvidia_nat_test/tests/test_test_llm.py
examples/**/*

⚙️ CodeRabbit configuration file

examples/**/*: - This directory contains example code and usage scenarios for the toolkit, at a minimum an example should
contain a README.md or file README.ipynb.

  • If an example contains Python code, it should be placed in a subdirectory named src/ and should
    contain a pyproject.toml file. Optionally, it might also contain scripts in a scripts/ directory.
  • If an example contains YAML files, they should be placed in a subdirectory named configs/. - If an example contains sample data files, they should be placed in a subdirectory named data/, and should
    be checked into git-lfs.

Files:

  • examples/frameworks/adk_demo/src/nat_adk_demo/register.py
packages/*/tests/**/*.py

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

If a package contains Python code, include tests in a tests/ directory at the same level as pyproject.toml

Files:

  • packages/nvidia_nat_test/tests/test_test_llm.py
packages/**/*

⚙️ CodeRabbit configuration file

packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain a pyproject.toml file. - The pyproject.toml file should declare a dependency on nvidia-nat or another package with a name starting
with nvidia-nat-. This dependency should be declared using ~=<version>, and the version should be a two
digit version (ex: ~=1.0).

  • Not all packages contain Python code, if they do they should also contain their own set of tests, in a
    tests/ directory at the same level as the pyproject.toml file.

Files:

  • packages/nvidia_nat_test/tests/test_test_llm.py
🧬 Code graph analysis (1)
packages/nvidia_nat_test/tests/test_test_llm.py (2)
src/nat/builder/framework_enum.py (1)
  • LLMFrameworkEnum (19-25)
packages/nvidia_nat_test/src/nat/test/llm.py (2)
  • ainvoke (87-89)
  • ainvoke (193-195)

zhongxuanwang-nv

This comment was marked as resolved.

Copy link
Contributor

@zhongxuanwang-nv zhongxuanwang-nv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Will!

@willkill07 willkill07 force-pushed the wkk_move-adk-agent-to-example branch from 5f5757a to c6a9d77 Compare October 7, 2025 23:06
@willkill07
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit a06926e into NVIDIA:release/1.3 Oct 7, 2025
16 of 17 checks passed
@willkill07 willkill07 deleted the wkk_move-adk-agent-to-example branch October 23, 2025 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Improvement to existing functionality non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants