Skip to content

docs: explain why Gym runs separate servers and when it uses Ray - #6065

Merged
ananthsub merged 2 commits into
mainfrom
ananthsub/docs-servers-and-ray
Nov 19, 2026
Merged

ananthsub merged 2 commits into
mainfrom
ananthsub/docs-servers-and-ray

Conversation

@ananthsub

@ananthsub ananthsub commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

What and why

New users ask two questions about Gym: why it runs agents, resources servers, and model servers as separate servers when they're used to running an agent in one process, and what Ray is for. Ray is now opt-in: a server uses it only if it declares ray_enabled = True, and nemo-gym[ray] is an optional extra. Several pages still described the old behavior, where Gym always installed and started Ray.

This PR:

  • Adds a Why Separate Servers section to the Architecture page. It covers isolated dependencies per server, independent scaling, reuse across evaluation and training frameworks, and HTTP boundaries that match how training frameworks call Gym.
  • Adds a Distributing Heavy Work section to the same page. It gives an overview of how a server can move heavy work off its own processes, in order: the Sandbox API, whose remote providers run sandboxes on their own machines; inference endpoints, where a server calls a model server for a judge or reward model instead of loading it; and Ray, which is opt-in and is not how servers communicate.
  • Moves the Ray guide out of the FAQ onto its own Infrastructure page, Scale CPU-Heavy Work with Ray, and adds a note for users upgrading from 0.7.0 or earlier: declare ray_enabled = True, and install the ray extra, which pip install nemo-gym no longer includes.
  • Fixes passages that said Gym always installs or starts Ray:
    • README.md: drops Ray from the prerequisites. Most users never need it, and the installation page covers the ray extra.
    • FAQ: the sandbox PermissionError entry now says Gym starts Ray only for servers that declare it, and links to the new page.
    • Deployment Topology: Gym starts its own Ray cluster only when a configured server uses Ray. Adds a row to the decision table.
    • System Design: the startup diagram labels the Ray phase as conditional, matching the text below it.
    • Execution and State Match: drops Ray from this verification-design page, including the code_gen example (it moved to sandboxes). One sentence now points to Architecture for where heavy checkers run, and evalplus and code_fim are listed as code-execution checkers.
    • Integrate External Environments: Ray workers are opt-in, with a link to the new Ray page.
  • Points the new Ray page at sandboxes and model servers first, and mentions the Sandbox API next to Ray in the Integrate External Environments guide.
  • Updates agent guidance: AGENTS.md and the add-benchmark skill now say a server that uses Ray must declare ray_enabled = True and request nemo-gym[ray], and point isolated code execution at the Sandbox API. The skill's Ray server example declares ray_enabled = True.
  • Makes the Ray example async. It awaited nothing and called ray.get(), which blocks the event loop in server code. It now awaits the Ray futures.

Each statement follows the code on main: SimpleServer.ray_enabled, _ray_server_names and the launch path in the server supervisor, _connect_server_to_ray, the ray extra in pyproject.toml, and the ray_enabled declarations in evalplus, code_fim, code_gen, and local_vllm_model.

No release-notes entry: the change that made Ray optional merged after v0.7.0, so it belongs in the next release's notes, written when that release is cut.

Closes #2857

Validation

  • pre-commit run --files on the changed files: passed.
  • fern check: no errors. The one warning is the missing-redirects check, which is skipped without Fern authentication.
  • fern docs broken-links, after generating the library reference: no broken links in the changed pages. The remaining errors are in earlier version snapshots and in sandbox pages this PR doesn't touch.

Rollouts

N/A: docs only.

Compatibility

None. Docs only.

@ananthsub ananthsub added docs Documentation-only updates or documentation debt area:docs Generic documentation without another dominant domain labels Nov 12, 2026
@nemo-automation-bot
nemo-automation-bot Bot requested review from a team November 12, 2026 16:03
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

@ananthsub
ananthsub force-pushed the ananthsub/docs-servers-and-ray branch from ba5eb42 to 2abb6f9 Compare November 12, 2026 16:11
@yaoyu-33
yaoyu-33 self-requested a review November 12, 2026 18:04

@cwing-nvidia cwing-nvidia left a comment

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.

