Skip to content

feat(usersim): evaluate environment-owned native tool loop - #4080

Closed
ffrujeri wants to merge 7 commits into
ffrujeri/usersim-environment-serverfrom
ffrujeri/usersim-environment-tool-loop
Closed

ffrujeri wants to merge 7 commits into
ffrujeri/usersim-environment-serverfrom
ffrujeri/usersim-environment-tool-loop

Conversation

@ffrujeri

@ffrujeri ffrujeri commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

What changed and why

  • Adds the Environment-owned UserSim runtime above feat(usersim): add Environment Server orchestration #3801.
  • Makes the Environment own the native ProbeEpisodeRuntime and tool loop.
  • Configures the participant SimpleAgent for one model activation with execute_tools: false.
  • Keeps Resources limited to immutable-row validation, native trajectory scoring, session cleanup, and metrics.
  • Adds deterministic standalone-versus-Gym parity coverage.

This replaces #3797, which GitHub marked merged into #3802 during stack reordering; #3797 was not merged into main.

Validation

  • Focused UserSim tests: passed.
  • Scoped pre-commit: passed.
  • git diff --check: passed.

Rollout evidence

Real UserSim rollout evidence is recorded in the dependent example-suite PR #3802.

Compatibility

This is a pre-release environment-owned runtime comparison; no migration is required.

@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 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.

@ffrujeri ffrujeri added feature New capabilities, enhancements, or enablement work area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers needs-review PR is ready for code review and waiting on a reviewer complexity:high Cross-component or shared-contract change with a large review surface r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge. labels Oct 6, 2026
@ffrujeri
ffrujeri added this pull request to stack #4081 October 6, 2026 00:53
@ffrujeri
ffrujeri force-pushed the ffrujeri/usersim-environment-tool-loop branch from c36f94b to 249f737 Compare October 6, 2026 01:04
@ffrujeri
ffrujeri force-pushed the ffrujeri/usersim-environment-server branch from 8f43670 to df96325 Compare October 6, 2026 01:04

@ananthsub ananthsub 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 for working through round 1.
Several fixes landed and hold up.
Six concern SimpleAgent sessions and the converter, which are now on main through #3784 and #4057:

  • cookie normalization
  • idempotent seeds
  • ray_enabled
  • a required scorer model
  • the HTTPS pin in #3800
  • nemo-gym[dev] in requirements

Three more are fixed in #3801:

  • assistant-only capture
  • assistant-only sandbox access
  • the termination reason

Two problems block further line review.

The stack still bundles generic code, and that code now conflicts with main.
#3800's nemo_gym/ changes are byte-identical to #4060 (dataset_metrics.py, the train_data_utils.py hooks, is_materialized_task_row) and to #4059 (environment_server_agent_refs).
#3818 has merged, so #3800 conflicts with main in nemo_gym/task_data.py and nemo_gym/train_data_utils.py.
#4053 now covers the multi-agent bindings everywhere that matters:

  • validation
  • composition
  • dispatch
  • the migration script
  • #3818's taskset resolution

Please rebase onto main, drop the nemo_gym/ and tests/unit_tests/ changes, and depend on #4053.
#4070 has also merged and removed "native" from the code.
The bundled #4060 code (_native_task_parts, "native task envelope") and the READMEs ("native episode result") add it back.
Please use materialized row and episode request instead.

No PR passes its own tests or data checks at its own head.

  • #3800's resources server calls UserSim APIs that don't exist at its own pin (a5f676bf). Four of its tests fail, and its config references environment_servers/usersim, which arrives in #3801.
  • #3801 pins the environment server to git+ssh at 44c39daf, a different UserSim revision from the resources server.
  • #4080 replaces about 340 lines of #3801's environment server and most of #3800's resources server. It also breaks two core tests that only #3910 fixes, and its new task schema rejects the committed example row.
  • #3802's committed metrics and example rows can't be regenerated from #3802's code.

