Repository navigation
Description
Background
Many teams already have working agent harnesses (e.g. custom SWE pipelines, research prototypes, proprietary evaluation loops) that they want to use with Gym's environments for RL training. Today, integrating an external harness requires:
- Creating a new responses_api_agents/ directory with a FastAPI wrapper server
- Subclassing SimpleResponsesAPIAgent and implementing /run and /v1/responses
- Understanding Gym's internal plumbing: ServerClient, cookie propagation, NeMoGymResponse schema, session middleware
- Writing a YAML config that wires the wrapper to resources and model servers
- Running the wrapper inside Gym's managed process tree via ng_run
This is a lot of ceremony for someone who just wants to point their existing harness at a Gym dataset and resources server and get scores back. The goal of this epic is to make external integration a spectrum — from zero-code config-only hookup to deep framework integration — so teams can start getting value immediately and deepen integration incrementally.
User Considerations
- "I want to write my agent in my own repo, not inside Gym's directory tree."
While nemo-gym is pip-installable, the orchestrator (ng_run) discovers and spawns agent processes from directories inside the Gym repo (responses_api_agents/). Users can install the library anywhere, but their agent code must live in the Gym tree for the system to find and launch it. Users should be able to run their harness as a standalone service or local process — wherever their code already lives — and connect it to Gym purely through configuration.
- "I already have a working agent loop. I just need rewards."
Many harnesses already handle model inference, tool calling, and orchestration. These users only need access to Gym's verification layer (/verify). They shouldn't have to re-implement or wrap their loop in Gym's agent abstraction just to get an evaluation score.
- "I have my existing output format, could be Messages, Chat, custom, etc"
The /run request and response contract is currently implicit — you learn it by reading base class source code. Users need a clear, documented, versioned spec with examples showing the minimum viable response for evaluation vs. the full response needed for RL training.
- "I want to try it on 5 examples before I commit to a full integration."
There should be a fast path to test-drive the integration: point at a running resources server, send a few requests, see if rewards come back correctly. A validation tool or conformance test suite would let users verify their integration works before scaling up.
- "My harness uses its own inference stack, HTTP clients, and tool execution — I shouldn't have to change them."
External harnesses have their own model clients, tool runtimes, and HTTP libraries that already work for their use case. The integration boundary between Gym and an external harness should be a clean HTTP contract — not a requirement to adopt Gym's internal libraries or conventions. As long as the harness can send and receive JSON over HTTP, it should work.
want the agent inference during eval to be consistent with how it is used in production
- "I want to use Gym's model servers from my harness, not just the environments."
Some users want to bring their own orchestration but still use Gym's model serving (vLLM, OpenAI proxy). They need to call Gym's /v1/responses endpoint from outside the Gym process tree, which means they need to discover model server URLs and handle auth without access to Gym internals.
- "I need my rollout outputs to work with gym's metric aggregation and downstream training."
Whatever integration path users choose, the output must be compatible with Gym's existing profiling and training pipelines. Users need clear guidance on which output fields are required for evaluation-only use cases vs. full RL training (where token IDs and logprobs are additionally needed).
- "I don't want to learn Hydra/OmegaConf to configure one endpoint URL."
Gym's config system is powerful but has a learning curve. For the simple case of "my agent lives at this URL, use it," users shouldn't need to understand Hydra composition, config groups, or OmegaConf interpolation.
- "My harness is stateful — it manages its own sessions, sandboxes, or container lifecycles."
Gym uses cookie-based session management to track per-rollout state across resources server calls. External harnesses that manage their own state need a clear contract for how Gym sessions map to their internal state, or the ability to opt out of Gym session management entirely.
- "I want to run my harness on my own infrastructure, not co-located with Gym."
Gym currently assumes all servers run in the same cluster, discovered via Head Server. External agents may run on different infrastructure (different cluster, cloud provider, or even a developer's laptop). The integration needs to work across network boundaries with appropriate timeout, retry, and auth support.
- "I want to scale to thousands of concurrent rollouts without my harness being the bottleneck."
Gym's orchestrator can push 4k-65k concurrent /run requests. External harnesses need guidance on concurrency expectations, backpressure patterns, and how to signal capacity limits. The integration layer should handle graceful degradation when the external harness is slower than the orchestrator.
- "I want to incrementally adopt more of Gym over time."
The integration should be a ramp, not a cliff. A user might start by calling /verify from their harness, then move to the proxy agent for ng_collect_rollouts compatibility, then eventually build a native wrapper agent when they need training-grade token tracking. Each step should be a small increment, not a rewrite.
Sub-issues
Collapse Sub-issuesSub-issues
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
feat(agents): RemoteAgent, thin proxy server for user-hosted remote a…
feat(agents): RemoteAgent, thin proxy server for user-hosted remote a…