Skip to content

feat(nemo-agents): serve Fabric agents via Docker and Kubernetes deployments - #979

Merged
tylersbray merged 2 commits into
mainfrom
AIRCORE-947-fabric-agent-serving-docker-k8s/tbray
Jul 30, 2026
Merged

feat(nemo-agents): serve Fabric agents via Docker and Kubernetes deployments#979
tylersbray merged 2 commits into
mainfrom
AIRCORE-947-fabric-agent-serving-docker-k8s/tbray

Conversation

@tylersbray

@tylersbray tylersbray commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extend DeploymentsRunnerBackend so nemo-agents-spec-v1 agents compile to the Platform Fabric FastAPI shim (python -m nemo_agents_plugin.fabric.server) for Docker and Kubernetes, with agent.yaml injection/mount and /health readiness.
  • Add rewrite_fabric_config_base_urls() so Fabric model/harness IGW URLs are rebased for container reachability (including auth-proxy), parallel to the existing NAT rewriter.
  • Leave NAT nat start fastapi container behavior unchanged; add unit coverage for Fabric docker/k8s compile, rewrite, create, and auth-proxy paths.

Closes AIRCORE-947.

Test plan

  • uv run --frozen pytest plugins/nemo-agents/tests/unit/test_runner_deployments.py -v (44 passed)
  • Gateway unit tests still green with deployment suite
  • ty check / pre-commit hooks on commit
  • CI on this PR
  • Live Fabric container deploy once AIRCORE-902 ships Fabric in the default image (full matrix: AIRCORE-960)

Summary by CodeRabbit

  • New Features
    • Added support for deploying Fabric agent configurations in Docker and Kubernetes.
    • Fabric deployments now start with the correct Fabric server entrypoint and configuration wiring for the target platform.
    • Automatically rebases Fabric model and harness base_url values to the inference gateway host when applicable.
    • When enabled, Fabric deployments can route base_url rewriting through an auth proxy.
  • Bug Fixes
    • Clarified deployment configuration descriptions for the agent server listen port and the configuration mount path behavior for Fabric vs workflow deployments.

@tylersbray
tylersbray requested review from a team as code owners July 29, 2026 21:31
@github-actions github-actions Bot added the feat label Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 3dd5b74b-301f-444f-9fe1-f5ecf24ef265

📥 Commits

Reviewing files that changed from the base of the PR and between e337834 and 5b8f8bd.

📒 Files selected for processing (3)
  • plugins/nemo-agents/src/nemo_agents_plugin/config.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
  • plugins/nemo-agents/tests/unit/test_runner_deployments.py
🚧 Files skipped from review as they are similar to previous changes (1)
  • plugins/nemo-agents/src/nemo_agents_plugin/config.py

📝 Walkthrough

Walkthrough

Fabric deployments now support Fabric-specific configuration paths, server commands, gateway URL rewriting, runtime labels, Docker/Kubernetes wiring, and auth-proxy behavior. Configuration descriptions and deployment tests were updated accordingly.

Changes

Fabric deployment support

Layer / File(s) Summary
Fabric config handling
plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
Detects Fabric configs, rewrites model and harness gateway URLs, computes mount paths, and builds Fabric server arguments.
Docker and Kubernetes deployment compilation
plugins/nemo-agents/src/nemo_agents_plugin/config.py, plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
Selects Fabric or NAT config paths, environment variables, server commands, materialized files, runtime labels, and updated mount descriptions.
Fabric deployment tests
plugins/nemo-agents/tests/unit/test_runner_deployments.py
Tests URL rewriting, Docker/Kubernetes startup wiring, NAT compatibility, and auth-proxy URL rewriting.

Sequence Diagram(s)

sequenceDiagram
  participant create_deployment
  participant build_deployment_config
  participant FabricServer
  create_deployment->>build_deployment_config: agent_config and deployment mode
  build_deployment_config->>FabricServer: agent.yaml path and server command
  FabricServer-->>create_deployment: deployment configuration
Loading

Possibly related PRs

Suggested labels: refactor, test

Suggested reviewers: mckornfield, ngoncharenko, stefan-kickoff

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: serving Fabric agents through Docker and Kubernetes deployments.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AIRCORE-947-fabric-agent-serving-docker-k8s/tbray

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

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (2)
plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py (2)

266-266: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Rename nat_config to agent_config.

The parameter now accepts either a NAT workflow config or a Fabric spec; the name misleads at every call site.

🤖 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 `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py` at
line 266, Rename the deployments backend parameter nat_config to agent_config
and update every reference and call site consistently, preserving its support
for both NAT workflow configurations and Fabric specs.

324-367: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Derive the env-var name from the constant and factor out the shared materialization shell.

Line 331 hardcodes $AGENT_CONFIG_YAML while line 327 uses _AGENT_CONFIG_YAML_ENV; renaming the constant silently breaks the container. Both branches also duplicate the same mkdir -p && printf && exec shape.

