Skip to content

fix(examples-hitl): RetryReactAgent must work with function groups#1106

Merged
rapids-bot[bot] merged 1 commit intoNVIDIA:release/1.3from
willkill07:wkk_function-group-support-in-retry-react-agent
Oct 24, 2025
Merged

fix(examples-hitl): RetryReactAgent must work with function groups#1106
rapids-bot[bot] merged 1 commit intoNVIDIA:release/1.3from
willkill07:wkk_function-group-support-in-retry-react-agent

Conversation

@willkill07
Copy link
Member

@willkill07 willkill07 commented Oct 24, 2025

Description

Since ReAct Agent accepts tool_names in the form of functions or function groups, ensure that the Retry ReAct Agent (part of the HITL example) can, too.

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

  • New Features
    • Agent now supports both function groups and regular functions for tool configuration, with automatic fallback handling.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 requested a review from a team as a code owner October 24, 2025 12:35
@willkill07 willkill07 added bug Something isn't working non-breaking Non-breaking change labels Oct 24, 2025
@willkill07 willkill07 self-assigned this Oct 24, 2025
@coderabbitai
Copy link

coderabbitai bot commented Oct 24, 2025

Walkthrough

The get_temp_react_agent function now attempts to load function group configurations first via get_function_group_config and add_function_group, falling back to individual function loading via get_function_config and add_function when an exception occurs. Tool handling shifts from always treating items as individual functions to supporting both function groups and regular functions.

Changes

Cohort / File(s) Summary
Tool Loading Logic Update
examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py
Modified get_temp_react_agent to attempt function group configuration retrieval with exception-based fallback to individual function configuration instead of always loading as individual functions.

Sequence Diagram(s)

sequenceDiagram
    participant Caller
    participant get_temp_react_agent as get_temp_react_agent()
    participant get_function_group_config as get_function_group_config()
    participant get_function_config as get_function_config()
    participant add_function_group as add_function_group()
    participant add_function as add_function()

    rect rgb(220, 240, 220)
    Note over get_temp_react_agent: New Control Flow
    end

    loop for each tool in original_config.tool_names
        Caller->>get_temp_react_agent: iterate tools
        
        rect rgb(255, 245, 230)
        Note over get_temp_react_agent,add_function_group: Try Function Group First
        get_temp_react_agent->>get_function_group_config: fetch config
        alt Function group exists
            get_function_group_config-->>get_temp_react_agent: return config
            get_temp_react_agent->>add_function_group: add to agent
            add_function_group-->>get_temp_react_agent: success
        else Exception raised
            get_function_group_config-->>get_temp_react_agent: exception
            
            rect rgb(245, 230, 230)
            Note over get_temp_react_agent,add_function: Fallback to Individual Function
            get_temp_react_agent->>get_function_config: fetch config
            get_function_config-->>get_temp_react_agent: return config
            get_temp_react_agent->>add_function: add to agent
            add_function-->>get_temp_react_agent: success
            end
        end
        end
    end

    get_temp_react_agent-->>Caller: return configured agent
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)
Check name Status Explanation Resolution
Title Check ❌ Error The title is concise at 68 characters (within the ~72 character limit) and is clearly descriptive of the main change, accurately reflecting that the RetryReactAgent now supports function groups in addition to individual functions. The title is directly related to the changeset, as confirmed by both the raw summary showing support for function groups and the PR objectives describing the feature update. However, the title does not strictly follow the imperative mood requirement specified in the title_check_requirements; the phrase "must work with function groups" is written in declarative form (stating a requirement) rather than imperative form (commanding an action like "add function group support to" or "make work with"). Rephrase the title to use imperative mood while maintaining its clarity and scope. Consider alternatives such as "fix(examples-hitl): add function group support to RetryReactAgent" or "fix(examples-hitl): make RetryReactAgent support function groups" to better align with the stated requirement of using imperative mood.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

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

📜 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 36ba62c and 1661b9c.

📒 Files selected for processing (1)
  • examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.py

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

**/*.py: In code comments use the abbreviations: nat (API namespace/CLI), nvidia-nat (package), NAT (env var prefixes); never use these abbreviations in documentation
Follow PEP 20 and PEP 8 for Python style
Run yapf with column_limit=120; yapf is used for formatting (run second)
Indent with 4 spaces (no tabs) and end each file with a single trailing newline
Use ruff (ruff check --fix) as a linter (not formatter) per pyproject.toml; fix warnings unless explicitly ignored
Respect Python naming schemes: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
When re-raising exceptions, use bare raise to preserve stack trace; log with logger.error(), not logger.exception()
When catching and logging without re-raising, use logger.exception() to capture full stack trace
Provide Google-style docstrings for every public module, class, function, and CLI command
Docstring first line must be a concise description ending with a period
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 (HTTP, DB, file I/O)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorized operations when beneficial and feasible

Files:

  • examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py
{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}

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

{**/*.py,**/*.sh,**/*.md,**/*.toml,**/*.y?(a)ml,**/*.json,**/*.txt,**/*.ini,**/*.cfg,**/*.ipynb}: Every file must start with the standard SPDX Apache-2.0 header
Confirm copyright years are up to date when a file is changed
All source files must include the SPDX Apache-2.0 header template (copy from an existing file)

Files:

  • examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.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/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.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/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py
🧬 Code graph analysis (1)
examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py (2)
src/nat/builder/workflow_builder.py (8)
  • get_function_group_config (536-542)
  • get_function_group_config (1203-1204)
  • add_function_group (483-506)
  • add_function_group (1177-1178)
  • get_function_config (527-533)
  • get_function_config (1199-1200)
  • add_function (469-480)
  • add_function (1173-1174)
src/nat/builder/builder.py (4)
  • get_function_group_config (99-100)
  • add_function_group (75-76)
  • get_function_config (95-96)
  • add_function (71-72)
🪛 Ruff (0.14.1)
examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py

115-115: Do not catch blind exception: Exception

(BLE001)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: CI Pipeline / Check

@willkill07
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit a971fd6 into NVIDIA:release/1.3 Oct 24, 2025
17 checks passed
@willkill07 willkill07 deleted the wkk_function-group-support-in-retry-react-agent branch October 24, 2025 18:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants