feat(nemo-agents): add fabric invocation wrapper and request/result objects#796
Conversation
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughChangesAdds a Fabric runtime boundary with typed requests/results, timeout and execution error mapping, invocation context propagation, recursive result normalization, and unit tests for lifecycle, timeout, failure, and conversion behavior. Fabric runtime integration
Sequence Diagram(s)sequenceDiagram
participant Caller
participant run_fabric_agent_once
participant Fabric
participant FabricRuntime
Caller->>run_fabric_agent_once: FabricRuntimeRequest
run_fabric_agent_once->>Fabric: start_runtime(config, base_dir, overrides)
Fabric-->>run_fabric_agent_once: ephemeral FabricRuntime
run_fabric_agent_once->>FabricRuntime: invoke(RunRequest with input, context, request_id)
FabricRuntime-->>run_fabric_agent_once: RunResult
run_fabric_agent_once-->>Caller: FabricRuntimeResult or mapped exception
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
plugins/nemo-agents/tests/unit/test_fabric_runtime.py (1)
52-86: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
invoke_errorfixture support is never exercised.
_FakeRuntimesupports raising an error frominvoke()(Lines 57, 61, 83-84), but no test in this file setsinvoke_error. Only the start-timeFabricErrorpath (test_wraps_fabric_lifecycle_errors) is covered — invoke-timeFabricErrorhandling inside theasync withblock is untested.async def test_wraps_fabric_lifecycle_errors_during_invoke(self) -> None: fake_runtime = _FakeRuntime(invoke_error=fabric_runtime.FabricError("invoke failed")) fake_fabric = _FakeFabric(runtime=fake_runtime) request = FabricRuntimeRequest( fabric_config=cast(FabricConfig, object()), base_dir=Path("/tmp/agent"), ) with pytest.raises(FabricRuntimeExecutionError, match="Fabric runtime invocation failed: invoke failed"): await run_fabric_agent_once(request, fabric=fake_fabric) assert fake_runtime.exited is True🤖 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/tests/unit/test_fabric_runtime.py` around lines 52 - 86, Add a unit test beside test_wraps_fabric_lifecycle_errors that configures _FakeRuntime with invoke_error set to FabricError and executes run_fabric_agent_once. Assert FabricRuntimeExecutionError is raised with the expected invocation-failure message, and verify fake_runtime.exited is true to confirm async context cleanup.
🤖 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/tests/unit/test_fabric_runtime.py`:
- Around line 52-86: Add a unit test beside test_wraps_fabric_lifecycle_errors
that configures _FakeRuntime with invoke_error set to FabricError and executes
run_fabric_agent_once. Assert FabricRuntimeExecutionError is raised with the
expected invocation-failure message, and verify fake_runtime.exited is true to
confirm async context cleanup.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 5f94584f-4f46-41e5-b3a0-f5264f6ce0e3
📒 Files selected for processing (2)
plugins/nemo-agents/src/nemo_agents_plugin/fabric/runtime.pyplugins/nemo-agents/tests/unit/test_fabric_runtime.py
|
mikeknep
left a comment
There was a problem hiding this comment.
LGTM, just one nit, you can take it or leave it
Signed-off-by: Manjesh Mogallapalli <mmogallapall@nvidia.com>
15f24a2 to
435de37
Compare
Summary
This PR adds the initial thin Platform runtime wrapper for Fabric-backed NeMo Agents as part of AIRCORE-898.
The main boundary established here is:
The wrapper accepts an already-translated in-memory
FabricConfig, starts an ephemeral Fabric runtime, invokes it once, relies on Fabric's async runtime context manager for cleanup, and normalizes the returnedRunResultinto a Platform-owned result shape.Changes
FabricRuntimeRequestas the internal Platform invocation request shape.FabricRuntimeResultas the normalized Platform result shape for Fabric invocations.run_fabric_agent_once(...)for one-shot execution throughFabric.start_runtime(...).input,request_id, andcaller_contextinto FabricRunRequest.RunResultvalues.Scope Boundary
This PR intentionally does not wire the wrapper into any user-facing
nemo agentsCLI/API flow yet.Out of scope:
Those are covered by follow-up AIRCORE-895 tickets. Managed multi-turn runtime/session lifecycle is tracked separately in AIRCORE-932.
Fabric Integration Notes
This follows the Fabric integration guidance by:
nemo_fabricimports.FabricConfigdirectly to Fabric.base_dirthrough for relative config paths.runtime_id,invocation_id, andrequest_idas opaque correlation IDs.RunResultvalues separately from SDK lifecycle exceptions.The one conscious Platform choice is to use
Fabric.start_runtime(...)for the one-shot wrapper instead ofFabric.run(...), so the internal Platform boundary is built around the same runtime primitive that future managed-runtime support will extend.Validation
Passed:
Result:
30 passedSummary by CodeRabbit