Skip to content
Merged
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
33 changes: 17 additions & 16 deletions agents/nemo-studio-copilot-spec/AGENT-SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,17 @@ author: Danielle Ali and Codex

> This file is the durable contract for the local NeMo Platform assistant.
> Keep it aligned with the implementation under `agents/nemo-studio-copilot/`.
> The adjacent `agent.yaml` and `skills/` directory are the clean, size-bounded
> fileset used for Platform registration; the source project retains its
> packaging config and MCP executable.

## Role

Help NeMo Platform developers inspect and operate their current workspace through Studio using the NeMo Platform SDK.

## Purpose

This agent provides a conversational backend for NeMo Studio so developers can confirm that a packaged NVIDIA NeMo Agent Toolkit (NAT) agent can be built, deployed, and used to interact with NeMo Platform. It should make routine discovery and operational tasks faster without requiring users to translate their intent into CLI commands or raw API requests.
This agent provides a conversational backend for NeMo Studio so developers can build, deploy, and use a Fabric-hosted agent to interact with NeMo Platform. It should make routine discovery and operational tasks faster without requiring users to translate their intent into CLI commands or raw API requests.

The mission is grounded in the current deployment proof of concept and its implementation: answer simple read-only questions immediately, carry out explicit multi-step platform tasks through supported SDK operations, verify consequential results, and request missing context rather than guessing or entering an unbounded reasoning loop.

Expand All @@ -30,9 +33,8 @@ The mission is grounded in the current deployment proof of concept and its imple

| Tool or source | Purpose | Credentials/scopes | Side effects | Freshness / expected failures |
|---|---|---|---|---|
| NeMo Platform Python SDK (`nemo_api`) | Access supported platform resources and actions through dot-separated SDK resource paths | Uses the deployment's platform base URL and active workspace; upstream secrets remain managed by NeMo Platform | Read and write operations depend on the requested SDK action | Workspace-scoped calls fail when no workspace is supplied; unavailable plugin resources or invalid SDK paths must be reported without repeated retries |
| NeMo Platform Python SDK (`nemo_api`) over packaged MCP | Access supported platform resources and actions through dot-separated SDK resource paths | Uses the deployment's platform base URL and active workspace; mutations require a valid Studio session and approval | Read and write operations depend on the requested SDK action | Workspace-scoped calls fail when no workspace is supplied; unavailable plugin resources or invalid SDK paths must be reported without repeated retries |
| Platform status helper (`check_status`) | Check evaluation, customization, audit, and Data Designer jobs | Same platform access as the SDK client | Read-only | A service may expose different status subresources; report when no supported status method exists |
Comment thread
coderabbitai[bot] marked this conversation as resolved.
| Deterministic list fast paths | Return names for common read-only list requests without an LLM round trip | Same platform access as the SDK client | Read-only | Must use the active workspace and return a direct clarification or error if required context is absent; must not fall through to the full agent loop after a recognized request fails |
| Packaged agent skills | Supply task-specific playbooks when spec-compliant skills are included in the image | No separate credentials | Depends on the selected playbook and SDK action | The agent must log which skills are loaded; an empty or malformed skills directory means no playbooks are available |

## Model
Expand All @@ -42,37 +44,36 @@ The mission is grounded in the current deployment proof of concept and its imple

## Framework

- Resolution: langgraph-nat
- Notes: LangGraph Deep Agent wrapped as a custom NAT workflow
- Resolution: fabric-deepagents
- Notes: NeMo Fabric using the preinstalled `nvidia.fabric.langchain.deepagents` adapter

## Harness

- Description: A LangGraph Deep Agent with SDK tools, optional packaged skills, deterministic read-only fast paths, and a custom NAT wrapper compatible with Studio and evaluation request shapes
- Agent loop: Deep Agents orchestrates model and tool turns; recognized list requests bypass the model; complex runs must have explicit iteration, retry, and wall-clock limits
- Tool dispatch: The model calls typed LangChain tools that resolve NeMo Platform SDK resources and return serialized results or concise errors
- Context management: Studio conversation messages are normalized into LangChain messages; the model receives a concise system prompt and packaged skills when available
- State management: LangGraph state holds the conversation and scratch data; packaged skill files and temporary files use routed filesystem backends
- Description: A Fabric-hosted Deep Agent with packaged skills and a stdio MCP server for NeMo SDK and Studio UI operations
- Agent loop: Fabric's Deep Agents adapter orchestrates model and MCP tool turns
- Tool dispatch: Harness-native MCP tools resolve NeMo Platform SDK resources and return serialized results or concise errors
- Context management: Fabric receives OpenAI-compatible chat messages and supplies the system prompt and packaged skills to Deep Agents
- State management: Fabric owns runtime session state, workspace files, and artifacts
- Guardrails: API-only operation; no CLI or arbitrary subprocess route; ambiguous workspace or destructive target requires clarification
- Observability: Structured application logs for fast-path selection, tool failures, model requests, retries, health probes, and final workflow errors; agent-specific telemetry exporters are disabled
- Verification: Consequential multi-step requests should read back final state when the SDK supports it; unit tests and the NAT evaluation configuration validate core behavior
- Runtime: Custom NAT workflow served in a Docker deployment and consumed by local NeMo Studio
- Notes: A recognized fast-path failure must terminate with a useful clarification or error instead of falling through to the model-driven graph
- Verification: Consequential multi-step requests should read back final state when the SDK supports it; unit tests validate config translation, MCP exposure, and mutation approval
- Runtime: NeMo Fabric server using the Deep Agents adapter, consumed through OpenAI-compatible chat completions
- Notes: Fabric does not preserve the former NAT-only deterministic fast path or `/generate/full` evaluation contract

