Skip to content

ng_collect_rollouts: accept an external agent URL #1305

Closed

Description

@cwing-nvidia

Use cases, pain points, and background

Users with their own agents (LangChain apps, custom Python scripts, services in their own infrastructure) currently cannot use ng_collect_rollouts without packaging their agent as a responses_api_agents/ server inside the Gym repo. Today, ng_collect_rollouts resolves +agent_name through the head server's config to find a co-managed Gym agent server, then POSTs /run to it. There is no way to point it at an external HTTP endpoint.

This requires user writing custom agents external to NeMo Gym to either rewrite their agent as a Gym server class or skip the CLI entirely and write their own rollout collection loop. The resources server HTTP API already supports direct external access (/seed_session, /{tool}, /verify), but the rollout collection tooling does not.

Description

Add support for +agent_url=http://host:port as an alternative to +agent_name=... in ng_collect_rollouts. When agent_url is provided, the rollout collector POSTs /run directly to that URL instead of resolving a server name through the head server config.

The external agent's /run endpoint receives the same JSONL row payload (with responses_create_params, verifier_metadata, etc.) and returns a verify-response-shaped result (with reward, response, etc.) — the same contract that Gym agent servers fulfill today.

Design

Preliminary thoughts:

  • nemo_gym/rollout_collection.py: add agent_url as an optional config field. When set, skip ServerClient name resolution and POST directly to {agent_url}/run via aiohttp.
  • The /aggregate_metrics call after rollout collection should be optional when using agent_url — skip it if the external agent doesn't implement it, or fall back to calling /aggregate_metrics on the resources server directly.
  • Config validation: agent_url and agent_name should be mutually exclusive.
  • No changes needed to the resources server or agent server code — this is purely a client-side (rollout collector) change.

Out of scope

  • Changes to the resources server HTTP API
  • Building a Gym SDK/client library for external agents (the contract is just POST /run with JSON)
  • Modifying ng_run to manage external agent processes

Acceptance Criteria

  • ng_collect_rollouts +agent_url=http://localhost:9000 +input_jsonl_fpath=... +output_jsonl_fpath=... dispatches to the external URL
  • Works with existing JSONL data and produces the same output format as +agent_name
  • +agent_url and +agent_name are mutually exclusive with a clear error message
  • /aggregate_metrics is skipped gracefully when the external agent does not implement it
  • Documentation updated to show the external agent URL workflow

Activity

  1. moved this from Dev WIP to Review Todo in NeMo Gym 0.5.0 - Aug 5on Jul 13, 2026
  2. moved this from Review Todo to Review WIP in NeMo Gym 0.5.0 - Aug 5on Jul 29, 2026
  3. moved this from Done to QA Todo in NeMo Gym 0.5.0 - Aug 5on Jul 31, 2026
  4. moved this from QA Todo to QA WIP in NeMo Gym 0.5.0 - Aug 5on Aug 3, 2026
  5. moved this from QA WIP to QA Verified in NeMo Gym 0.5.0 - Aug 5on Aug 3, 2026
  6. moved this from QA Verified to Done in NeMo Gym 0.5.0 - Aug 5on Aug 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions