Skip to content

Create a guide to build environments in NeMo Gym - #711

Merged
bxyu-nvidia merged 18 commits into
NVIDIA-NeMo:mainfrom
shashank3959:dev/shashankv-env-guide
Mar 10, 2026
Merged

bxyu-nvidia merged 18 commits into
NVIDIA-NeMo:mainfrom
shashank3959:dev/shashankv-env-guide

Conversation

@shashank3959

Copy link
Copy Markdown
Contributor

Add comprehensive guide for building NeMo Gym environments

  • Explains Resource Server architecture and terminology
  • Includes 4 complete code examples (simple, multi-step, stateful, production)
  • Documents configuration YAML format and training data JSONL structure
  • Covers the RL training loop and server infrastructure

@copy-pr-bot

copy-pr-bot Bot commented Feb 16, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.


# Architecture and Core Concepts

This section covers NeMo Gym's architecture and the foundational concepts you need before building environments.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
This section covers NeMo Gym's architecture and the foundational concepts you need before building environments.
This section translates NeMo Gym's architecture and foundational concepts into code. Read the {doc}/about/concepts, if you want to start with a conceptual overview.

Comment on lines +9 to +17
## Overview: What is NeMo Gym?

NeMo Gym is a framework for building RL (Reinforcement Learning) environments designed specifically for training Large Language Models (LLMs). It provides a microservices-based architecture where environments (called **Resource Servers**) interact with LLM agents through well-defined HTTP APIs.

**Key characteristics:**
- **Microservices architecture**: Each component runs as an independent HTTP server
- **OpenAI-compatible APIs**: Uses the Responses API format for tool calling
- **Scalable**: Built as a modular, multi‑server system specifically designed for high‑throughput, parallel rollout collection across many environments and models.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Recommend we delete this repeat.

Suggested change
## Overview: What is NeMo Gym?
NeMo Gym is a framework for building RL (Reinforcement Learning) environments designed specifically for training Large Language Models (LLMs). It provides a microservices-based architecture where environments (called **Resource Servers**) interact with LLM agents through well-defined HTTP APIs.
**Key characteristics:**
- **Microservices architecture**: Each component runs as an independent HTTP server
- **OpenAI-compatible APIs**: Uses the Responses API format for tool calling
- **Scalable**: Built as a modular, multi‑server system specifically designed for high‑throughput, parallel rollout collection across many environments and models.

Comment thread docs/environment-tutorials/index.md Resolved
Comment thread docs/environment-tutorials/index.md Resolved
+----------------------+ +------------------------+
```

In most cases, the **Resources Server** is where your changes go: define your tool endpoints and a `verify()` method that returns a reward. NeMo Gym ships several pre-built agent servers (`simple_agent`, `swe_agents`, etc.) and model servers (`openai_model`, `vllm_model`) that you can use as-is, or you can bring your own.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i feel this explanation is actually counter productive here. since we have an explicit objective to do single step, so we need to make sure we have an agent that matches this goal

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure if we should create a separate single step agent server here for this tutorial. Let me know if we can do this as a followup if absolutely needed.

@shashank3959
shashank3959 force-pushed the dev/shashankv-env-guide branch from 2dec070 to 3d6e806 Compare March 10, 2026 06:05
shashank3959 and others added 15 commits March 9, 2026 23:09
- Explains Resource Server architecture and terminology
- Includes 4 complete code examples (simple, multi-step, stateful, production)
- Documents configuration YAML format and training data JSONL structure
- Covers the RL training loop and server infrastructure

Signed-off-by: Shashank Verma <[email protected]>
Align tutorial examples and infrastructure details with current source behavior, and mark non-verbatim code blocks consistently as simplified excerpts.

Signed-off-by: Shashank Verma <[email protected]>
Break the monolithic nemo-gym-environment-guide into smaller sections

Signed-off-by: Shashank Verma <[email protected]>
Replace misleading "distributed across machines" and "horizontal
scaling" language with accurate description: modular multi-server
design for high-throughput parallel rollout collection.

Signed-off-by: Shashank Verma <[email protected]>
Rewrite environment-tutorials/index.md as the primary guide covering
Task Preparation, Environment Design, and Model Training with an inline
single-step weather example (absorbing creating-training-environment.md).

Move multi-step, stateful, and real-world tutorials from
training-tutorials/nemo-gym-environment-guide/ into environment-tutorials/
as progressive exercises with fixes (error handling, guard clauses,
route order warnings, callouts for black-box functions).

Update all cross-references.

Signed-off-by: Shashank Verma <[email protected]>
Add back Model Server and Resources Server explanations, fix
simple_agent description to say multi-step instead of single-turn,
and remove unsubstantiated "most users" claim. Remove PNG from repo.

Signed-off-by: Shashank Verma <[email protected]>
- Fix source-aligned labels in multi-step and stateful tutorials
- Clarify follow-on tutorials focus on Resources Server implementation
- Add parallel_tool_calls tip for multi-step environments
- Note preferred seed_session pattern vs live implementation

Signed-off-by: Shashank Verma <[email protected]>
- index.md is now a clean landing page with environment properties,
  tutorial cards, and navigation
- single-step-environment.md contains the full weather assistant
  walkthrough (scaffolding through training)
- Add documentation, summary, advanced verification patterns, and
  troubleshooting sections to single-step tutorial
- Update toctree and cross-references across all tutorial files

Signed-off-by: Shashank Verma <[email protected]>
Signed-off-by: Shashank Verma <[email protected]>
Reorder sections so readers see the tutorial grid cards before
the environment properties tables, reducing the chance of missing them.

Signed-off-by: Shashank Verma <[email protected]>
- Removes redundant diagram at the top
- Tightens wording in agent server and resources server sections

Signed-off-by: Shashank Verma <[email protected]>
@bxyu-nvidia
bxyu-nvidia merged commit d0f0b97 into NVIDIA-NeMo:main Mar 10, 2026
5 checks passed
@bxyu-nvidia bxyu-nvidia linked an issue Mar 10, 2026 that may be closed by this pull request
2 tasks
bxyu-nvidia pushed a commit that referenced this pull request Mar 10, 2026
Add comprehensive guide for building NeMo Gym environments

- Explains Resource Server architecture and terminology
- Includes 4 complete code examples (simple, multi-step, stateful,
production)
- Documents configuration YAML format and training data JSONL structure
- Covers the RL training loop and server infrastructure

---------

Signed-off-by: Shashank Verma <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
raveedturing pushed a commit to turing-rlgym/Gym that referenced this pull request Mar 18, 2026
Add comprehensive guide for building NeMo Gym environments

- Explains Resource Server architecture and terminology
- Includes 4 complete code examples (simple, multi-step, stateful,
production)
- Documents configuration YAML format and training data JSONL structure
- Covers the RL training loop and server infrastructure

---------

Signed-off-by: Shashank Verma <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
mahanfathi pushed a commit that referenced this pull request Mar 24, 2026
Add comprehensive guide for building NeMo Gym environments

- Explains Resource Server architecture and terminology
- Includes 4 complete code examples (simple, multi-step, stateful,
production)
- Documents configuration YAML format and training data JSONL structure
- Covers the RL training loop and server infrastructure

---------

Signed-off-by: Shashank Verma <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
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.

docs: Create a training environment tutorial

4 participants