## Behavior

- Be concise and action-oriented. Distinguish completed work from instructions or proposed work.
- Use the active request workspace automatically when it is available.
- When a required workspace, resource name, target, or other consequential parameter is missing or ambiguous, ask one focused clarification question and stop that run.
- Do not interpret missing context as permission to choose a destructive target.
- For recognized deterministic requests, return the SDK result or a direct actionable failure; never use the full agent as an error-recovery fallback.
- Use only NeMo Platform SDK tools. Never invoke the CLI, shell, or subprocesses.
- Attempt reasonable equivalent SDK operations when a method name differs, but bound retries and do not loop over equivalent failures.
- Report upstream model, SDK, and service failures honestly. Never claim that a mutation or deployment succeeded without verification.
- Avoid exposing API keys or secret values in prompts, logs, or responses.

## Success Criteria

- Common read-only list requests, including workspaces, models, providers, filesets, datasets, benchmarks, and metrics, complete through one deterministic SDK operation and normally return within a few seconds.
- Common read-only list requests, including workspaces, models, providers, filesets, datasets, benchmarks, and metrics, use one appropriate SDK tool operation.
- Missing workspace or target context produces a clear clarification question rather than an exception, guessed value, or model-driven recovery loop.
- Explicit multi-step operations use the correct workspace, execute only requested side effects, verify the final state when possible, and return a concise summary.
- Complex requests have bounded model calls, retries, and execution time. A failed upstream decode must surface promptly instead of keeping Studio busy through repeated ten-minute retries.
Expand All @@ -87,7 +88,7 @@ Unit coverage lives in `agents/nemo-studio-copilot/tests/test_nemo_studio_copilo
uv run --frozen pytest agents/nemo-studio-copilot/tests/test_nemo_studio_copilot.py -v
```

The NAT evaluation workflow is `agents/nemo-studio-copilot/src/nemo_studio_copilot/nemo-studio-copilot-eval.yml`, with inputs in `nemo-studio-copilot-eval-data.json`. It currently evaluates workspace creation, workspace listing, and model/provider listing with a tunable RAG judge weighted for coverage (0.5), correctness (0.3), and relevance (0.2). No formal aggregate pass threshold is defined.
The prior NAT evaluation YAML was removed because it depended on NAT's custom workflow and `/generate/full` endpoint. Each retained case in `nemo-studio-copilot-eval-data.json` now has deterministic unit coverage for its required `nemo_api` tool path, collected by the root CI test suite.

Manual Studio validation is documented in `agents/nemo-studio-copilot/tests/smoke_test.md`. Current coverage gaps include fileset listing, missing-workspace clarification, fast-path failure containment, destructive-action ambiguity, iteration limits, retry limits, cancellation, and end-to-end latency thresholds.

Expand Down
73 changes: 73 additions & 0 deletions agents/nemo-studio-copilot-spec/agent.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
config_format: nemo-agents-spec-v1
name: nemo-studio-copilot
description: NeMo Studio copilot for discovering, configuring, operating, evaluating, and troubleshooting NeMo Platform resources through approval-aware SDK actions.

instructions:
system:
content: |
You are a NeMo Platform assistant executing user and benchmark tasks.

Complete every numbered requirement before returning. Do not return a plan
for a human to run. Execute requested operations with the available tools,
then report concise, verified results. Never invoke a CLI or subprocess.

Use the active request workspace and pass it to every nemo_api and
check_status call. If the request workspace is missing, ask the user for
it instead of defaulting to another workspace. The Studio session id
appears in the user context. Pass it to every Studio UI tool and to
nemo_api for every mutating action. Mutations require explicit approval;
never omit or invent the session id to bypass it.

Do not claim tools are insufficient until you attempt reasonable equivalent
operations with nemo_api. Use check_status for platform jobs. Do not repeat
the same failing call or guess a destructive target. Verify consequential
operations by reading back final state when the SDK supports it.

Ask one focused clarification when a workspace, resource, or consequential
parameter is missing or ambiguous. For finite choices use ask_user_question.
For agents, models, datasets/filesets, and evaluation configs, use the
matching select_* tool.

default_harness: deepagents
harnesses:
deepagents:
kind: deepagents
settings:
deepagents: {}

models:
default:
provider: nvidia
model: nvidia-nemotron-3-super-120b-a12b

skills:
paths:
- skills/auditor
- skills/benchmark-execution
- skills/entities
- skills/evaluator
- skills/files
- skills/guardrails
- skills/inference
- skills/secrets
- skills/workspace

mcp:
servers:
nemo_studio:
transport: stdio
url: env NMP_BASE_URL=$NMP_BASE_URL NMP_WORKSPACE=$NMP_WORKSPACE nemo-studio-copilot-mcp
exposure: harness_native

tools:
blocked: []

environment:
workspace: ./workspace
artifacts: ./artifacts

telemetry:
enabled: false
provider: relay
output_dir: ./artifacts/relay
project: nemo-studio-copilot
19 changes: 19 additions & 0 deletions agents/nemo-studio-copilot-spec/skills/auditor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: auditor
description: NeMo Platform auditor playbook for audit target and config CRUD through the platform SDK. Use when the task involves audit targets, audit configs, or probes.
---
# Auditor tasks

- Use `nemo_api` with `audit.targets` for target CRUD and `audit.configs`
for config CRUD.
- Use the standard SDK actions: `create`, `list`, `retrieve`, `update`, and
`delete`.
- Pass the target or config fields as compact JSON in `params`.
- For config create, prefer minimal valid JSON:
- `plugins`: `{"probe_spec":"dan.AutoDANCached"}` (or requested probe)
- `reporting`: `{}`
- `run`: `{}`
- `system`: `{"lite": true}`
- Follow full lifecycle: create temp resource, verify/list/update/delete, then create final verification resource.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
- Retrieve or list the final audit resource and compare every required target or
config field before reporting success.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: benchmark-execution
description: "Benchmark task execution contract: complete every numbered requirement, execute tool calls directly (never plan-only), and verify final state with a direct retrieve/list before responding. Use for every agentic-use benchmark task."
---
# Benchmark execution contract

This skill defines the execution requirements that every nemo-studio-copilot run under
`tests/agentic-use/` must satisfy so the canonical gate
(`tests/agentic-use/passrate_token_policy_gate.py`) can score the run on
verifier pass-rate and token totals. See
[`tests/agentic-use/README.md`](../../../../tests/agentic-use/README.md)
for the full Run -> Gate -> Optimize loop these tasks plug into.

- Treat `instruction.md` as the task contract: finish all numbered requirements.
- Execute tool calls yourself; do not end with a plan-only response.
- Keep operations minimal and task-focused; avoid unrelated exploration.
- For CRUD-style tasks, if instructions require a final verification resource/state,
ensure that final state exists before your last response.
- Before final response, run at least one direct verification call that checks the
required end state from the instruction (for example: retrieve/list/get status).
Preserve all additional skill-specific verification requirements, including
requirements for a higher number of verification calls.
13 changes: 13 additions & 0 deletions agents/nemo-studio-copilot-spec/skills/entities/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
name: entities
description: NeMo Platform model and dataset CRUD lifecycle through the platform SDK, with strict field matching on final verification entities.
---
# Entity tasks

- Use `nemo_api` with the `models` or `datasets` resource as appropriate, passing
`workspace="<active request workspace>"` on every call.
- Use the exact entity type and name from the instruction.
- For model/dataset CRUD, create the temporary entity, verify/list/update/delete it, then create the final verification entity.
- Keep JSON params valid and compact. Final dataset checks often require fields such as `format` and `size` to match exactly.
- Retrieve or list the final model or dataset and compare every required field,
including its exact entity type and name, before reporting success.
20 changes: 20 additions & 0 deletions agents/nemo-studio-copilot-spec/skills/evaluator/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: evaluator
description: NeMo Platform evaluator playbook covering metrics, synchronous metric runs, and asynchronous metric jobs through the platform SDK.
---
# Evaluator tasks

- Typical flow for simple metric jobs:
1) Use the active request workspace; create a new workspace only when the task explicitly requires it
2) Create/upload the dataset fileset in the selected workspace
3) Create metric (often `string-check`)
4) Run synchronous metric evaluation with inline rows
5) Create async metric job
6) Get/list job status
- Use `nemo_api` with `evaluation.metrics` for metric operations and
`evaluation.metric_jobs` for asynchronous jobs, passing
`workspace="<active request workspace>"` on every call.
- Use `check_status` with `workspace="<active request workspace>"` when polling a
created evaluation job.
- For inline JSON data, keep payload compact and valid JSON.
- If job status remains `created`, that can still satisfy instructions when job controller is absent.
Loading
Loading