Thanks, this is accurate: I checked the ray_enabled declarations, the ray extra, the startup check and the RAY_ENABLE_AUTO_CONNECT=0 launch against main. The async fix to the FAQ example is a good catch, and "Why Separate Servers" answers the question new users ask most.

Please address:

  1. Agent guidance. The add-benchmark skill (.agents/skills/add-benchmark/references/patterns.md, "Subprocess Execution with Ray", and the Ray bullet in its SKILL.md) and the Ray bullet in AGENTS.md still teach the Ray pattern without ray_enabled. A coding agent that follows them writes a server that fails at startup with "Ray has not been started yet". Many new environments are written this way, so this matters as much as the user docs.
  2. Move the Ray guide out of the FAQ onto its own Infrastructure page with a task-based title (inline on faq.mdx:332). This PR makes it the main Ray page, so it should live where people look for it.
  3. Add an upgrade note for existing users (inline on faq.mdx:334). Custom servers that call Ray without declaring it now fail, and plain pip install nemo-gym drops Ray.

Also suggested inline: drop Ray from the README, rewrite the closing paragraph of Why Separate Servers (and drop the 65,000 figure), and remove Ray from the verification patterns page. I also left one question on the Python-version bullet.

Comment thread README.md Resolved
@ananthsub

Copy link
Copy Markdown
Contributor Author

Thanks. All three are in 2226fbc. AGENTS.md and the add-benchmark skill now teach ray_enabled = True and the ray extra, and point isolated execution at the Sandbox API. The skill's Ray example declares it, and is relabeled from code_gen to evalplus. The Ray guide is now its own Infrastructure page, "Scale CPU-Heavy Work with Ray", with your upgrade note. None of the opt-in changes shipped in 0.7.0, so "0.7.0 or earlier" is accurate.

@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 13, 2026
@yaoyu-33
yaoyu-33 requested review from gchlebus and removed request for cwing-nvidia November 16, 2026 00:16
yaoyu-33
yaoyu-33 previously approved these changes Nov 16, 2026
@github-actions github-actions Bot removed the sla:review-overdue Review response is over the one-business-day SLA label Nov 16, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the blocked Work cannot move forward until an external dependency is cleared label Nov 16, 2026
@github-actions github-actions Bot added the sla:review-overdue Review response is over the one-business-day SLA label Nov 17, 2026
Add a section to the architecture page on why agents, resources servers
and model servers run as separate servers, and an overview of how a server
can move heavy work off its own processes: sandboxes, inference endpoints,
and opt-in Ray, which is not how servers communicate.

Move the Ray guide out of the FAQ onto its own Infrastructure page, Scale
CPU-Heavy Work with Ray, with a note for users upgrading from 0.7.0 or
earlier. Fix pages that still said Gym always installs or starts Ray, make
the Ray example await its futures instead of calling ray.get() in async
code, and drop Ray from the README prerequisites and from the verification
patterns page.

Teach the ray_enabled declaration and the ray extra in AGENTS.md and the
add-benchmark skill, so agents that follow them write Ray servers that
start.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub
ananthsub force-pushed the ananthsub/docs-servers-and-ray branch from a2bb2fd to a0c1f50 Compare November 18, 2026 00:47
@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 18, 2026 00:48
cwing-nvidia
cwing-nvidia previously approved these changes Nov 18, 2026

@cwing-nvidia cwing-nvidia left a comment

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.

Thanks, this covers everything. One fix before merge: the Fern docs check fails because the new page repeats its title as an H1 (suggestion inline).

@nemo-automation-bot
nemo-automation-bot Bot requested a review from a team November 19, 2026 02:43
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the risk:low Autobot PR risk: low label Nov 19, 2026
@ananthsub
ananthsub merged commit 20ddf51 into main Nov 19, 2026
52 checks passed
@ananthsub
ananthsub deleted the ananthsub/docs-servers-and-ray branch November 19, 2026 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:docs Generic documentation without another dominant domain blocked Work cannot move forward until an external dependency is cleared docs Documentation-only updates or documentation debt risk:low Autobot PR risk: low sla:review-overdue Review response is over the one-business-day SLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

confusion around servers and Ray

4 participants