Move router agent to control_flow category#817
Move router agent to control_flow category#817rapids-bot[bot] merged 5 commits intoNVIDIA:developfrom
control_flow category#817Conversation
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
WalkthroughRelocated Router Agent symbols from Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Workflow as "Sequential Executor\n(workflow)"
participant ToolA as "Tool A"
participant ToolB as "Tool B"
participant Output as "Final Output"
User->>Workflow: submit input
Workflow->>ToolA: execute(input)
ToolA-->>Workflow: resultA
Workflow->>ToolB: execute(resultA)
ToolB-->>Workflow: resultB
Workflow-->>Output: return resultB
Note right of Workflow: Deterministic, ordered tool chaining\n(type compatibility checked pre-execution)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (7)
examples/control_flow/router_agent/README.md (3)
20-21: Use full product name on first mention.Per guidelines: first use “NVIDIA NeMo Agent toolkit”; subsequent uses “NeMo Agent toolkit”.
Apply:
-This example demonstrates how to use a configurable Router Agent with the NeMo Agent toolkit. The Router Agent analyzes incoming requests and directly routes them to the most appropriate branch (other agents, functions or tools) based on the request content. For this purpose, NeMo Agent toolkit provides a [`router_agent`](../../../docs/source/workflows/about/router-agent.md) workflow type. +This example demonstrates how to use a configurable Router Agent with the NVIDIA NeMo Agent toolkit. The Router Agent analyzes incoming requests and directly routes them to the most appropriate branch (other agents, functions or tools) based on the request content. For this purpose, the NeMo Agent toolkit provides a [`router_agent`](../../../docs/source/workflows/about/router-agent.md) workflow type.
143-158: Update sample output to match new paths after relocation.The “Expected Workflow Output” still shows legacy paths under examples/agents/router and logger names under nat.agent.router_agent.*. Update to control_flow equivalents to avoid confusion.
-nemo-agent-toolkit % nat run --config_file=examples/control_flow/router_agent/configs/config.yml --input "I want a yellow fruit" -2025-09-10 10:52:59,058 - nat.cli.commands.start - INFO - Starting NAT from config file: 'examples/agents/router/configs/config.yml' +nemo-agent-toolkit % nat run --config_file=examples/control_flow/router_agent/configs/config.yml --input "I want a yellow fruit" +2025-09-10 10:52:59,058 - nat.cli.commands.start - INFO - Starting NAT from config file: 'examples/control_flow/router_agent/configs/config.yml' @@ -2025-09-10 10:52:59,927 - nat.agent.router_agent.agent - INFO - +2025-09-10 10:52:59,927 - nat.control_flow.router_agent.agent - INFO -
24-29: Unify unordered list style to dashes to satisfy markdownlint (MD004).If any asterisks exist elsewhere in this README, switch them to dashes for consistency.
docs/source/workflows/about/router-agent.md (1)
20-35: Doc updates align with control_flow reorg; add cross-link to Sequential Executor.Consider a brief note linking to the Sequential Executor as a complementary control-flow option.
The Router Agent is a control flow component that analyzes incoming requests and directs them to the most appropriate branch (other agents or tools) based on the request content. It uses a single-pass architecture to select exactly one branch that best handles the request, making it ideal for scenarios where different types of requests need specialized handling. + +See also: [Sequential Executor](./sequential-executor.md) for deterministic, fixed-order tool execution without routing.docs/source/workflows/about/sequential-executor.md (3)
33-39: Use full product name on first mention.First occurrence should say “NVIDIA NeMo Agent toolkit”.
-The sequential executor is part of the core NeMo Agent toolkit and does not require additional plugin installations. +The sequential executor is part of the core NVIDIA NeMo Agent toolkit and does not require additional plugin installations.
116-117: Fix markdownlint MD036: remove bold inside heading.Avoid emphasis in headings.
-### **Step-by-Step Breakdown of a Sequential Executor** +### Step-by-step breakdown of a sequential executor
101-109: Tighten list indentation to satisfy MD007 if it triggers.Ensure top-level bullets start at column 0 and sub-bullets use consistent two-space indent.
-* `tool_execution_config`: Optional configuration for each tool in the sequential execution tool list. Keys should match the tool names from the `tool_list`. - - `use_streaming`: Defaults to `False`. Whether to use streaming output for the tool. +* `tool_execution_config`: Optional configuration for each tool in the sequential execution tool list. Keys should match the tool names from the `tool_list`. + - `use_streaming`: Defaults to `False`. Whether to use streaming output for the tool.Please run markdownlint locally to confirm no remaining MD007/MD036 hits in this file.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
docs/source/workflows/about/index.md(1 hunks)docs/source/workflows/about/router-agent.md(1 hunks)docs/source/workflows/about/sequential-executor.md(1 hunks)examples/control_flow/router_agent/README.md(3 hunks)src/nat/agent/register.py(0 hunks)src/nat/control_flow/register.py(1 hunks)src/nat/control_flow/router_agent/agent.py(2 hunks)src/nat/control_flow/router_agent/register.py(1 hunks)
💤 Files with no reviewable changes (1)
- src/nat/agent/register.py
🧰 Additional context used
📓 Path-based instructions (11)
docs/source/**/*.md
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
docs/source/**/*.md: Use the official naming: first use “NVIDIA NeMo Agent toolkit”; subsequent uses “NeMo Agent toolkit”; never use deprecated names in documentation
Documentation sources must be Markdown under docs/source; keep docs in sync and fix Sphinx errors/broken links
Documentation must be clear, comprehensive, free of TODO/FIXME/placeholders/offensive/outdated terms; fix spelling; adhere to Vale vocab allow/reject lists
Files:
docs/source/workflows/about/router-agent.mddocs/source/workflows/about/index.mddocs/source/workflows/about/sequential-executor.md
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}: Every file must start with the standard SPDX Apache-2.0 header; keep copyright years up‑to‑date
All source files must include the SPDX Apache‑2.0 header; do not bypass CI header checks
Files:
docs/source/workflows/about/router-agent.mdsrc/nat/control_flow/router_agent/register.pydocs/source/workflows/about/index.mddocs/source/workflows/about/sequential-executor.mdexamples/control_flow/router_agent/README.mdsrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
**/*.{py,md}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never hard‑code version numbers in code or docs; versions are derived by setuptools‑scm
Files:
docs/source/workflows/about/router-agent.mdsrc/nat/control_flow/router_agent/register.pydocs/source/workflows/about/index.mddocs/source/workflows/about/sequential-executor.mdexamples/control_flow/router_agent/README.mdsrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/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
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.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.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile 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:
docs/source/workflows/about/router-agent.mdsrc/nat/control_flow/router_agent/register.pydocs/source/workflows/about/index.mddocs/source/workflows/about/sequential-executor.mdexamples/control_flow/router_agent/README.mdsrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
docs/source/**/*
⚙️ CodeRabbit configuration file
This directory contains the source code for the documentation. All documentation should be written in Markdown format. Any image files should be placed in the
docs/source/_staticdirectory.
Files:
docs/source/workflows/about/router-agent.mddocs/source/workflows/about/index.mddocs/source/workflows/about/sequential-executor.md
src/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
src/**/*.py: All importable Python code must live under src/
All public APIs in src/ require Python 3.11+ type hints on parameters and return values; prefer typing/collections.abc abstractions; use typing.Annotated when useful
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise with a period; surround code entities with backticks
Files:
src/nat/control_flow/router_agent/register.pysrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
src/nat/**/*
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Core functionality under src/nat should prioritize backward compatibility when changed
Files:
src/nat/control_flow/router_agent/register.pysrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
⚙️ CodeRabbit configuration file
This directory contains the core functionality of the toolkit. Changes should prioritize backward compatibility.
Files:
src/nat/control_flow/router_agent/register.pysrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: Follow PEP 8/20 style; format with yapf (column_limit=120) and use 4-space indentation; end files with a single newline
Run ruff (ruff check --fix) per pyproject.toml; fix warnings unless explicitly ignored; ruff is linter-only
Use snake_case for functions/variables, PascalCase for classes, and UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: preserve stack traces and avoid duplicate logging
When re-raising exceptions, use bareraiseand log with logger.error(), not logger.exception()
When catching and not re-raising, log with logger.exception() to capture stack trace
Validate and sanitize all user input; prefer httpx with SSL verification and follow OWASP Top‑10
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile/mprof; cache with functools.lru_cache or external cache; leverage NumPy vectorization when beneficial
**/*.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).
Files:
src/nat/control_flow/router_agent/register.pysrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
**/*.{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:
src/nat/control_flow/router_agent/register.pysrc/nat/control_flow/register.pysrc/nat/control_flow/router_agent/agent.py
**/README.{md,ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Each documentation README must follow the NeMo Agent toolkit naming rules and must not use deprecated names
Files:
examples/control_flow/router_agent/README.md
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 apyproject.tomlfile. Optionally, it might also contain scripts in ascripts/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 nameddata/, and should
be checked into git-lfs.
Files:
examples/control_flow/router_agent/README.md
🧬 Code graph analysis (2)
src/nat/control_flow/router_agent/register.py (1)
src/nat/control_flow/router_agent/agent.py (3)
RouterAgentGraph(55-288)RouterAgentGraphState(39-52)create_router_agent_prompt(291-329)
src/nat/control_flow/router_agent/agent.py (1)
src/nat/control_flow/router_agent/register.py (1)
RouterAgentWorkflowConfig(30-41)
🪛 markdownlint-cli2 (0.17.2)
docs/source/workflows/about/sequential-executor.md
67-67: Unordered list indentation
Expected: 0; Actual: 2
(MD007, ul-indent)
68-68: Unordered list indentation
Expected: 0; Actual: 2
(MD007, ul-indent)
69-69: Unordered list indentation
Expected: 0; Actual: 2
(MD007, ul-indent)
141-141: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
examples/control_flow/router_agent/README.md
143-143: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
🔇 Additional comments (5)
src/nat/control_flow/register.py (1)
20-20: LGTM - Correct import addition for router agent registration.The import correctly brings the router agent registration functionality into the control flow namespace, aligning with the architectural reorganization in this PR.
src/nat/control_flow/router_agent/register.py (1)
50-52: LGTM - Correct import path updates for relocated router agent components.The imports correctly reference the new locations under
nat.control_flow.router_agent.agentfor the RouterAgentGraph, RouterAgentGraphState, and create_router_agent_prompt symbols. This maintains backward compatibility while organizing code under the proper control flow namespace.src/nat/control_flow/router_agent/agent.py (2)
34-34: LGTM - Correct type-checking import path update.The type-checking import correctly references the RouterAgentWorkflowConfig from the new location
nat.control_flow.router_agent.register.
307-308: LGTM - Correct runtime import path updates.The runtime imports of SYSTEM_PROMPT and USER_PROMPT correctly reference the new location
nat.control_flow.router_agent.prompt, maintaining the same public API while organizing code under the proper control flow namespace.docs/source/workflows/about/index.md (1)
67-75: Toctree additions verified — all referenced pages exist.
Index correctly adds labeled ReWOO entry and the new Sequential Executor page.
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
pyproject.toml (1)
1-1: Add SPDX Apache-2.0 header to satisfy CI.This file lacks the required SPDX header. Add at the very top:
+# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + [build-system]examples/control_flow/router_agent/README.md (1)
20-21: Standardize product naming in example README and update verification script
- examples/control_flow/router_agent/README.md (lines 20, 102–104, 121–124, 184–190): change the first mention to “NVIDIA NeMo Agent toolkit” and ensure all subsequent occurrences use “NeMo Agent toolkit” (lowercase ‘t’).
- To verify:
#!/bin/bash rg -n "NVIDIA NeMo Agent toolkit|NeMo Agent toolkit" examples/control_flow/router_agent/README.md
🧹 Nitpick comments (2)
examples/control_flow/router_agent/README.md (2)
141-141: Use a heading instead of bold for section title (MD036).-**Expected Workflow Output** +### Expected Workflow Output
158-169: Update sample logs to new module path.After relocation, logger names should reflect nat.control_flow.router_agent.agent.
-2025-09-10 10:52:59,927 - nat.agent.router_agent.agent - INFO - +2025-09-10 10:52:59,927 - nat.control_flow.router_agent.agent - INFO -
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
uv.lockis excluded by!**/*.lock
📒 Files selected for processing (2)
examples/control_flow/router_agent/README.md(3 hunks)pyproject.toml(1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}: Every file must start with the standard SPDX Apache-2.0 header; keep copyright years up‑to‑date
All source files must include the SPDX Apache‑2.0 header; do not bypass CI header checks
Files:
pyproject.tomlexamples/control_flow/router_agent/README.md
pyproject.toml
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Add new dependencies to pyproject.toml in alphabetical order
Files:
pyproject.toml
**/*
⚙️ 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
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.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.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile 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:
pyproject.tomlexamples/control_flow/router_agent/README.md
**/README.{md,ipynb}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Each documentation README must follow the NeMo Agent toolkit naming rules and must not use deprecated names
Files:
examples/control_flow/router_agent/README.md
**/*.{py,md}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never hard‑code version numbers in code or docs; versions are derived by setuptools‑scm
Files:
examples/control_flow/router_agent/README.md
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 apyproject.tomlfile. Optionally, it might also contain scripts in ascripts/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 nameddata/, and should
be checked into git-lfs.
Files:
examples/control_flow/router_agent/README.md
🪛 markdownlint-cli2 (0.17.2)
examples/control_flow/router_agent/README.md
141-141: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
⏰ 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
🔇 Additional comments (3)
examples/control_flow/router_agent/README.md (2)
109-110: Paths updated to control_flow look good.Install/run/serve commands and samples now reference examples/control_flow/router_agent.
Also applies to: 126-127, 131-139, 143-144, 189-190
20-20: Verify relative links/assets resolve from this location.
Confirm docs/source/workflows/about/router-agent.md and docs/source/_static/router_agent.png exist and that the relative links in examples/control_flow/router_agent/README.md resolve when rendered (examples/control_flow/router_agent/README.md — line 20; also applies to lines 44–45).pyproject.toml (1)
180-181: Router Agent example path updated correctly.No occurrences of "examples/agents/router" remain; however "nat.agent.router_agent" still appears in tests/docs/uv.lock — confirm whether those are intentional compatibility aliases or should be updated.
Locations: pyproject.toml (nat_router_agent entry), uv.lock, tests/nat/agent/test_router_agent.py, examples/control_flow/router_agent/README.md
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
tests/nat/agent/test_router_agent.py (1)
29-34: Import paths updated; no stale references found. All imports now point to nat.control_flow.router_agent and no lingering nat.agent.router_agent references remain. Optionally relocate tests/nat/agent/test_router_agent.py to tests/nat/control_flow/router_agent/ for path coherence.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tests/nat/agent/test_router_agent.py(3 hunks)
🧰 Additional context used
📓 Path-based instructions (7)
tests/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Unit tests must live under tests/ and use configured markers (e2e, integration, etc.)
Files:
tests/nat/agent/test_router_agent.py
⚙️ CodeRabbit configuration file
tests/**/*.py: - Ensure that tests are comprehensive, cover edge cases, and validate the functionality of the code. - Test functions should be named using thetest_prefix, using snake_case. - Any frequently repeated code should be extracted into pytest fixtures. - Pytest fixtures should define the name argument when applying the pytest.fixture decorator. The fixture
function being decorated should be named using thefixture_prefix, using snake_case. Example:
@pytest.fixture(name="my_fixture")
def fixture_my_fixture():
pass
Files:
tests/nat/agent/test_router_agent.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: Follow PEP 8/20 style; format with yapf (column_limit=120) and use 4-space indentation; end files with a single newline
Run ruff (ruff check --fix) per pyproject.toml; fix warnings unless explicitly ignored; ruff is linter-only
Use snake_case for functions/variables, PascalCase for classes, and UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: preserve stack traces and avoid duplicate logging
When re-raising exceptions, use bareraiseand log with logger.error(), not logger.exception()
When catching and not re-raising, log with logger.exception() to capture stack trace
Validate and sanitize all user input; prefer httpx with SSL verification and follow OWASP Top‑10
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile/mprof; cache with functools.lru_cache or external cache; leverage NumPy vectorization when beneficial
**/*.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).
Files:
tests/nat/agent/test_router_agent.py
**/tests/**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/tests/**/*.py: Test functions must use the test_ prefix and snake_case
Extract repeated test code into pytest fixtures; fixtures should set name=... in @pytest.fixture and functions named with fixture_ prefix
Mark expensive tests with @pytest.mark.slow or @pytest.mark.integration
Use pytest with pytest-asyncio for async code; mock external services with pytest_httpserver or unittest.mock
Files:
tests/nat/agent/test_router_agent.py
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}: Every file must start with the standard SPDX Apache-2.0 header; keep copyright years up‑to‑date
All source files must include the SPDX Apache‑2.0 header; do not bypass CI header checks
Files:
tests/nat/agent/test_router_agent.py
**/*.{py,md}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never hard‑code version numbers in code or docs; versions are derived by setuptools‑scm
Files:
tests/nat/agent/test_router_agent.py
**/*.{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:
tests/nat/agent/test_router_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
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.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.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile 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:
tests/nat/agent/test_router_agent.py
🧬 Code graph analysis (1)
tests/nat/agent/test_router_agent.py (2)
src/nat/control_flow/router_agent/agent.py (3)
RouterAgentGraph(55-288)RouterAgentGraphState(39-52)create_router_agent_prompt(291-329)src/nat/control_flow/router_agent/register.py (1)
RouterAgentWorkflowConfig(30-41)
🔇 Additional comments (2)
tests/nat/agent/test_router_agent.py (2)
262-262: Patch target updated to nat.control_flow.router_agent.agent.StateGraph — looks correct.Patching the module-level symbol aligns with how agent.py references StateGraph.
284-284: Exception-path patch target also correct.Mirrors the successful case; consistent and precise.
Signed-off-by: Yuchen Zhang <yuchenz@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
docs/source/workflows/about/sequential-executor.md (1)
107-107: Wording matches prior review suggestion.“The keys must match the tool names from the tool_list” is now explicit. Looks good.
🧹 Nitpick comments (2)
docs/source/workflows/about/sequential-executor.md (2)
103-109: Fix markdown list style to pass MD004 (dash, not asterisk).Switch leading “*” to “-” for unordered lists.
Apply this diff:
-* `tool_list`: **Required**. A list of functions to execute sequentially. Each function's output becomes the input for the next function in the chain. +- `tool_list`: **Required**. A list of functions to execute sequentially. Each function's output becomes the input for the next function in the chain. -* `raise_type_incompatibility`: Defaults to `False`. Whether to raise an exception if the type compatibility check fails. The type compatibility check runs before executing the tool list, based on the type annotations of the functions. When set to `True`, any incompatibility immediately raises an exception. When set to `False`, incompatibilities generate warning messages and the sequential executor continues execution. Set this to `False` when functions in the tool list include custom type converters, as the type compatibility check may fail even though the sequential executor can still execute the tool list. +- `raise_type_incompatibility`: Defaults to `False`. Whether to raise an exception if the type compatibility check fails. The type compatibility check runs before executing the tool list, based on the type annotations of the functions. When set to `True`, any incompatibility immediately raises an exception. When set to `False`, incompatibilities generate warning messages and the sequential executor continues execution. Set this to `False` when functions in the tool list include custom type converters, as the type compatibility check may fail even though the sequential executor can still execute the tool list. -* `tool_execution_config`: Optional configuration for each tool in the sequential execution tool list. Keys must match the tool names from the `tool_list`. +- `tool_execution_config`: Optional configuration for each tool in the sequential execution tool list. Keys must match the tool names from the `tool_list`. - `use_streaming`: Defaults to `False`. Whether to use streaming output for the tool. @@ -* The workflow is deterministic and follows a fixed sequence -* No decision-making is required between steps -* Functions have clear input/output dependencies +- The workflow is deterministic and follows a fixed sequence +- No decision-making is required between steps +- Functions have clear input/output dependencies @@ -* **No Dynamic Decision Making** +- **No Dynamic Decision Making** @@ -* **No Parallel Execution** +- **No Parallel Execution**Also applies to: 138-141, 148-148, 152-152
116-118: Remove redundant explanatory sentence.Line 117 repeats the preceding concept; tighten the section.
Apply this diff:
-### **Step-by-Step Breakdown of a Sequential Executor** -The sequential executor follows a fixed execution path where each function's output directly becomes the input for the next function. +### **Step-by-Step Breakdown of a Sequential Executor**
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
docs/source/workflows/about/sequential-executor.md(1 hunks)examples/control_flow/sequential_executor/README.md(1 hunks)src/nat/control_flow/sequential_executor.py(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- examples/control_flow/sequential_executor/README.md
- src/nat/control_flow/sequential_executor.py
🧰 Additional context used
📓 Path-based instructions (5)
docs/source/**/*.md
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
docs/source/**/*.md: Use the official naming: first use “NVIDIA NeMo Agent toolkit”; subsequent uses “NeMo Agent toolkit”; never use deprecated names in documentation
Documentation sources must be Markdown under docs/source; keep docs in sync and fix Sphinx errors/broken links
Documentation must be clear, comprehensive, free of TODO/FIXME/placeholders/offensive/outdated terms; fix spelling; adhere to Vale vocab allow/reject lists
Files:
docs/source/workflows/about/sequential-executor.md
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.{py,sh,md,yml,yaml,toml,ini,json,ipynb,txt,rst}: Every file must start with the standard SPDX Apache-2.0 header; keep copyright years up‑to‑date
All source files must include the SPDX Apache‑2.0 header; do not bypass CI header checks
Files:
docs/source/workflows/about/sequential-executor.md
**/*.{py,md}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never hard‑code version numbers in code or docs; versions are derived by setuptools‑scm
Files:
docs/source/workflows/about/sequential-executor.md
**/*
⚙️ 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
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.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.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile 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:
docs/source/workflows/about/sequential-executor.md
docs/source/**/*
⚙️ CodeRabbit configuration file
This directory contains the source code for the documentation. All documentation should be written in Markdown format. Any image files should be placed in the
docs/source/_staticdirectory.
Files:
docs/source/workflows/about/sequential-executor.md
🪛 markdownlint-cli2 (0.17.2)
docs/source/workflows/about/sequential-executor.md
103-103: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
105-105: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
107-107: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
138-138: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
139-139: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
140-140: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
148-148: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
152-152: Unordered list style
Expected: dash; Actual: asterisk
(MD004, ul-style)
⏰ 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
🔇 Additional comments (3)
docs/source/workflows/about/sequential-executor.md (3)
1-16: SPDX header present and current.Header, license, and year (2025) look correct.
35-39: Confirm install command matches project-wide guidance.Ensure “uv pip install -e .” is the endorsed install path in the root README and other docs to avoid divergence.
119-121: Verify image path and asset presence.Confirm that docs/source/_static/sequential_executor.png exists and the relative path renders under Sphinx.
|
/merge |
Description
Move router agent to
control_flowcategory to make it clearer that it is a control flow component, along with the newly added sequential executor. This PR added the missing documentation for sequential executor as well.By Submitting this PR I confirm:
Summary by CodeRabbit
Documentation
Refactor