Skip to content

refactor(evaluator-sdk): migrate Fabric agent-eval runtime to the updated Fabric SDK#648

Merged
SandyChapman merged 1 commit into
mainfrom
fabric-client-to-fabric/schapman
Jul 14, 2026
Merged

refactor(evaluator-sdk): migrate Fabric agent-eval runtime to the updated Fabric SDK#648
SandyChapman merged 1 commit into
mainfrom
fabric-client-to-fabric/schapman

Conversation

@SandyChapman

@SandyChapman SandyChapman commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

What & why

Aligns the host FabricAgentRuntime (agent_eval/runtimes/fabric/) with the current NeMo Fabric Python SDK. The SDK renamed its client, moved to a config-first composition model, and introduced the RunOutput response contract — this branch migrates our runtime to match and keeps everything importable/testable without the (still optional, unlocked) nemo-fabric native package.

Key changes

  • FabricClientFabric. Fabric is a plain reusable facade (not an async context manager); per-invocation input + request_id now go through RunRequest.
  • Config-first composition. Per-task workspace / model / trajectory settings are applied directly onto a copied FabricConfig (model_copy + environment + enable_relay) instead of layered profile overlays. The old profile-builder helpers are removed; caller-supplied profiles= still pass through.
  • RunOutput response contract (chore(release): bump platform version to 0.1.1 #52). RunResult.output is now a RunOutput (a Mapping), not a raw JSON value. _normalize_output copies it to a plain dict so it round-trips through the trial's JsonValue response field.
  • Lazy imports, not threaded types. nemo_fabric stays an optional lazy import (guarded in run_tasks); helpers re-import the two runtime types locally where used rather than threading type[...] params through signatures. Annotations name the real SDK types via the TYPE_CHECKING import.
  • Dev script fix. script/dev-install-fabric.sh smoke check updated FabricClientFabric.

Verification

  • Hermetic tests (fake nemo_fabric, run in CI): green — runner → evaluator → metric → evidence chain.
  • Live end-to-end: test_fabric_codex_live_eval_captures_atif_trajectory passed — a real codex agent run through the migrated runtime → relay → ATIF trajectory → metric.
  • ruff (check + format), copyright headers, merge-conflict, and ty (CI config) clean for all changed files.

Notes

  • Only the codex harness was exercised live this session; the Hermes-SDK path is covered by the hermetic tests but not a live run.
  • nemo-fabric remains an optional lazy import because there is no published, cross-platform, indexed wheel to lock yet (its CI builds Linux-only artifacts, unpublished). CI stays on the ty: ignore[unresolved-import] path; local dev uses script/dev-install-fabric.sh.
  • The container runtime (container_runtime.py, feat(evaluator-sdk): sandboxed containerized Fabric runner (AALGO-321) #604) is a separate, unmerged branch and still needs the same migration — out of scope here.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features
    • Improved agent evaluation runs with a config-first Fabric setup and a reusable Fabric session.
    • Enhanced trajectory/relay capture using task-specific workspace and per-task evidence/artifact locations.
    • Normalized structured Fabric run outputs into standard trial response fields.
  • Bug Fixes
    • Added fail-fast validation for trajectory capture dependencies when relay is enabled.
  • Tests
    • Updated Fabric runtime/integration tests and hermetic Fabric fakes to match new config composition, workspace handling, relay settings, and output normalization.
  • Chores
    • Updated the Fabric dev-install verification script to use the current public Fabric API.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: 82cd92d4-e4a6-4d7b-9b21-52e24ff735ab

📥 Commits

Reviewing files that changed from the base of the PR and between 0235501 and 44720ca.

⛔ Files ignored due to path filters (1)
  • sdk/python/nemo-platform/src/nemo_platform/beta/evaluator/agent_eval/runtimes/fabric/runtime.py is excluded by !sdk/**
📒 Files selected for processing (4)
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_integration.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_runtime.py
  • script/dev-install-fabric.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • script/dev-install-fabric.sh
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_integration.py
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py

📝 Walkthrough

Walkthrough

Changes

Fabric Config-First Runtime

Layer / File(s) Summary
Config composition and Relay wiring
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_runtime.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_integration.py
Per-task configs clone base settings, apply workspace/model values, configure Relay and artifact roots, and validate evaluator-owned settings.
Reusable Fabric task execution
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_integration.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_runtime.py, script/dev-install-fabric.sh
Execution uses a reusable Fabric client and RunRequest, with lazy imports, staged workspaces, updated fakes, and the revised verification API.
Run output normalization
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py, packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_runtime.py
Mapping-shaped RunOutput values are normalized before populating trial response and output text fields.

Sequence Diagram(s)

sequenceDiagram
  participant FabricAgentRuntime
  participant Workspace
  participant Fabric
  FabricAgentRuntime->>Workspace: seed task workspace
  FabricAgentRuntime->>Fabric: run request with composed task config
  Fabric-->>FabricAgentRuntime: return task result
  FabricAgentRuntime->>FabricAgentRuntime: normalize RunOutput
Loading

Suggested reviewers: arpitsardhana

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: migrating the evaluator runtime to the updated Fabric SDK.
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 fabric-client-to-fabric/schapman

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 (1)
packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py (1)

47-56: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

TYPE_CHECKING-only imports of Fabric SDK types.

Fabric, FabricConfig, FabricProfileConfig, RunOutput are imported only under TYPE_CHECKING and then used as concrete annotations (client: Fabric, agent_config: FabricConfig, output: RunOutput | JsonValue, etc.) throughout the file. The comment justifies this via the optional-dependency constraint, but the coding guideline explicitly prohibits TYPE_CHECKING-only imports for these types.

As per coding guidelines, "In Python code, prefer concrete type hints over string-based type hints, and do not import those types only under TYPE_CHECKING; import them normally when possible."

♻️ Alternative that keeps the optional-dependency guard while importing normally
-if TYPE_CHECKING:
-    # Annotations use nemo_fabric's real types (single source of truth). nemo_fabric is an optional
-    # native package not yet in our locked dependency set, so it is imported for typing only and
-    # loaded lazily at runtime (see ``run_tasks``). Drop the ty:ignore once nemo-fabric is a
-    # resolvable dependency and the checker can see it.
-    from nemo_fabric import (  # ty: ignore[unresolved-import]
-        Fabric,
-        FabricConfig,
-        FabricProfileConfig,
-        RunOutput,
-    )
+try:
+    from nemo_fabric import Fabric, FabricConfig, FabricProfileConfig, RunOutput  # ty: ignore[unresolved-import]
+except ImportError:  # nemo_fabric is an optional native dependency, not yet locked
+    Fabric = FabricConfig = FabricProfileConfig = RunOutput = Any  # type: ignore[assignment,misc]
🤖 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
`@packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py`
around lines 47 - 56, Replace the TYPE_CHECKING-only import block for Fabric,
FabricConfig, FabricProfileConfig, and RunOutput with normal imports, while
preserving the existing lazy runtime behavior for the optional nemo_fabric
dependency as required by run_tasks. Keep the concrete annotations on client,
agent_config, output, and related symbols intact, and remove the obsolete
justification and ignore directive.

Source: Coding guidelines

🤖 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
`@packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py`:
- Around line 47-56: Replace the TYPE_CHECKING-only import block for Fabric,
FabricConfig, FabricProfileConfig, and RunOutput with normal imports, while
preserving the existing lazy runtime behavior for the optional nemo_fabric
dependency as required by run_tasks. Keep the concrete annotations on client,
agent_config, output, and related symbols intact, and remove the obsolete
justification and ignore directive.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 25aa81c3-0351-43c9-8a30-32a76687cf09

📥 Commits

Reviewing files that changed from the base of the PR and between 275c8cd and 1edeee6.

📒 Files selected for processing (4)
  • packages/nemo_evaluator_sdk/src/nemo_evaluator_sdk/agent_eval/runtimes/fabric/runtime.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_integration.py
  • packages/nemo_evaluator_sdk/tests/agent_eval/test_fabric_runtime.py
  • script/dev-install-fabric.sh

@SandyChapman SandyChapman force-pushed the fabric-client-to-fabric/schapman branch from 1edeee6 to caa6876 Compare July 13, 2026 15:24
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 23867/31033 76.9% 61.7%
Integration Tests 13818/29682 46.6% 19.6%

@SandyChapman SandyChapman force-pushed the fabric-client-to-fabric/schapman branch 2 times, most recently from 99ac2d1 to 0235501 Compare July 13, 2026 20:10
…ated Fabric SDK

Align the host FabricAgentRuntime with the current NeMo Fabric Python SDK:

- Rename FabricClient -> Fabric (a reusable facade, not an async context
  manager); fold per-invocation input and request id into RunRequest.
- Compose each task's workspace/model/trajectory settings directly onto a
  copied FabricConfig (config-first: model_copy + environment + enable_relay)
  instead of layering profile overlays; drop the profile-builder helpers.
- Handle the RunOutput response contract: RunResult.output is now a RunOutput
  Mapping, so normalize it to a plain dict for the JsonValue trial response.
- Keep nemo_fabric an optional lazy import (still not a locked dependency);
  re-import the two runtime types locally where used rather than threading
  them through helper signatures.
- Fix the dev-install-fabric.sh smoke check (FabricClient -> Fabric).

Verified: hermetic tests (fake nemo_fabric) pass, and a live codex end-to-end
run (test_fabric_codex_live_eval_captures_atif_trajectory) captures an ATIF
trajectory through the migrated runtime.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
@SandyChapman SandyChapman force-pushed the fabric-client-to-fabric/schapman branch from 0235501 to 44720ca Compare July 14, 2026 11:25
@SandyChapman SandyChapman enabled auto-merge July 14, 2026 11:33
@SandyChapman SandyChapman added this pull request to the merge queue Jul 14, 2026
SandyChapman added a commit that referenced this pull request Jul 14, 2026
…ic agent-eval

Add optional agent-skill injection to FabricAgentRuntime for A/B skill evals:
inject an agentskills.io bundle into every task — native harnesses via a per-task
`skills` profile overlay pointing at the staged bundle; codex via workspace
`.agents/skills/<name>/` self-injection — stamp skill provenance (name + content
hash + mode) on each trial, and add `with_skill()` to derive baseline vs. skilled
runtimes from one instance. Per-run evidence is isolated under a generated run id
so baseline and skilled runs sharing a work_root don't collide.

SkillUsedMetric scores whether an expected skill was present and used, so a
skill-required task fails when the agent ignores the skill.

Ported onto the config-first Fabric runtime (stacked on #648); adds skills.py,
tests, and a runnable example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
SandyChapman added a commit that referenced this pull request Jul 14, 2026
…ic agent-eval

Add optional agent-skill injection to FabricAgentRuntime for A/B skill evals:
inject an agentskills.io bundle into every task — native harnesses via a per-task
`skills` profile overlay pointing at the staged bundle; codex via workspace
`.agents/skills/<name>/` self-injection — stamp skill provenance (name + content
hash + mode) on each trial, and add `with_skill()` to derive baseline vs. skilled
runtimes from one instance. Per-run evidence is isolated under a generated run id
so baseline and skilled runs sharing a work_root don't collide.

SkillUsedMetric scores whether an expected skill was present and used, so a
skill-required task fails when the agent ignores the skill.

Ported onto the config-first Fabric runtime (stacked on #648); adds skills.py,
tests, and a runnable example.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Sandy Chapman <schapman@nvidia.com>
Merged via the queue into main with commit f713b1e Jul 14, 2026
57 checks passed
@SandyChapman SandyChapman deleted the fabric-client-to-fabric/schapman branch July 14, 2026 11:47
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