Skip to content

Add NeMo Gym V1 integration#2032

Open
xeophon wants to merge 14 commits into
PrimeIntellect-ai:mainfrom
xeophon:agent/nemo-gym-v1
Open

Add NeMo Gym V1 integration#2032
xeophon wants to merge 14 commits into
PrimeIntellect-ai:mainfrom
xeophon:agent/nemo-gym-v1

Conversation

@xeophon

@xeophon xeophon commented Jul 15, 2026

Copy link
Copy Markdown
Member

Overview

Adds a NeMo Gym resources-server integration for Verifiers V1. Existing Verifiers harnesses drive the rollout while NeMo Gym remains responsible for resource-server state, native tools, and scoring.

Details

  • Loads NeMo Gym JSONL requests into typed V1 tasks and preserves the source row for session setup and verification.
  • Carries per-rollout cookies and signed MCP session headers through V1 state while exposing upstream tool schemas to MCP-capable harnesses.
  • Converts completed single-branch traces into NeMo Responses objects and records /verify rewards and numeric metrics.
  • Adds a Python 3.12+ nemo-gym optional dependency and reuses resource-server classes from the published package, with V1 owning startup and cleanup.
  • Uses uv dependency metadata to install only the resource-server import slice instead of the full NeMo agent, model, and evaluation stack.
  • Adds environments/nemo_gym_weather_v1 as a thin, self-starting example package; external resource-server URLs remain supported for custom deployments.

Fixes RES-1090


Note

Medium Risk
New HTTP/MCP bridge, trace-to-response scoring, and subprocess server lifecycle affect eval correctness and startup; scope is optional and localized to the new taskset path.

Overview
Adds NeMo Gym V1 tasksets so verifiers harnesses run rollouts while Gym’s resources server handles per-rollout state, tools, and /verify scoring—not Gym’s native agent stack.

NeMoGymTaskset loads JSONL rows (responses_create_params), calls POST /seed_session with the full row, and scores by converting a single-branch trace into a NeMo Responses object and POST /verify. _NeMoGymToolset exposes Gym tools to MCP harnesses via HTTP MCP metadata from seed or direct function endpoints. NeMoGymEnv can spawn a managed resources server subprocess (verifiers.v1.tasksets.nemo_gym.server) when resource_server is set; external URLs stay supported via resources_url.

Also adds optional verifiers[nemo-gym] (nemo-gym==0.4.0, Python ≥3.12) with uv dependency-metadata to avoid pulling Gym’s full Ray/agent stack, a reusable mcp_session helper in MCP launch, docs, and environments/nemo_gym_weather_v1 as a thin weather example.

Reviewed by Cursor Bugbot for commit 9656d11. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add NeMo Gym V1 integration with NeMoGymTaskset and managed resource server lifecycle

  • Adds NeMoGymTaskset in verifiers/v1/tasksets/nemo_gym/taskset.py that loads tasks from a JSONL dataset, seeds per-rollout sessions via /seed_session, and scores them via /verify on a NeMo Gym resources server.
  • Adds NeMoGymEnv that automatically spawns and tears down the resources server subprocess per worker when no external resources_url is configured.
  • Adds _NeMoGymToolset supporting both MCP-over-HTTP and direct function endpoint tool calls, with cookie persistence across requests within a rollout.
  • Adds a standalone server launcher (verifiers/v1/tasksets/nemo_gym/server.py) runnable as python -m verifiers.v1.tasksets.nemo_gym.server for managed or manual startup.
  • Includes an example nemo-gym-weather-v1 environment package in environments/nemo_gym_weather_v1/ and accompanying documentation.

Macroscope summarized 9656d11.

@xeophon
xeophon marked this pull request as draft July 15, 2026 16:51
Comment thread verifiers/v1/tasksets/nemo_gym/server.py Outdated
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch 2 times, most recently from de9f35a to 9cea5a6 Compare July 16, 2026 15:57
@xeophon
xeophon marked this pull request as ready for review July 22, 2026 13:52
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e42f163ddc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread pyproject.toml
Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9d9bc2c. Configure here.

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9d9bc2c714

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/tasksets/nemo_gym/taskset.py
@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from 9d9bc2c to af98d46 Compare July 23, 2026 12:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: af98d46f17

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

NeMoGymConfigT = TypeVar("NeMoGymConfigT", bound=NeMoGymConfig, default=NeMoGymConfig)


class NeMoGymTaskset(Taskset[NeMoGymTask, NeMoGymConfigT]):

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Expose a concrete NeMo Gym config type

When users run the new generic nemo-gym taskset, or subclass it exactly as shown in the docs, the loader discovers config types by scanning concrete Taskset[...] generic arguments. Because this base class uses the NeMoGymConfigT TypeVar here, taskset_config_type('nemo-gym') falls back to plain TasksetConfig, so documented TOML containing dataset_path and task.resources_url is rejected as extra fields before load() can run. Make the exported base resolve to NeMoGymConfig (or otherwise override config resolution) so the documented custom resources-server workflow is usable.

Useful? React with 👍 / 👎.

@xeophon
xeophon force-pushed the agent/nemo-gym-v1 branch from af98d46 to f18134d Compare July 24, 2026 06:25

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f18134dd1e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

global_config_dict=OmegaConf.create({}),
),
)
app = server.setup_webserver()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve auto-exposed MCP tools when launching servers

When the managed resource server relies on NeMo Gym's expose_tools_over_mcp path, this custom launcher builds the FastAPI app directly and skips the run_webserver() step that calls maybe_auto_expose after setup_webserver(). In that context /seed_session will not be wrapped to return MCP metadata, so rows that depend on auto-harvested MCP tools expose no tools to the harness unless every schema is duplicated in the JSONL.

Useful? React with 👍 / 👎.

{
"type": "function_call_output",
"call_id": message.tool_call_id,
"output": content,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Serialize tool outputs as strings for NeMo verification

When an MCP tool returns multimodal content, the trace stores ToolMessage.content as a list, and this forwards that list as function_call_output.output. NeMo Gym's Responses model expects the function-call output to be a string, so /verify rejects these rollouts before scoring; stringify or otherwise normalize non-string tool content instead of sending the list through.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant