Run a Custom NeMo Gym Environment
A custom Gym environment runs from a NeMo Platform FileSet rather than from the components bundled in the Gym task image. Evaluator stages the FileSet onto job storage, mounts it read-only in an OpenSandbox Gym host, and returns the rollouts through the normal agent-evaluation result bundle.
Prerequisites
- A running NeMo Platform with the Evaluator plugin.
- An OpenSandbox-capable Kubernetes deployment configured for sandboxed Gym. See Configure Sandboxed Gym.
- A taskset built from Gym rows as described in Evaluate a NeMo Gym Environment.
- A model endpoint reachable from the sandbox.
FileSet-backed Gym environments cannot use colocated platform execution. Evaluator rejects the
submission when
sandboxed_gym_default is disabled or the selected execution profile does not provide compatible
shared PVC storage.
1. Package the environment
The FileSet must contain nemo-environment.yaml at its root. Evaluator accepts two formats:
native-v1installs component dependencies from each component’srequirements.txt.wheels-v1installs dependencies from a flat, non-emptywheels/directory without contacting a package index.
A minimal native-v1 resource-server package looks like this:
For wheels-v1, use the same manifest shape with format: wheels-v1 and add the wheelhouse:
The package must follow these rules:
- Every
config_pathsentry is relative to the FileSet root and names an uploaded file. native-v1config paths stay underresources_servers/orresponses_api_agents/.wheels/is flat and contains only.whlfiles.- Do not include
responses_api_models/; model configuration is operator-owned. - Do not include dataset
.jsonlfiles. Store evaluation rows in a separate taskset.
2. Upload the environment
Create an environment FileSet and upload the directory contents:
Keep the trailing slash on ./my-gym-environment/. It places nemo-environment.yaml at the FileSet
root instead of creating an extra directory level.
3. Create the job specification
Create gym-custom-environment.yaml:
The Evaluator plugin skill includes the same shape as a validated JSON starting point at
skills/nemo-evaluator-plugin/assets/specs/gym_agent_eval.json.
Replace the service URL, workspace, model, taskset, and component names for your deployment. The model URL must be present in the deployment’s sandbox egress configuration.
If the package declares the selected agent instance, you can omit agent_config. Set
agent_ref_name when the instance name registered by the package differs from agent.
For an environment variable containing a credential, use a platform secret reference:
Do not place credentials in env_vars. Sandboxed submissions reject credential-shaped plaintext
environment variables.
4. Submit the job
Evaluator compiles two ordered steps:
stage-environmentdownloads the FileSet onto job-scoped persistent storage.agent-evaluateprovisionsnmp-gym-host, collects rollouts, scores them, and destroys the host.
Both platform steps use nmp-cpu-tasks; Gym and Ray run in the separate sandbox host.
5. Read the results
Wait for the job to finish, then download the result bundle:
The archive contains trials.jsonl, scores.jsonl, tasks.jsonl, and summary.json. See
Reading Results
for the queryable result record and SDK retrieval path.
Troubleshooting
- FileSet purpose or manifest error: Confirm the FileSet uses
purpose=environmentand contains a valid rootnemo-environment.yaml. - Sandbox unavailable: Confirm the deployment enabled sandboxed Gym and configured OpenSandbox, the runtime image, a shared PVC, and model egress.
- PVC mismatch: The Jobs execution profile and
sandbox_job_storage_pvc_claimmust name the same claim. - Agent returns no rollout: Set
agent_ref_nameto the agent instance registered by the package. - Model connection failure: Add the model host and port to the deployment-owned egress allowlist.