feat(studio): support nemo-agents-spec-v1 configs in Create Example Agent - #1046
Conversation
…gent The Create Example Agent flow assumed NAT workflow configs: the sample loader hard-required `llms.llm` and the create POST omitted `config_format`, so a Fabric (`nemo-agents-spec-v1`) sample would fail the loader guard and be validated server-side as NAT. Make the flow config_format-aware, harness-agnostic: - loadSampleAgentConfig branches on the parsed `config_format`: NAT keeps `llms.llm.model_name`; Fabric injects `models.default.model` (the selected harness inherits it) and no longer requires `llms.llm`. - SampleAgent gains an optional `configFormat` field. - CreateExampleAgentModal threads `config_format` into the create POST when the registry entry sets it (SDK CreateAgentRequest already carries the field). This is the format-level plumbing only; it does not add a Fabric sample entry yet (that follows once the example's agent.yml shape is locked). Verified: loader unit tests 6/6, full studio suite 2689/2689, lint and typecheck clean on the changed files. Signed-off-by: Nathan Walston <nwalston@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
web/packages/studio/src/constants/sampleAgents.ts (1)
29-32: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winRestrict
configFormatto supported formats.
configFormat?: stringaccepts typos and unsupported identifiers. The create modal forwards this value toconfig_format, but the loader implements only NAT and Fabric injection. Define a union for the supported formats.Proposed fix
+export type SampleAgentConfigFormat = 'nat-workflow-v1' | 'nemo-agents-spec-v1'; + export interface SampleAgent { ... - configFormat?: string; + configFormat?: SampleAgentConfigFormat; }As per coding guidelines, use
typefor unions.🤖 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 `@web/packages/studio/src/constants/sampleAgents.ts` around lines 29 - 32, Update the sample agent configuration type containing configFormat to use a type alias union of the supported format identifiers, covering NAT and Fabric injection formats, instead of string. Keep configFormat optional and ensure the create-modal/API flow continues forwarding only those supported values.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.
Inline comments:
In `@web/packages/studio/src/api/agents/loadSampleAgentConfig.ts`:
- Around line 26-31: Update the config-format branching in loadSampleAgentConfig
so injectNatModel is used only when config.config_format is undefined or exactly
"nat-workflow-v1"; retain injectFabricModel for "nemo-agents-spec-v1", and throw
an error for every other value before returning or submitting the config.
---
Nitpick comments:
In `@web/packages/studio/src/constants/sampleAgents.ts`:
- Around line 29-32: Update the sample agent configuration type containing
configFormat to use a type alias union of the supported format identifiers,
covering NAT and Fabric injection formats, instead of string. Keep configFormat
optional and ensure the create-modal/API flow continues forwarding only those
supported values.
🪄 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: 1ea2c147-4174-4d34-9444-c3699e771faa
📒 Files selected for processing (4)
web/packages/studio/src/api/agents/loadSampleAgentConfig.test.tsweb/packages/studio/src/api/agents/loadSampleAgentConfig.tsweb/packages/studio/src/constants/sampleAgents.tsweb/packages/studio/src/routes/agents/AgentsListRoute/CreateExampleAgentModal/index.tsx
|
Reject unsupported config_format values in loadSampleAgentConfig instead of silently treating them as NAT. Only undefined and nat-workflow-v1 take the NAT path; nemo-agents-spec-v1 takes the Fabric path; any other value (e.g. a typo) now throws instead of injecting into the wrong schema and POSTing an invalid config. Added a test for the unsupported-format case. Signed-off-by: Nathan Walston <nwalston@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 (4)
📝 WalkthroughWalkthroughChangesFabric agent configuration support
Sequence Diagram(s)sequenceDiagram
participant CreateExampleAgentModal
participant loadSampleAgentConfig
participant NATConfig
participant FabricConfig
CreateExampleAgentModal->>loadSampleAgentConfig: Load sample configuration and selected model
loadSampleAgentConfig->>NATConfig: Inject model into llms.llm.model_name
loadSampleAgentConfig->>FabricConfig: Inject model into models.default.model
loadSampleAgentConfig-->>CreateExampleAgentModal: Return validated configuration
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
What
Makes Studio's Create Example Agent flow config-format-aware so it can create Fabric (
nemo-agents-spec-v1) agents, not just NAT (nat-workflow-v1) ones. The change is harness-agnostic — it supports any Fabric harness the platform translator handles (claude, codex, deepagents, hermes).Why
The flow assumed NAT workflow configs in two places:
loadSampleAgentConfighard-threw on missingllms.llm, then wrotellms.llm.model_name. A Fabric config has nollms.llm— its model lives atmodels.default.model.CreateExampleAgentModalsent the create POST withoutconfig_format, so the API defaulted tonat-workflow-v1and would validate a Fabric config as NAT (400).Both are format-level, not harness-level, so this unblocks Fabric examples without committing to any specific example.
Changes
loadSampleAgentConfig.ts— branch on the parsedconfig_format:llms.llm.model_name(unchanged behavior).nemo-agents-spec-v1) → injectmodels.default.model; the selected harness inherits it. Nollms.llmrequirement.sampleAgents.ts— add optionalconfigFormatto theSampleAgentinterface.CreateExampleAgentModal/index.tsx— threadconfig_formatinto the create POST when the registry entry sets it. The generated SDK'sCreateAgentRequestalready carriesconfig_format?: string, so no SDK regen is needed.loadSampleAgentConfig.test.ts— add Fabric cases (model injected intomodels.default.model; missingmodels.defaultthrows).Scope / follow-up
Format-level plumbing only. This PR does not add a Fabric sample-agent entry to
SAMPLE_AGENTSor its static assets — that follows once the example'sagent.ymlshape (harness, MCP binding, credential path) is locked. After this merges, Studio silently accepts Fabric configs; the visible demo entry lands in a later PR.Verification
loadSampleAgentConfigunit tests: 6/6 pass (4 existing NAT + 2 new Fabric).nemo-studio-uisuite: 2689/2689 pass.(Three pre-existing
db_versiontypecheck errors inguardrails.ts/VirtualModelDetailsSidePanelare unrelated to this PR.)Summary by CodeRabbit
New Features
Bug Fixes