Please re-cut into PRs that are each green at their own head:

  1. Rebase onto main and depend on #4053. Close #4059 and #4060.
  2. One runtime PR: the resources server and the environment server, on the resolved_row contract, pinned to a5f676bf, with their tests.
  3. A small generic SimpleAgent PR for execute_tools, limited to sessions and documented.
  4. A data PR:
    • prepare.py writes task rows (a stable string task_id plus resolved_row).
    • The dataset declares taskset: and agent: usersim_assistant.
    • The example rows, metrics, and rollouts are regenerated with the code being merged, after the evidence-size fix below.
  5. Docs last.

The 16 comments from #3797 now apply to #4080, and none has a reply yet.

Comment thread resources_servers/usersim/app.py Resolved
Comment thread environment_servers/usersim/app.py Resolved
Comment thread environment_servers/usersim/app.py Resolved
@ffrujeri

ffrujeri commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by the combined runtime in #3800. The environment-owned tool loop, evidence-size fix, retry classification, embedding path, and bridge tests now live there; the generic SimpleAgent control moved to #4111.

ananthsub added a commit that referenced this pull request Oct 6, 2026
main with #4053 and #4060 merged, plus the simplified #3800 (UserSim's
resources server, preparation, and simple_agent changes; no shared data code).
#3801, #4080, and #3802 are left out until they are restacked onto the
simplified #3800, because they still carry the previous #3800.

This branch only previews that base for review of the task-schema stack.
It is replaced by main once the UserSim stack merges.

Signed-off-by: Ananth Subramaniam <[email protected]>
kajalj22 pushed a commit to kajalj22/Gym that referenced this pull request Oct 6, 2026
…on (NVIDIA-NeMo#4114)

## What does this PR do?

Makes a SimpleAgent agent session return the observations of every
activation at close, not only the last one.

During a session, each `/v1/responses` call replaced
`state.observations` with that call's invocation. An environment server
that drives several activations through one session, such as the user
simulation stack (NVIDIA-NeMo#3800, NVIDIA-NeMo#4080), would receive only the final
activation's invocation at close, and `ng_agent_observations` would show
one model call where there were several. `single_agent_turn` makes one
call per session, so it was unaffected.

The fix:

- Records and gaps now accumulate across a session's activations. The
bundle is rebuilt each time, so its unique-ID and parent-graph checks
still run.
- Every activation used the invocation ID `"root"`, so accumulating them
would fail the bundle's unique-ID check. Later activations in a session
now use `activation-<n>`. The first keeps `"root"`, so single-activation
sessions report exactly what they did before.

No issue is linked; this is a follow-up to NVIDIA-NeMo#3784, found while reviewing
the SimpleAgent changes in the user simulation stack.

## Validation

- New test
`test_agent_session_returns_observations_from_every_activation`: two
activations in one session return two invocations, `root` and
`activation-2`, each linked to its own model response. It fails without
the fix.
- `pytest responses_api_agents/simple_agent/tests
environment_servers/single_agent_turn/tests
environment_servers/single_agent_turn_legacy/tests`: all pass.
- `pytest tests/unit_tests/test_rollout_collection.py
tests/unit_tests/test_base_responses_api_agent.py
tests/unit_tests/test_rollout_observability.py`: all pass.
- `pre-commit run` on the changed files: all pass.

## Rollouts

N/A. Single-activation sessions, which every current configuration uses,
produce the same observations as before. The change affects only
sessions with several activations, which the user simulation environment
server introduces; that stack carries its own rollout evidence.

## Compatibility

No configuration change. For sessions with more than one activation,
`ng_agent_observations` now contains one invocation per activation
instead of only the last.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ffrujeri
ffrujeri removed this pull request from stack #4081 October 6, 2026 20:47
@ffrujeri

ffrujeri commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

Superseded by the consolidated materialized-row runtime in #3800. Closing as requested in review; the relevant runtime and attribution fixes now live there.

@ffrujeri ffrujeri closed this Oct 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:environment Individual environments, benchmarks, verifiers, and environment-specific resources servers complexity:high Cross-component or shared-contract change with a large review surface feature New capabilities, enhancements, or enablement work needs-review PR is ready for code review and waiting on a reviewer r0.7.0 Auto-cherrypick to release branch. Apply before merge; cherrypick happens after merge.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants