Configuration
Complete syntax and field specifications for NeMo Gym configuration files.
File Locations
Artifact Roots (results_dir, cache_dir)
Two opt-in top-level config keys that servers can consult for state that outlives a request:
These are opt-in settings, not a global redirect: components that don’t consult them (profiling output, rollout capture, logs, Hugging Face caches, other agents) keep their own locations, and the module-level RESULTS_DIR/CACHE_DIR constants remain unchanged defaults for such consumers. New artifact producers are encouraged to read these keys.
Both are independently overridable (results_dir=/shared/results cache_dir=/shared/cache), and relative values are normalized to absolute paths at parse time so all server processes agree. uv_venv_dir keeps its own key and default.
On multi-node deployments, the swe_agents server embeds these paths in commands executed from other nodes, so both roots must resolve to the same content at the same path on every node that runs rollout workers: use a shared filesystem, or pre-stage identical trees at the same path on each node (for example, baked into the container image). A cache that exists only on the head node breaks remote rollouts.
Servers that pre-staged setup trees next to the package (the layout before cache_dir existed, for example baked container images) keep using those trees only while cache_dir is left at its default — explicitly configuring cache_dir opts out, and removing the pre-staged trees migrates a default-config deployment. Contents accumulate across runs; both directories are safe to delete when no run is active.
Path Resolution and External Roots
Gym resolves every relative path — config_paths, env.yaml, prompt configs, dataset files, the --<component> selectors (--benchmark, --environment, --model-type, --resources-server), and server directories (used by gym env test) — against an ordered list of roots, returning the first one where the path exists:
- Extra roots from
NEMO_GYM_EXTRA_ROOTS(or--search-dir), in the order listed. - The current working directory — your project.
- The Gym install root, where the built-in components live (in both editable and wheel installs).
Earlier roots win, so a component you provide shadows a same-named built-in. Absolute paths are used unchanged.
External roots (NEMO_GYM_EXTRA_ROOTS)
Point Gym at one or more extra roots so your own benchmarks, environments, resources servers, agents, models, configs, prompts, and data resolve by name — without forking Gym or copying files into the install tree. Each root uses the same layout as the Gym repo:
Set it as an os.pathsep-separated list (: on Linux/macOS):
The variable is inherited by the servers Gym spawns, so plugin components resolve inside them too.
--search-dir
--search-dir DIR (repeatable) is the per-invocation equivalent: Gym sets NEMO_GYM_EXTRA_ROOTS to its value for the duration of that command, then restores it. Use it for one-off runs instead of exporting the variable.
Prefer NEMO_GYM_EXTRA_ROOTS when the same plugin roots apply to every command in a shell session; reach for --search-dir for a single invocation. If both are set, --search-dir takes precedence for that command.
Server Configuration
All servers share this structure:
Reverse Proxy Headers
Gym disables Uvicorn proxy-header processing by default. Direct Gym traffic does not pass through a reverse proxy, so
the network peer address and request scheme are authoritative without interpreting X-Forwarded-For or
X-Forwarded-Proto.
Deployments behind a reverse proxy must opt in with top-level configuration and list the proxy addresses or CIDRs that are allowed to supply forwarded headers:
Both settings apply to the Gym head server and the Agent, Model, and Resources servers. Enabling proxy headers without
a non-empty allowlist fails at startup. Wildcards and all-address CIDRs such as 0.0.0.0/0 and ::/0 are rejected.
Only list reverse proxies you control. Trusting a loopback address such as 127.0.0.1 trusts every local process, not
only a proxy running on that address. Deployments that previously relied on Uvicorn’s implicit loopback trust must set
these options explicitly.
Model Server Fields
Keep the server ID as policy_model — agent configs reference this name by default. The ${policy_base_url}, ${policy_api_key}, and ${policy_model_name} placeholders should be defined in env.yaml at the repository root, allowing you to change model settings in one place.
Resources Server Fields
allowed_agents pins the agent harnesses that verify this server’s tasks correctly. Omit it (the
default) when any harness will do. When it is set, --agent-type
refuses to substitute an agent that is not listed. Declare it on every config that writes this server’s
block — server configs are self-contained, so a config written from scratch does not inherit it.
Domain values: math, coding, agent, knowledge, instruction_following, long_context, safety, games, translation, e2e, rlhf, other (see Domain)
Agent Server Fields
Agent servers must include both a resources_server and model_server block to specify which servers to use.
Dataset Configuration
Define datasets associated with agent servers for training and evaluation.
Dataset types:
example— For testing and developmenttrain— Training data (requireslicense)validation— Evaluation data (requireslicense)
License values: Apache 2.0, MIT, Creative Commons Attribution 4.0 International, Creative Commons Attribution-ShareAlike 4.0 International, CC BY-SA 4.0, CC BY-NC 3.0, TBD (see license)
Local Configuration (env.yaml)
Store secrets and local settings at the repository root. This file is gitignored.
Multi-Node Configuration
use_absolute_ip — Controls the default host servers bind to.
- Default:
false— servers use127.0.0.1(localhost). - When to use: Set to
truefor multi-node setups (e.g. multi-node Ray clusters) where servers must communicate across machines. - Effect: Resolves and uses the host’s IP address (
gethostbyname(gethostname())) instead of localhost.
Experiment Tracking
Gym exports the resolved config, aggregate metrics, and rollouts to any tracking backend you configure. Weights & Biases and MLflow are both supported, and both can be on at once. A backend is used only when every key it needs is set; otherwise it is silently skipped.
Weights & Biases
MLflow
mlflow_tracking_uri and mlflow_tracking_token are shared with the GitLab model registry used by
gym dataset upload|download. Setting only those two does not enable the exporter — it also needs
an experiment and run name.
Rollout upload
Rollouts are uploaded to every configured backend by default. Turn this off when they are large:
Metrics and config are still exported. The old name upload_rollouts_to_wandb is deprecated and will be removed in a future release.
Exporting is best-effort. Errors that happen during export (e.g., unavailable server) are reported as warnings and the run continues.
Command Line Usage
To run servers, use gym env start. NeMo Gym uses Hydra for configuration management.
Loading Configs
Overriding Values
Troubleshooting
Configuration for common configuration errors and solutions.