Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Dockerfile.agentic-base
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,13 @@ RUN /app/.venv/bin/python -c "import nmp.core.jobs; import nmp.core.entities; pr
# - nvidia-nat-mcp: mcp_client function type support.
# - plugins/nemo-agents: exposes `nemo agents ...` commands.
# - examples/calculator-agent: registers `_type: calculator` function group.
RUN uv pip install --python /app/.venv/bin/python "nvidia-nat[most]" nvidia-nat-atif nvidia-nat-eval nvidia-nat-mcp && \
#
# All nvidia-nat* packages MUST be pinned to the same version. The CLI/meta
# package historically lagged the plugin packages (e.g. nvidia-nat==1.4.3 vs
# nvidia-nat-core/eval/langchain==1.7.0), which caused ImportErrors at plugin
# discovery (e.g. register_dataset_loader) and crashed `nat start fastapi`.
RUN uv pip install --python /app/.venv/bin/python \
"nvidia-nat[most]==1.7.0" nvidia-nat-atif==1.7.0 nvidia-nat-eval==1.7.0 nvidia-nat-mcp==1.7.0 && \

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is there a way this can be enforced in one place, i.e., a text file or smth we copy in? this is good to fix though

uv pip install --python /app/.venv/bin/python -e /app/plugins/nemo-agents && \
uv pip install --python /app/.venv/bin/python -e /app/plugins/nemo-agents/examples/calculator-agent && \
chown -R harbor:harbor /app/.venv
Expand Down
58 changes: 58 additions & 0 deletions tests/agentic-use/tests/test_nat_version_consistency.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

"""Guard against nvidia-nat package-family version drift.

The agentic-base image installs the NAT family unpinned (see
Dockerfile.agentic-base / tests/agentic-use/requirements-nat.txt). The CLI/meta
package historically lagged the plugin packages (e.g. ``nvidia-nat==1.4.3`` vs
Comment on lines +6 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Update stale docstring claim about pinning.

Line 6 says NAT is installed “unpinned,” but Dockerfile.agentic-base now pins nvidia-nat* to 1.7.0. Update this text to reflect current behavior.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@tests/agentic-use/tests/test_nat_version_consistency.py` around lines 6 - 8,
The docstring in the test file incorrectly states that the agentic-base image
installs the NAT family "unpinned," but this is outdated since
Dockerfile.agentic-base now pins nvidia-nat to 1.7.0. Update the docstring text
starting with "The agentic-base image installs the NAT family unpinned" to
accurately reflect that NAT is currently pinned to version 1.7.0 in the
Dockerfile.

``nvidia-nat-core``/``-eval``/``-langchain==1.7.0``), which silently produced
``ImportError: cannot import name 'register_dataset_loader'`` at plugin
discovery and crashed ``nat start fastapi`` with exit code 1 — only surfacing in
slow, GPU-bound end-to-end runs.

This is the cheapest layer that can catch the mismatch: enumerate the installed
``nvidia-nat*`` distributions and assert they all report the same version.
"""

from __future__ import annotations

from importlib import metadata

import pytest


def _nat_distributions() -> dict[str, str]:
"""Return {normalized_name: version} for every installed nvidia-nat* dist."""
found: dict[str, str] = {}
for dist in metadata.distributions():
name = dist.metadata["Name"]
if not name:
continue
normalized = name.lower().replace("_", "-")
if normalized == "nvidia-nat" or normalized.startswith("nvidia-nat-"):
found[normalized] = dist.version
return found


def test_nvidia_nat_family_versions_are_aligned() -> None:
"""All installed nvidia-nat* packages must share the same version.

Skips when NAT is not installed (NAT lives in an isolated venv and is only
present in the agentic-base image / the .venv-nat dev environment).
"""
dists = _nat_distributions()
if not dists:
pytest.skip("No nvidia-nat* packages installed; NAT runs in an isolated venv.")

versions = set(dists.values())
if len(versions) > 1:
detail = "\n".join(f" {name}=={version}" for name, version in sorted(dists.items()))
pytest.fail(
"nvidia-nat package family version mismatch — all nvidia-nat* packages "
"must be pinned to the same version (a lagging meta/CLI package crashes "
"`nat start fastapi` at plugin discovery):\n"
f"{detail}\n"
"Pin every nvidia-nat* package to one version in Dockerfile.agentic-base "
"and tests/agentic-use/requirements-nat.txt."
)