-
Notifications
You must be signed in to change notification settings - Fork 485
adding MAF packages and Demo #1224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe changes introduce a Microsoft Agent Framework demo with Semantic Kernel integration for multi-agent travel planning workflows. Includes Azure OpenAI LLM configuration, hotel pricing and local events tools, long-term memory (Mem0) integration, framework plugin infrastructure, comprehensive documentation, and test coverage. Changes
Sequence DiagramsequenceDiagram
participant User
participant Client
participant GroupChat as GroupChat<br/>(Orchestrator)
participant HotelAgent as Itinerary<br/>Agent
participant BudgetAgent as Budget<br/>Agent
participant SummaryAgent as Summarizer<br/>Agent
participant HotelTool as Hotel Price<br/>Tool
participant EventsTool as Local Events<br/>Tool
participant LLM as Azure OpenAI<br/>LLM
participant Memory as Mem0<br/>Memory Service
User->>Client: Query: "3-day Tokyo itinerary, $2000 budget"
Client->>GroupChat: Start workflow with question
rect rgb(200, 220, 255)
Note over GroupChat,SummaryAgent: Round 1: Hotel Selection
GroupChat->>HotelAgent: Route: "Plan itinerary"
HotelAgent->>LLM: Process query, call tools
LLM->>HotelTool: Get hotels in Tokyo
HotelTool->>HotelTool: Load & filter hotel_prices.json
HotelTool-->>LLM: Return hotel offers
LLM-->>HotelAgent: LLM response with recommendations
HotelAgent->>Memory: Add memory (user_id, context)
Memory-->>HotelAgent: Memory stored
HotelAgent-->>GroupChat: Hotel recommendations
end
rect rgb(220, 200, 255)
Note over GroupChat,SummaryAgent: Round 2: Budget Validation
GroupChat->>BudgetAgent: Route: "Validate budget"
BudgetAgent->>LLM: Analyze costs
LLM->>EventsTool: Get local events in Tokyo
EventsTool->>EventsTool: Load & filter local_events.json
EventsTool-->>LLM: Return events
LLM-->>BudgetAgent: Budget analysis + event recommendations
BudgetAgent->>Memory: Add memory (budget constraints)
Memory-->>BudgetAgent: Memory stored
BudgetAgent-->>GroupChat: Budget-aligned itinerary
end
rect rgb(200, 255, 220)
Note over GroupChat,SummaryAgent: Round 3: Final Summary
GroupChat->>SummaryAgent: Route: "Summarize plan"
SummaryAgent->>Memory: Get memory (retrieve context)
Memory-->>SummaryAgent: Context retrieved
SummaryAgent->>LLM: Generate final summary
LLM-->>SummaryAgent: Summary response
SummaryAgent-->>GroupChat: Final summary
end
GroupChat-->>Client: Stream final response
Client-->>User: Display complete itinerary with budget breakdown
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Areas requiring extra attention:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 16
🧹 Nitpick comments (6)
packages/nvidia_nat_maf/src/nat/meta/pypi.md (1)
18-23: Align NeMo Agent toolkit naming with style guidelinesBody text currently uses “NeMo Agent toolkit” for the first mention and “NVIDIA NeMo Agent toolkit” later, which inverts the documented convention. Consider updating the body copy like this:
-# NVIDIA NeMo Agent Toolkit Subpackage -This is a subpackage for Microsoft Agent Framework (MAF) integration in NeMo Agent toolkit. - -For more information about the NVIDIA NeMo Agent toolkit, please visit the [NeMo Agent toolkit GitHub Repo](https://github.com/NVIDIA/NeMo-Agent-Toolkit). +# NVIDIA NeMo Agent Toolkit Subpackage +This is a subpackage for Microsoft Agent Framework (MAF) integration in the NVIDIA NeMo Agent toolkit. + +For more information about the NeMo Agent toolkit, please visit the [NeMo Agent toolkit GitHub repository](https://github.com/NVIDIA/NeMo-Agent-Toolkit).This keeps the heading wording, uses “NVIDIA NeMo Agent toolkit” on first mention in the body, and “NeMo Agent toolkit” for subsequent references, matching the docs style guide.
As per coding guidelines, use “NVIDIA NeMo Agent toolkit” on first use and “NeMo Agent toolkit” thereafter in
.mdfiles.packages/nvidia_nat_maf/src/nat/plugins/maf/register.py (1)
1-22: Registration shim and licensing header look goodThe module correctly serves as a registration shim by importing
llmandtool_wrapperfor side effects and includes the standard Apache-2.0 SPDX header; no changes needed. If ruff ever flags unused imports here, you can optionally add a# ruff: noqapragma at the top to mirror the flake8 behavior.examples/frameworks/microsoft_agent_framework_demo/README.md (1)
92-92: Use proper Markdown heading instead of bold text.As per coding guidelines and static analysis hints, use a proper heading instead of bold text for section titles.
Apply this diff:
-**Expected Workflow Output** +### Expected Workflow Outputpackages/nvidia_nat_maf/tests/test_sk_decorator.py (1)
134-140: Consider direct attribute access instead of getattr.Static analysis suggests using direct attribute access instead of
getattrwith constant attribute names, which is more readable and provides better IDE support.Example for line 134:
-params = getattr(decorated_func, '__kernel_function_parameters__') +params = decorated_func.__kernel_function_parameters__Apply similar changes to lines 140, 149, 162, 173, 182, 195.
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py (2)
55-63: Use or remove thetoolsvariable and consider honoringtool_names.
tools = await builder.get_tools(config.tool_names, wrapper_type=LLMFrameworkEnum.SEMANTIC_KERNEL)is assigned but never used, andall_toolsis hard-coded to[hotel_price_tool.hotel_price, local_events_tool.local_events]. That means:
- Ruff flags
toolsas unused (F841).- The
tool_namesconfig is effectively ignored.Either use the resolved tools (perhaps merging them with the hard-coded list if intentional), or drop
tool_namesfrom the config. For example:- tools = await builder.get_tools(config.tool_names, wrapper_type=LLMFrameworkEnum.SEMANTIC_KERNEL) - - all_tools = [hotel_price_tool.hotel_price, local_events_tool.local_events] + all_tools = await builder.get_tools( + config.tool_names or [hotel_price_tool.hotel_price, local_events_tool.local_events], + wrapper_type=LLMFrameworkEnum.SEMANTIC_KERNEL, + )Adjust to match how NAT expects tools to be referenced in configs for this demo.
158-163: Avoid loggingGeneratorExitas an exception unless it’s truly exceptional.Catching
GeneratorExitand logging withlogger.exception("Exited early!")will emit a full stack trace for normal generator closure, which can be noisy for a demo that’s expected to be started/stopped interactively.If this is expected shutdown behavior, consider logging at
debugorinfowithoutlogger.exception, or skip logging entirely:- except GeneratorExit: - logger.exception("Exited early!") + except GeneratorExit: + logger.debug("Workflow generator exited early")This still respects the guideline of using
logger.exceptiononly when you’re not re-raising and truly want the stack trace.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (20)
examples/frameworks/microsoft_agent_framework_demo/README.md(1 hunks)examples/frameworks/microsoft_agent_framework_demo/configs(1 hunks)examples/frameworks/microsoft_agent_framework_demo/data(1 hunks)examples/frameworks/microsoft_agent_framework_demo/pyproject.toml(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.yml(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.json(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.json(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.py(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.py(1 hunks)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py(1 hunks)examples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.py(1 hunks)packages/nvidia_nat_maf/LICENSE-3rd-party.txt(1 hunks)packages/nvidia_nat_maf/LICENSE.md(1 hunks)packages/nvidia_nat_maf/pyproject.toml(1 hunks)packages/nvidia_nat_maf/src/nat/meta/pypi.md(1 hunks)packages/nvidia_nat_maf/src/nat/plugins/maf/llm.py(1 hunks)packages/nvidia_nat_maf/src/nat/plugins/maf/register.py(1 hunks)packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py(1 hunks)packages/nvidia_nat_maf/tests/test_llm_sk.py(1 hunks)packages/nvidia_nat_maf/tests/test_sk_decorator.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (15)
**/*
⚙️ 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 (except for return values of
None,
in that situation no return type hint is needed).
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:
examples/frameworks/microsoft_agent_framework_demo/dataexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.ymlexamples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pyexamples/frameworks/microsoft_agent_framework_demo/README.mdpackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/configsexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pypackages/nvidia_nat_maf/LICENSE-3rd-party.txtexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.jsonpackages/nvidia_nat_maf/src/nat/meta/pypi.mdexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.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 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/frameworks/microsoft_agent_framework_demo/dataexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.ymlexamples/frameworks/microsoft_agent_framework_demo/pyproject.tomlexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pyexamples/frameworks/microsoft_agent_framework_demo/README.mdexamples/frameworks/microsoft_agent_framework_demo/configsexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.py
**/*.{py,js,ts,yaml,yml,json,md,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Indent with 4 spaces, never tabs, and ensure every file ends with a single newline
Files:
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.ymlpackages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pyexamples/frameworks/microsoft_agent_framework_demo/README.mdpackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.jsonpackages/nvidia_nat_maf/src/nat/meta/pypi.mdexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.{py,env,toml,yaml,yml,json}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Never commit API keys, credentials or personal data; use environment variables or .env files excluded from Git
Files:
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.ymlexamples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.jsonexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.{py,toml,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Use abbreviations: 'nat' for API namespace and CLI tool, 'nvidia-nat' for package name, 'NAT' for environment variable prefixes and informal comments
Files:
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.ymlexamples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/pyproject.toml
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/pyproject.toml: Dependencies should use ~= format with two-digit versions (e.g., ~=1.0)
New dependencies must be added to both pyproject.toml (alphabetically) and uv.lock via uv pip install --sync
Files:
examples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/pyproject.toml
**/*.{md,rst,py}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Use 'NVIDIA NeMo Agent toolkit' on first use, then 'NeMo Agent toolkit' for subsequent references
Files:
packages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pyexamples/frameworks/microsoft_agent_framework_demo/README.mdpackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pypackages/nvidia_nat_maf/src/nat/meta/pypi.mdexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.{md,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Use 'NeMo Agent Toolkit' (capitalize 'T') when the name appears in headings
Files:
packages/nvidia_nat_maf/LICENSE.mdexamples/frameworks/microsoft_agent_framework_demo/README.mdpackages/nvidia_nat_maf/src/nat/meta/pypi.md
**/*.{py,md,rst}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Version numbers are derived automatically by setuptools-scm; never hard-code them in code or docs
Files:
packages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pyexamples/frameworks/microsoft_agent_framework_demo/README.mdpackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pypackages/nvidia_nat_maf/src/nat/meta/pypi.mdexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-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 thepyproject.tomlfile.
Files:
packages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/tests/test_llm_sk.pypackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pypackages/nvidia_nat_maf/LICENSE-3rd-party.txtpackages/nvidia_nat_maf/src/nat/meta/pypi.mdpackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/*.py: Follow PEP 20 and PEP 8 for Python style guidelines
Run yapf second (PEP 8 base, column_limit = 120) for Python formatting
Use ruff check --fix (via pre-commit) for linting using configuration embedded in pyproject.toml, fix warnings unless explicitly ignored
Use snake_case for functions and variables, PascalCase for classes, UPPER_CASE for constants
All public APIs require Python 3.11+ type hints on parameters and return values
Prefer collections.abc / typing abstractions (Sequence over list) for type hints
Use typing.Annotated for units or extra metadata when useful
Treat pyright warnings (configured in pyproject.toml) as errors during development
Preserve stack traces and prevent duplicate logging when handling exceptions; use bare raise statements and logger.error() when re-raising
When catching and logging exceptions without re-raising, always use logger.exception() to capture the full stack trace information
Provide Google-style docstrings for every public module, class, function and CLI command
The first line of docstrings must be a concise description ending with a period (Vale checks this)
Surround code entities with backticks in docstrings to avoid Vale false-positives
Validate and sanitise 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 reads)
Cache expensive computations with functools.lru_cache or an external cache when appropriate
Leverage NumPy vectorised operations whenever beneficial and feasible
Files:
packages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/test_*.py
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
**/test_*.py: Use pytest with pytest-asyncio for asynchronous code testing
Test functions should be named using the test_ prefix, using snake_case
Extract frequently repeated code into pytest fixtures, which should be named using the fixture_ prefix and define the name argument in the decorator
Mock external services with pytest_httpserver or unittest.mock instead of hitting live endpoints
Mark slow tests with @pytest.mark.slow so they can be skipped in the default test suite
Mark integration tests requiring external services with @pytest.mark.integration so they can be skipped in the default test suite
Files:
packages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.{py,js,ts,java,cpp,c,go,rb,php}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Every file must start with the standard SPDX Apache-2.0 header
Files:
packages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
**/*.{py,js,ts,java,cpp,c,go,rb,php,sh}
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
All source files must include the SPDX Apache-2.0 header template
Files:
packages/nvidia_nat_maf/tests/test_llm_sk.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.pypackages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.pypackages/nvidia_nat_maf/src/nat/plugins/maf/register.pyexamples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.pyexamples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
packages/*/pyproject.toml
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
The pyproject.toml should declare a dependency on nvidia-nat or another package with a name starting with nvidia-nat-
Files:
packages/nvidia_nat_maf/pyproject.toml
🧠 Learnings (13)
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Each package should contain a pyproject.toml file
Applied to files:
examples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/pyproject.toml
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Applies to packages/*/pyproject.toml : The pyproject.toml should declare a dependency on nvidia-nat or another package with a name starting with nvidia-nat-
Applied to files:
examples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/meta/pypi.md
📚 Learning: 2025-11-05T11:45:35.119Z
Learnt from: thepatrickchin
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1152
File: examples/config_inheritance/pyproject.toml:1-25
Timestamp: 2025-11-05T11:45:35.119Z
Learning: In the examples/ directory, pyproject.toml files typically do not include SPDX license headers, with only one exception (adk_demo). This is an established pattern that differs from the general guideline requiring SPDX headers in all .toml files.
Applied to files:
examples/frameworks/microsoft_agent_framework_demo/pyproject.toml
📚 Learning: 2025-12-03T18:42:23.494Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1147
File: packages/nvidia_nat_a2a/pyproject.toml:1-10
Timestamp: 2025-12-03T18:42:23.494Z
Learning: In the packages/ directory, pyproject.toml files typically do not include SPDX license headers. Out of 34 packages, only nvidia_nat_strands is an exception. This pattern differs from the requirement for SPDX headers in source code files (.py, .js, .ts, etc.).
Applied to files:
examples/frameworks/microsoft_agent_framework_demo/pyproject.tomlpackages/nvidia_nat_maf/LICENSE.mdpackages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/LICENSE-3rd-party.txtpackages/nvidia_nat_maf/src/nat/meta/pypi.md
📚 Learning: 2025-11-14T20:33:53.944Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1181
File: packages/nvidia_nat_test/tests/test_test_llm.py:419-484
Timestamp: 2025-11-14T20:33:53.944Z
Learning: The NVIDIA NeMo-Agent-Toolkit project uses pytest-asyncio in strict mode (the default), which requires pytest.mark.asyncio decorator on all async test functions. All async tests in packages/nvidia_nat_test/tests/test_test_llm.py consistently follow this pattern.
Applied to files:
packages/nvidia_nat_maf/tests/test_llm_sk.pypackages/nvidia_nat_maf/tests/test_sk_decorator.py
📚 Learning: 2025-11-10T21:26:35.059Z
Learnt from: jiaxiangr
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 974
File: packages/nvidia_nat_all/pyproject.toml:39-39
Timestamp: 2025-11-10T21:26:35.059Z
Learning: In packages/nvidia_nat_all/pyproject.toml, workspace dependencies (nvidia-nat-* plugin packages) should NOT have version constraints because they are managed as workspace dependencies. Version constraints are only applied to the base nvidia-nat package and external dependencies, not to internal workspace packages.
Applied to files:
packages/nvidia_nat_maf/pyproject.toml
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Applies to **/*.{py,toml,yaml,yml} : Use abbreviations: 'nat' for API namespace and CLI tool, 'nvidia-nat' for package name, 'NAT' for environment variable prefixes and informal comments
Applied to files:
packages/nvidia_nat_maf/pyproject.tomlpackages/nvidia_nat_maf/src/nat/meta/pypi.md
📚 Learning: 2025-09-15T21:26:29.430Z
Learnt from: saglave
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 726
File: examples/frameworks/adk_demo/src/nat_adk_demo/weather_update_tool.py:0-0
Timestamp: 2025-09-15T21:26:29.430Z
Learning: In NAT's ADK integration, the docstring of registered functions serves as the tool description sent to the LLM, not standard Python function documentation. The docstring should describe the logical tool interface (parameters the LLM will provide) rather than the NAT framework wrapper parameters like tool_config and builder.
Applied to files:
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.pypackages/nvidia_nat_maf/src/nat/plugins/maf/llm.py
📚 Learning: 2025-10-09T22:21:15.944Z
Learnt from: onkkul
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 859
File: packages/nvidia_nat_autogen/src/nat/plugins/autogen/tool_wrapper.py:115-118
Timestamp: 2025-10-09T22:21:15.944Z
Learning: In `packages/nvidia_nat_autogen/src/nat/plugins/autogen/tool_wrapper.py`, when extracting parameters from input_schema at line 136, the code must handle both dataclasses (standard and Pydantic) and Pydantic BaseModels differently. Pydantic dataclasses have `__pydantic_fields__` (not `model_fields`), so use `dataclasses.fields()` for dataclasses and `model_fields` for BaseModels to properly extract function parameters.
Applied to files:
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: src/nat/**/* contains core functionality and changes should prioritize backward compatibility
Applied to files:
examples/frameworks/microsoft_agent_framework_demo/configs
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Binary assets committed via Git-LFS must have licensing info recorded in LICENSE-3rd-party.txt when required
Applied to files:
packages/nvidia_nat_maf/LICENSE-3rd-party.txt
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Applies to **/*.{md,rst,py} : Use 'NVIDIA NeMo Agent toolkit' on first use, then 'NeMo Agent toolkit' for subsequent references
Applied to files:
packages/nvidia_nat_maf/src/nat/meta/pypi.md
📚 Learning: 2025-11-24T18:56:53.109Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-11-24T18:56:53.109Z
Learning: Applies to **/*.{md,rst} : Use 'NeMo Agent Toolkit' (capitalize 'T') when the name appears in headings
Applied to files:
packages/nvidia_nat_maf/src/nat/meta/pypi.md
🧬 Code graph analysis (8)
packages/nvidia_nat_maf/tests/test_llm_sk.py (4)
src/nat/builder/framework_enum.py (1)
LLMFrameworkEnum(19-26)src/nat/data_models/llm.py (1)
APITypeEnum(25-27)src/nat/llm/openai_llm.py (2)
openai_llm(57-59)OpenAIModelConfig(32-53)packages/nvidia_nat_maf/src/nat/plugins/maf/llm.py (1)
openai_semantic_kernel(72-80)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py (3)
src/nat/builder/framework_enum.py (1)
LLMFrameworkEnum(19-26)src/nat/builder/function_info.py (2)
FunctionInfo(290-625)create(351-549)src/nat/data_models/function.py (1)
FunctionBaseConfig(26-36)
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py (2)
src/nat/builder/framework_enum.py (1)
LLMFrameworkEnum(19-26)src/nat/utils/type_utils.py (1)
origin(71-82)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.py (2)
src/nat/builder/function_info.py (2)
FunctionInfo(290-625)from_fn(552-625)src/nat/data_models/function.py (1)
FunctionBaseConfig(26-36)
packages/nvidia_nat_maf/src/nat/plugins/maf/register.py (1)
tests/nat/builder/test_builder.py (1)
tool_wrapper(556-566)
examples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.py (2)
packages/nvidia_nat_test/src/nat/test/utils.py (1)
locate_example_config(57-68)examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py (1)
SKTravelPlanningWorkflowConfig(34-46)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.py (2)
src/nat/builder/function_info.py (2)
FunctionInfo(290-625)from_fn(552-625)src/nat/data_models/function.py (1)
FunctionBaseConfig(26-36)
packages/nvidia_nat_maf/tests/test_sk_decorator.py (2)
tests/nat/builder/test_builder.py (1)
tool_wrapper(556-566)packages/nvidia_nat_mcp/src/nat/plugins/mcp/client_base.py (2)
description(610-616)input_schema(619-623)
🪛 Biome (2.1.2)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.json
[error] 1-1: String values must be double quoted.
(parse)
[error] 1-1: String values must be double quoted.
(parse)
[error] 1-2: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 2-2: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 2-2: String values must be double quoted.
(parse)
[error] 2-3: String values must be double quoted.
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.json
[error] 1-1: String values must be double quoted.
(parse)
[error] 1-1: String values must be double quoted.
(parse)
[error] 1-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
[error] 3-3: End of file expected
Use an array for a sequence of values: [1, 2]
(parse)
🪛 LanguageTool
examples/frameworks/microsoft_agent_framework_demo/README.md
[uncategorized] ~60-~60: If this is a compound adjective that modifies the following noun, use a hyphen.
Context: ...emory With NeMo Agent toolkit, adding Long Term Memory (LTM) is as simple as adding a n...
(EN_COMPOUND_ADJECTIVE_INTERNAL)
[style] ~84-~84: ‘on occasion’ might be wordy. Consider a shorter alternative.
Context: ...rmal to see the LLM produce some errors on occasion as it handles complex structured tool c...
(EN_WORDINESS_PREMIUM_ON_OCCASION)
🪛 markdownlint-cli2 (0.18.1)
examples/frameworks/microsoft_agent_framework_demo/README.md
92-92: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🪛 Ruff (0.14.7)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py
28-28: Unused noqa directive (non-enabled: F401)
Remove unused noqa directive
(RUF100)
29-29: Unused noqa directive (non-enabled: F401)
Remove unused noqa directive
(RUF100)
58-58: Local variable tools is assigned to but never used
Remove assignment to unused variable tools
(F841)
99-99: Undefined name GroupChatStateSnapshot
(F821)
103-103: Local variable round_idx is assigned to but never used
Remove assignment to unused variable round_idx
(F841)
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py
39-39: Comment contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF003)
47-47: Comment contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF003)
65-65: Comment contains ambiguous ’ (RIGHT SINGLE QUOTATION MARK). Did you mean ``` (GRAVE ACCENT)?
(RUF003)
75-75: Unused function argument: builder
(ARG001)
143-143: Local variable tool_schema is assigned to but never used
Remove assignment to unused variable tool_schema
(F841)
packages/nvidia_nat_maf/src/nat/plugins/maf/llm.py
37-37: Unused function argument: llm_config
(ARG001)
54-54: Local variable credential is assigned to but never used
Remove assignment to unused variable credential
(F841)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.py
41-41: Unused function argument: builder
(ARG001)
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.py
45-45: Unused function argument: builder
(ARG001)
packages/nvidia_nat_maf/tests/test_sk_decorator.py
66-66: Unused method argument: kwargs
(ARG002)
84-84: Unused method argument: kwargs
(ARG002)
102-102: Unused method argument: kwargs
(ARG002)
134-134: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
140-140: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
149-149: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
162-162: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
173-173: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
182-182: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
195-195: Do not call getattr with a constant attribute value. It is not any safer than normal property access.
Replace getattr with attribute access
(B009)
🔇 Additional comments (19)
packages/nvidia_nat_maf/LICENSE-3rd-party.txt (1)
1-1: Verify symlink handling and license file pattern for packages.This file appears to reference the root
LICENSE-3rd-party.txtvia a relative path. If this is intended as a Git symlink, verify it's properly handled (symlinks can be fragile across platforms). If it's literal text, consider whether this is the intended pattern for documenting third-party licenses in the package, or if the package should include its ownLICENSE-3rd-party.txtwith actual licensing information.examples/frameworks/microsoft_agent_framework_demo/data (1)
1-1: Path indirection file looks fineSingle-line path matches the nat_semantic_kernel_demo data directory used elsewhere in the demo; no changes needed.
examples/frameworks/microsoft_agent_framework_demo/configs (1)
1-1: Config indirection file looks fineThis mirrors the data indirection pattern for nat_semantic_kernel_demo configs and is consistent with the example layout; no changes needed.
packages/nvidia_nat_maf/LICENSE.md (1)
1-1: Per-package license pointer is appropriatePointing to the root
LICENSE.mdvia a relative path matches the usual pattern for package license files; no changes needed.examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/local_events.json (1)
1-3: Git LFS pointer is correct; JSON parse errors are expectedThis file is a standard Git LFS pointer, not a JSON payload, so Biome’s JSON parse errors can be safely ignored; no changes needed.
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/data/hotel_prices.json (1)
1-3: Hotel price data is correctly tracked via Git LFSThis is a valid Git LFS pointer file; JSON linters will misinterpret it, but the pointer format is correct and matches the data/LFS requirements.
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py (1)
35-58: LGTM: Helper functions for type mapping.The
get_type_infoandresolve_typehelper functions correctly handle Python type annotations and Union types for schema generation.packages/nvidia_nat_maf/tests/test_llm_sk.py (2)
33-64: LGTM: Well-structured LLM wrapper tests.The test class properly validates:
- OpenAI Semantic Kernel wrapper instantiation with correct model configuration
- Proper rejection of unsupported RESPONSES API type
- Appropriate use of fixtures and mocking
71-82: LGTM: Decorator registration validation.The test correctly verifies that the decorator-based registration mechanism properly registers the semantic kernel wrapper in the type registry.
packages/nvidia_nat_maf/pyproject.toml (2)
1-55: Verify entry point module path matches actual code structure.The entry point references
nat.plugins.semantic_kernel.register, but this should be validated against the actual plugin directory structure inpackages/nvidia_nat_maf/src/nat/plugins/. Confirm that theregistermodule exists at the specified location or update the path to match the actual package layout.
24-24: Verify dependency constraint onagent-framework.The
agent-frameworkpackage on PyPI is Microsoft's Agent Framework (latest stable: 1.0.0b251120, pre-release). Per coding guidelines, dependencies should use~=<version>format with two-digit versions (e.g.,~=1.0). Ifagent-frameworkis included as a dependency in this file, it must include an appropriate version constraint; if it lacks one, add~=1.0or specify the intended version range based on compatibility requirements.examples/frameworks/microsoft_agent_framework_demo/tests/test_semantic_kernel_workflow.py (1)
26-26: Verify the import path is correct.The import uses
nat_semantic_kernel_demobut the directory structure ismicrosoft_agent_framework_demo. Ensure the import path matches the actual package name defined inpyproject.tomland that the module is correctly installed or accessible in the project structure.examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.yml (1)
54-54: Remove this comment —gpt-4.1is a valid OpenAI model identifier.The model name
gpt-4.1is officially supported by OpenAI and Azure OpenAI APIs as of December 2025. It appears in the official OpenAI model documentation, pricing pages, and Azure OpenAI deployment options. No runtime failures will occur from using this configuration.Likely an incorrect or invalid review comment.
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/local_events_tool.py (2)
35-37: Verify the defaultdata_pathtarget for this demo.
LocalEventsToolConfig.data_pathpoints to"examples/frameworks/semantic_kernel_demo/data/local_events.json", but this module lives undermicrosoft_agent_framework_demo. Confirm whether this path is:
- A copy/paste error that should be updated to
examples/frameworks/microsoft_agent_framework_demo/data/local_events.json, or- Intentional reuse of shared SK demo data that requires documentation.
25-37: I was unable to complete verification due to repository access failure. Based on the provided code snippet and coding guidelines alone, I cannot definitively confirm or refute the review comment's concerns:The review comment addresses docstring and type hint requirements, but verification is inconclusive without file context.
The snippet shows that
LocalEvent,LocalEventsResponse, andLocalEventsToolConfiglack docstrings. Per the coding guidelines ("Provide Google-style docstrings for every public module, class, function and CLI command"), this is a concern if these are public APIs. However, I cannot verify:
- Whether the full file context reveals pre-existing docstrings
- Whether the decorator naming mismatch and unused builder issues mentioned in the original scratchpad are present
- Whether the
data_pathpoints to the correct example directory- Whether other type hint improvements are applicable
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py (2)
96-120: I cannot complete the verification of this review comment due to repository access limitations. To properly rewrite this comment, I would need to:
- Access the actual file at
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/register.py- Verify the imports and type availability at the top of the file
- Confirm the exact code at lines 96-120
- Check the actual types of
agentselements andGroupChatStateSnapshot- Validate whether the identified issues (UnboundLocalError, IndexError, type mismatches) actually occur
The review comment identifies technically plausible Python errors (closure variable assignment without
nonlocal, type annotation issues, index out-of-bounds logic), but without codebase access, I cannot confirm these specific issues exist in the file or escalate/modify the review accordingly.
34-50: Unable to verify review comment due to repository access failure. Manual verification is required to confirm:
- Whether docstrings are present at module, class, and function levels
- Whether return type annotation exists on
semantic_kernel_travel_planning_workflow_orig- Whether the issues in the scratchpad (unused
toolsvariable,round_robin_speakerlogic,_response_fnbehavior) are confirmed in the full file context- Code compliance with Google-style docstring requirements
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.py (2)
55-76: Verify hotel city filtering logic against the actual data structure.
_get_hotel_pricecurrently ignores anycityinformation in the underlyinghotel_pricesdata and overwrites it with the request parameter:base_hotels = hotel_prices ... for hotel in base_hotels: total_price = hotel["price_per_night"] * nights offers.append( HotelOffer( name=hotel["name"], price_per_night=hotel["price_per_night"], total_price=total_price, city=city, # <- request city, not data city checkin=checkin, checkout=checkout, ) )If
hotel_pricescontains hotels with acityfield or spans multiple cities, this returns all hotels for any requested city, producing misleading results. Verify the data structure: if hotels should be filtered by city, filter the data and preserve the true city value from the source data instead of overwriting it.
24-27: Verifydata_pathfor hotel prices in Microsoft Agent Framework demo.
HotelPriceToolConfig.data_pathdefaults to"examples/frameworks/semantic_kernel_demo/data/hotel_prices.json"while the module resides inmicrosoft_agent_framework_demo. Confirm whether the demo intentionally reuses the Semantic Kernel demo's data or should use its own data file. If using a separate data file, update the path accordingly and verify the file exists at the specified location.
| dependencies = [ | ||
| "nvidia-nat[langchain,maf]~=1.4", | ||
| "usearch==2.21.0", | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Use ~= two-digit version specifier for usearch
Repo guidelines require pyproject dependencies to use ~= with two-digit versions; usearch==2.21.0 is overly strict and inconsistent with that policy. Consider relaxing to something like usearch~=2.21 (or the appropriate minor baseline) and ensure uv.lock is updated via uv pip install usearch~=2.21 --sync.
As per coding guidelines, dependencies in pyproject.toml should use ~=<version> with two-digit versions.
🤖 Prompt for AI Agents
In examples/frameworks/microsoft_agent_framework_demo/pyproject.toml around
lines 12 to 15, the dependency pin uses an exact three-part version for usearch
("usearch==2.21.0") which violates the repo guideline requiring two-digit ~=
specifiers; change it to a two-digit compatible ~= form (e.g., usearch~=2.21) in
the dependencies list and then update the lockfile by running the recommended
sync command (uv pip install usearch~=2.21 --sync) to regenerate uv.lock.
| Then, you can run the workflow with the LTM configuration as follows: | ||
|
|
||
| ```bash | ||
| nat run --config_file examples/frameworks/microsoft_agent_framework/configs/config.yml --input "Create a 3-day travel itinerary for Tokyo in April, suggest hotels within a USD 2000 budget. I like staying at expensive hotels and am vegan" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect path in command will cause execution failure.
The path examples/frameworks/microsoft_agent_framework/configs/config.yml is missing _demo suffix. Based on the file structure, the correct path should be examples/frameworks/microsoft_agent_framework_demo/configs/config.yml.
Apply this diff:
-nat run --config_file examples/frameworks/microsoft_agent_framework/configs/config.yml --input "Create a 3-day travel itinerary for Tokyo in April, suggest hotels within a USD 2000 budget. I like staying at expensive hotels and am vegan"
+nat run --config_file examples/frameworks/microsoft_agent_framework_demo/configs/config.yml --input "Create a 3-day travel itinerary for Tokyo in April, suggest hotels within a USD 2000 budget. I like staying at expensive hotels and am vegan"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| nat run --config_file examples/frameworks/microsoft_agent_framework/configs/config.yml --input "Create a 3-day travel itinerary for Tokyo in April, suggest hotels within a USD 2000 budget. I like staying at expensive hotels and am vegan" | |
| nat run --config_file examples/frameworks/microsoft_agent_framework_demo/configs/config.yml --input "Create a 3-day travel itinerary for Tokyo in April, suggest hotels within a USD 2000 budget. I like staying at expensive hotels and am vegan" |
🤖 Prompt for AI Agents
examples/frameworks/microsoft_agent_framework_demo/README.md around line 73: the
command uses an incorrect config file path
(examples/frameworks/microsoft_agent_framework/configs/config.yml) which will
fail; update the path to include the _demo suffix so it reads
examples/frameworks/microsoft_agent_framework_demo/configs/config.yml in the nat
run command.
| Assuming we've successfully added our preference for vegan restaurants in the last prompt to the agent, let us attempt to retrieve a more personalized itinerary with vegan dining options: | ||
|
|
||
| ```bash | ||
| nat run --config_file examples/frameworks/semantic_kernel_demo/configs/config.yml --input "On a 1-day travel itinerary for Tokyo in April, suggest restaurants I would enjoy." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect path in command will cause execution failure.
The path references semantic_kernel_demo but should be microsoft_agent_framework_demo to match the actual directory structure.
Apply this diff:
-nat run --config_file examples/frameworks/semantic_kernel_demo/configs/config.yml --input "On a 1-day travel itinerary for Tokyo in April, suggest restaurants I would enjoy."
+nat run --config_file examples/frameworks/microsoft_agent_framework_demo/configs/config.yml --input "On a 1-day travel itinerary for Tokyo in April, suggest restaurants I would enjoy."📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| nat run --config_file examples/frameworks/semantic_kernel_demo/configs/config.yml --input "On a 1-day travel itinerary for Tokyo in April, suggest restaurants I would enjoy." | |
| nat run --config_file examples/frameworks/microsoft_agent_framework_demo/configs/config.yml --input "On a 1-day travel itinerary for Tokyo in April, suggest restaurants I would enjoy." |
🤖 Prompt for AI Agents
In examples/frameworks/microsoft_agent_framework_demo/README.md around line 89,
the example command references the wrong config path
`examples/frameworks/semantic_kernel_demo/...`; update the path to
`examples/frameworks/microsoft_agent_framework_demo/configs/config.yml` so the
command points to the correct config file and will execute successfully.
| deployment_name: gpt-4.1 | ||
|
|
||
| workflow: | ||
| _type: maf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent workflow type naming.
The workflow type is declared as maf, but the directory structure, README, and other references use semantic_kernel. This inconsistency may confuse users about which framework is actually being used.
🤖 Prompt for AI Agents
In
examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/configs/config.yml
around line 61, the workflow type is set to "maf" which is inconsistent with the
directory structure, README and other references that use "semantic_kernel";
update the _type value to "semantic_kernel" (or change other references to "maf"
if that is the intended canonical name) so the workflow type matches the rest of
the project, and run a quick search to ensure all occurrences are consistent.
| class HotelPriceToolConfig(FunctionBaseConfig, name="hotel_price"): | ||
| data_path: str = "examples/frameworks/semantic_kernel_demo/data/hotel_prices.json" | ||
| date_format: str = "%Y-%m-%d" | ||
|
|
||
|
|
||
| class HotelOffer(BaseModel): | ||
| name: str | ||
| price_per_night: float | ||
| total_price: float | ||
| city: str | ||
| checkin: str | ||
| checkout: str | ||
|
|
||
|
|
||
| class HotelOffersResponse(BaseModel): | ||
| offers: list[HotelOffer] | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
fd hotel_price_tool.pyRepository: NVIDIA/NeMo-Agent-Toolkit
Length of output: 194
🏁 Script executed:
cat -n examples/frameworks/microsoft_agent_framework_demo/src/microsoft_agent_framework_demo/hotel_price_tool.pyRepository: NVIDIA/NeMo-Agent-Toolkit
Length of output: 194
Add Google-style docstrings to public classes.
HotelPriceToolConfig, HotelOffer, and HotelOffersResponse lack docstrings and must be documented to comply with the toolkit's guidelines. Add concise Google-style docstrings describing the purpose of each class and its fields:
class HotelOffer(BaseModel):
"""Represents a single hotel offer returned by the `hotel_price` tool."""
name: str
price_per_night: float
total_price: float
city: str
checkin: str
checkout: str| credential = AzureKeyCredential(get_secret_value(llm_config.api_key)) | ||
|
|
||
| llm = AzureOpenAIChatClient( | ||
| # Use 'endpoint' for the API base/URL | ||
| endpoint=llm_config.azure_endpoint, | ||
| # Pass the credential object | ||
| #credential=credential, | ||
| api_key=get_secret_value(llm_config.api_key), | ||
| # Specify the deployment name | ||
| deployment_name=llm_config.azure_deployment, | ||
| # For this client, the model_name argument is less critical than deployment_name | ||
| model_name=llm_config.azure_deployment | ||
| ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused credential variable and commented-out parameter.
Line 54 creates an AzureKeyCredential but it's never used. Line 60 shows the credential parameter is commented out, and api_key is passed directly instead. This suggests incomplete Azure authentication integration.
Either:
- Use the
credentialparameter (uncomment line 60, remove line 61) - Or remove the unused
credentialvariable (lines 52, 54)
Apply this diff if the credential approach is preferred:
- credential = AzureKeyCredential(get_secret_value(llm_config.api_key))
-
llm = AzureOpenAIChatClient(
# Use 'endpoint' for the API base/URL
endpoint=llm_config.azure_endpoint,
# Pass the credential object
- #credential=credential,
- api_key=get_secret_value(llm_config.api_key),
+ credential=AzureKeyCredential(get_secret_value(llm_config.api_key)),📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| credential = AzureKeyCredential(get_secret_value(llm_config.api_key)) | |
| llm = AzureOpenAIChatClient( | |
| # Use 'endpoint' for the API base/URL | |
| endpoint=llm_config.azure_endpoint, | |
| # Pass the credential object | |
| #credential=credential, | |
| api_key=get_secret_value(llm_config.api_key), | |
| # Specify the deployment name | |
| deployment_name=llm_config.azure_deployment, | |
| # For this client, the model_name argument is less critical than deployment_name | |
| model_name=llm_config.azure_deployment | |
| ) | |
| llm = AzureOpenAIChatClient( | |
| # Use 'endpoint' for the API base/URL | |
| endpoint=llm_config.azure_endpoint, | |
| # Pass the credential object | |
| credential=AzureKeyCredential(get_secret_value(llm_config.api_key)), | |
| # Specify the deployment name | |
| deployment_name=llm_config.azure_deployment, | |
| # For this client, the model_name argument is less critical than deployment_name | |
| model_name=llm_config.azure_deployment | |
| ) |
🧰 Tools
🪛 Ruff (0.14.7)
54-54: Local variable credential is assigned to but never used
Remove assignment to unused variable credential
(F841)
🤖 Prompt for AI Agents
packages/nvidia_nat_maf/src/nat/plugins/maf/llm.py around lines 54 to 66: the
AzureKeyCredential instance is created but never used because the client call
passes api_key and has the credential parameter commented out; fix by using the
credential approach — uncomment the credential parameter and remove the api_key
argument from AzureOpenAIChatClient so the client is constructed with
credential=credential (and remove any now-unused direct api_key usage), or
alternatively delete the unused AzureKeyCredential creation if you prefer the
api_key approach.
| @register_tool_wrapper(wrapper_type=LLMFrameworkEnum.MICROSOFT_AGENT_FRAMEWORK) # 1. Changed framework type | ||
| def microsoft_agent_framework_tool_wrapper(name: str, fn: Function, builder: Builder): | ||
| """ | ||
| Wraps a nat Function into an OpenAI-compatible function schema | ||
| for use with the Microsoft Agent Framework. | ||
| """ | ||
|
|
||
| # MAF/OpenAI tools expect a callable and a schema (dict). | ||
| # We define the callable here and the schema below. | ||
| async def callable_ainvoke(*args, **kwargs): | ||
| """Standard asynchronous tool invocation.""" | ||
| return await fn.acall_invoke(*args, **kwargs) | ||
|
|
||
| # MAF tools typically don't directly stream; they are usually defined | ||
| # as single-call functions in the schema. We'll prioritize the single | ||
| # invoke path for simplicity and MAF convention. | ||
|
|
||
| def generate_openai_function_schema(nat_function: Function, function_name: str) -> dict[str, Any]: | ||
| """ | ||
| Generates an OpenAI-compatible function schema dictionary. | ||
| This is the format MAF tools often expect. | ||
| """ | ||
|
|
||
| # 2. Extract properties for the function schema | ||
| input_schema = nat_function.input_schema.model_fields | ||
| required_params = [] | ||
| properties = {} | ||
|
|
||
| for arg_name, annotation in input_schema.items(): | ||
| type_obj = resolve_type(annotation.annotation) | ||
|
|
||
| # MAF/OpenAI schema doesn't support complex nested types well; | ||
| # we check but still generate the schema for the root function. | ||
| if isinstance(type_obj, type) and (issubclass(type_obj, BaseModel) or is_dataclass(type_obj)): | ||
| # Complex type warning: MAF might struggle with these parameters | ||
| logger.warning( | ||
| "Nested non-native model detected in input schema for parameter: %s. " | ||
| "This may not be fully supported by the MAF model.", | ||
| arg_name) | ||
|
|
||
| param_type = get_type_info(annotation.annotation) | ||
|
|
||
| # Map Python/Pydantic type info to OpenAI schema properties | ||
| param_def = { | ||
| "type": param_type, | ||
| # Description often comes from the Pydantic field's description/docstring | ||
| "description": annotation.description or f"Parameter {arg_name} of type {param_type}.", | ||
| } | ||
| properties[arg_name] = param_def | ||
|
|
||
| if annotation.is_required(): | ||
| required_params.append(arg_name) | ||
|
|
||
| schema = { | ||
| "type": "function", | ||
| "function": { | ||
| "name": function_name, | ||
| "description": nat_function.description, | ||
| "parameters": { | ||
| "type": "object", | ||
| "properties": properties, | ||
| "required": required_params, | ||
| } | ||
| } | ||
| } | ||
| return schema | ||
|
|
||
|
|
||
| # 3. Generate the tool schema and return the callable alongside it. | ||
| tool_schema = generate_openai_function_schema(nat_function=fn, function_name=name) | ||
|
|
||
| # The MAF/OpenAI format returns a list of tools, where each tool is a dict | ||
| # containing the callable and the schema. | ||
| # The return format should be a dict of {tool_name: (callable, tool_schema_dict)} | ||
| # or just {tool_name: callable} depending on the exact MAF wrapper expectation. | ||
| # No newline at end of file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: Function implementation is incomplete.
The microsoft_agent_framework_tool_wrapper function ends abruptly at line 149 without a return statement. This will cause a syntax error and prevents the wrapper from functioning.
Additionally:
- Missing type hints on the return value (coding guidelines require type hints for all public functions)
- The
builderparameter is unused (static analysis flag) - The
tool_schemavariable is assigned but never used (line 143)
Please complete the function implementation with:
- A proper return statement
- Type hints on the return value
- Either use the
builderandtool_schemavariables or remove them - Complete docstring explaining the return format
🧰 Tools
🪛 Ruff (0.14.7)
75-75: Unused function argument: builder
(ARG001)
143-143: Local variable tool_schema is assigned to but never used
Remove assignment to unused variable tool_schema
(F841)
🤖 Prompt for AI Agents
packages/nvidia_nat_maf/src/nat/plugins/maf/tool_wrapper.py around lines 74 to
149: the microsoft_agent_framework_tool_wrapper ends without a return, lacks a
return type hint, leaves builder unused and tool_schema unused; add a complete
docstring describing the return format (e.g. mapping tool name to (callable,
schema) or list of tool dicts per MAF expectations), add an explicit return type
hint (e.g. -> dict[str, tuple[Callable[..., Any], dict[str, Any]]] or the
correct alias used in the repo), either use the builder (e.g. to mutate or
annotate the schema) or remove the parameter to satisfy static analysis, ensure
tool_schema is returned/embedded in the returned structure alongside
callable_ainvoke, and include the missing return statement that returns the
properly typed tool mapping.
| # ---------------------------- | ||
|
|
||
|
|
||
| async def test_semantic_kernel_tool_wrapper_simple_arguments(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing required @pytest.mark.asyncio decorator.
Based on learnings, the project uses pytest-asyncio in strict mode, which requires the @pytest.mark.asyncio decorator on all async test functions.
Apply this diff:
+@pytest.mark.asyncio
async def test_semantic_kernel_tool_wrapper_simple_arguments():📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async def test_semantic_kernel_tool_wrapper_simple_arguments(): | |
| @pytest.mark.asyncio | |
| async def test_semantic_kernel_tool_wrapper_simple_arguments(): |
🤖 Prompt for AI Agents
In packages/nvidia_nat_maf/tests/test_sk_decorator.py around line 117, the async
test function test_semantic_kernel_tool_wrapper_simple_arguments is missing the
required @pytest.mark.asyncio decorator; add @pytest.mark.asyncio immediately
above the async def, and ensure pytest is imported in the file (add import
pytest at the top if not already present) so pytest-asyncio strict mode will run
the test correctly.
| assert return_type == 'int' | ||
|
|
||
|
|
||
| async def test_semantic_kernel_tool_wrapper_nested_base_model(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing required @pytest.mark.asyncio decorator.
Apply this diff:
+@pytest.mark.asyncio
async def test_semantic_kernel_tool_wrapper_nested_base_model():🤖 Prompt for AI Agents
In packages/nvidia_nat_maf/tests/test_sk_decorator.py around line 153, the async
test function test_semantic_kernel_tool_wrapper_nested_base_model is missing the
required @pytest.mark.asyncio decorator; add @pytest.mark.asyncio directly above
the async def and ensure pytest is imported at the top of the test module (add
"import pytest" if it's not already present) so the coroutine test runs under
pytest's asyncio plugin.
| assert return_type == 'int' | ||
|
|
||
|
|
||
| async def test_semantic_kernel_tool_wrapper_streaming(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing required @pytest.mark.asyncio decorator.
Apply this diff:
+@pytest.mark.asyncio
async def test_semantic_kernel_tool_wrapper_streaming():📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| async def test_semantic_kernel_tool_wrapper_streaming(): | |
| @pytest.mark.asyncio | |
| async def test_semantic_kernel_tool_wrapper_streaming(): |
🤖 Prompt for AI Agents
In packages/nvidia_nat_maf/tests/test_sk_decorator.py around line 186, the async
test function test_semantic_kernel_tool_wrapper_streaming is missing the
required @pytest.mark.asyncio decorator; add @pytest.mark.asyncio immediately
above the async def, and ensure pytest is imported at the top of the file (add
"import pytest" if absent) so the async test runs under pytest's asyncio plugin.
| dependencies = [ | ||
| # Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum | ||
| # version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages. | ||
| # Keep sorted!!! | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't there be MAF dependencies in here?
| dependencies = [ | ||
| # Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum | ||
| # version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages. | ||
| # Keep sorted!!! | ||
| ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| dependencies = [ | |
| # Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum | |
| # version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages. | |
| # Keep sorted!!! | |
| ] | |
| dependencies = [ | |
| # Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum | |
| # version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages. | |
| # Keep sorted!!! | |
| # | |
| # MAF is currently in beta, replace with a release version once we have one | |
| "agent-framework~=1.0.0b" | |
| ] |
Description
Closes
By Submitting this PR I confirm:
Summary by CodeRabbit
Release Notes
✏️ Tip: You can customize this high-level summary in your review settings.