♻️ Suggested consolidation
+def _materialize_and_exec(*, config_path: str, yaml_env: str, argv: list[str]) -> list[str]:
+    return [
+        f'mkdir -p "$(dirname "{config_path}")" '
+        f'&& printf "%s" "${yaml_env}" > "{config_path}" '
+        f"&& exec {' '.join(argv)}"
+    ]
     if is_fabric:
         fabric_args = ["python", *_fabric_server_cli_args(config_path=config_path, port=port)]
         if mode == "docker":
             env.append(EnvVar(name=_AGENT_CONFIG_YAML_ENV, value=config_yaml))
             command = ["sh", "-c"]
-            args = [
-                f'mkdir -p "$(dirname "{config_path}")" '
-                f'&& printf "%s" "$AGENT_CONFIG_YAML" > "{config_path}" '
-                f"&& exec {' '.join(fabric_args)}"
-            ]
+            args = _materialize_and_exec(
+                config_path=config_path, yaml_env=_AGENT_CONFIG_YAML_ENV, argv=fabric_args
+            )
🤖 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 `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`
around lines 324 - 367, Update the docker handling in the deployment runner to
derive the shell variable reference from _AGENT_CONFIG_YAML_ENV instead of
hardcoding AGENT_CONFIG_YAML, so it remains aligned with the EnvVar name. Factor
the shared mkdir/printf/exec materialization command used by the fabric and NAT
branches into a reusable local helper or shared construction, while preserving
each branch’s config path, environment variable, and executable arguments.
🤖 Prompt for all review comments with 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.

Nitpick comments:
In `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`:
- Line 266: Rename the deployments backend parameter nat_config to agent_config
and update every reference and call site consistently, preserving its support
for both NAT workflow configurations and Fabric specs.
- Around line 324-367: Update the docker handling in the deployment runner to
derive the shell variable reference from _AGENT_CONFIG_YAML_ENV instead of
hardcoding AGENT_CONFIG_YAML, so it remains aligned with the EnvVar name. Factor
the shared mkdir/printf/exec materialization command used by the fabric and NAT
branches into a reusable local helper or shared construction, while preserving
each branch’s config path, environment variable, and executable arguments.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: f7466eac-6b6e-48ad-95e4-100852a3afcc

📥 Commits

Reviewing files that changed from the base of the PR and between b671a20 and 83ee96a.

📒 Files selected for processing (3)
  • plugins/nemo-agents/src/nemo_agents_plugin/config.py
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
  • plugins/nemo-agents/tests/unit/test_runner_deployments.py

@github-actions

github-actions Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 28393/36233 78.4% 62.8%
Integration Tests 16982/34951 48.6% 21.1%

@tylersbray
tylersbray requested a review from mmogallapalli July 29, 2026 22:18
Comment thread plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py Outdated
tylersbray added a commit that referenced this pull request Jul 30, 2026
…onfig materialization

Rename build_deployment_config's nat_config to agent_config now that it accepts
both NAT workflow configs and Fabric specs, and derive the docker shell config
variable from the EnvVar constants via a shared materialize-and-exec helper so
the two branches cannot drift.

Addresses review feedback on #979.

Signed-off-by: Tyler Bray <tbray@nvidia.com>

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py`:
- Around line 227-234: Update _materialize_config_and_exec to shell-escape every
dynamic value with shlex.quote before constructing the command: quote
config_path consistently in both mkdir/printf usage and quote each argv element
before joining for exec. Preserve the existing command sequence and YAML
environment expansion behavior while ensuring paths and arguments containing
spaces, quotes, or shell metacharacters are passed literally.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 26b3234e-b78f-4f20-a220-7d923b21a182

📥 Commits

Reviewing files that changed from the base of the PR and between 83ee96a and e337834.

📒 Files selected for processing (2)
  • plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py
  • plugins/nemo-agents/tests/unit/test_runner_deployments.py

Comment thread plugins/nemo-agents/src/nemo_agents_plugin/runner/deployments_backend.py Outdated

@mmogallapalli mmogallapalli left a comment

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.

LGTM, thanks for taking this on. I’ll handle the packaging/dependency wiring in a follow-up PR shortly.

…oyments

Branch DeploymentsRunnerBackend compile/rewrite on nemo-agents-spec-v1 so
container modes start the Fabric FastAPI shim with agent.yaml, while leaving
NAT nat start fastapi paths unchanged.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
…onfig materialization

Rename build_deployment_config's nat_config to agent_config now that it accepts
both NAT workflow configs and Fabric specs, and derive the docker shell config
variable from the EnvVar constants via a shared materialize-and-exec helper so
the two branches cannot drift.

Addresses review feedback on #979.

Signed-off-by: Tyler Bray <tbray@nvidia.com>
@tylersbray
tylersbray force-pushed the AIRCORE-947-fabric-agent-serving-docker-k8s/tbray branch from e337834 to 5b8f8bd Compare July 30, 2026 19:58
@tylersbray
tylersbray added this pull request to the merge queue Jul 30, 2026
Merged via the queue into main with commit 66a1dc4 Jul 30, 2026
60 checks passed
@tylersbray
tylersbray deleted the AIRCORE-947-fabric-agent-serving-docker-k8s/tbray branch July 30, 2026 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants