Skip to content

feat(rollout): route tasksets to unmigrated agents through legacy_agent relays - #4099

Draft
ananthsub wants to merge 1 commit into
ananthsub/task-schemas/environment-task-schemasfrom
ananthsub/task-schemas/legacy-agent-tasksets
Draft

ananthsub wants to merge 1 commit into
ananthsub/task-schemas/environment-task-schemasfrom
ananthsub/task-schemas/legacy-agent-tasksets

Conversation

@ananthsub

@ananthsub ananthsub commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Lets a dataset declare taskset: while its agent still runs behind a legacy_agent relay, so existing datasets can move to taskset routing before their agents migrate.

A materialized task goes to its environment server as an episode request. A legacy_agent relay forwards its body to an agent that still owns its episode through /run, and those agents read task fields and collector keys such as _ng_task_index and _ng_rollout_index from the top level of the row; harbor_agent_general requires them. An episode request would break them, so a taskset could not route to a relay.

Where this fits

Datasets reach an environment server in one of two ways today: run request rows route by their agent, and datasets that declare taskset: are materialized during collation and route by environment_server_routes. The goal is one path, where every dataset declares a taskset and routes to an environment server:

flowchart LR
    P["Preparation script<br/>task rows with a stable task_id"] --> C["Collation<br/>validates, computes metrics,<br/>materializes"]
    Y["Dataset YAML<br/>file + taskset"] --> C
    S["task_data.py schemas<br/>environment server + resources server"] -.-> C
    C --> R["Rollout collection<br/>routes by taskset"]
    T["environment_server_routes"] --> R
    R --> E["Environment server<br/>single-agent, multi-agent,<br/>or legacy_agent relay"]
Loading

The UserSim stack (#3800 and #3802) has merged. UserSim's datasets already declare taskset: and commit plain task rows, so they use the one path. Each step is additive, and datasets without taskset: keep working until the last one:

flowchart TB
    S4053["PR 4053 (merged)<br/>tasksets route to servers<br/>with several agents"]
    S4060["PR 4060 (merged)<br/>metrics for<br/>materialized rows"]
    S3800["PR 3800 (merged)<br/>UserSim runtime"]
    S3802["PR 3802 (merged)<br/>UserSim validation tasks"]
    S4096["PR 4096<br/>stable, unique<br/>task IDs"]
    S4097["PR 4097<br/>metrics for<br/>every row"]
    S4098["PR 4098<br/>schema per<br/>environment server"]
    S4099["PR 4099<br/>legacy_agent relays<br/>serve tasksets"]
    SREF["Remove the bridge<br/>for already-materialized<br/>rows"]
    SNEXT["Later<br/>configs declare taskset:,<br/>then agent routing retires"]
    S4053 --> S4060 --> S3800 --> S3802 --> S4096 --> S4097 --> S4098 --> S4099 --> SREF --> SNEXT
    classDef done fill:#F1EFE8,stroke:#5F5E5A,color:#444441
    classDef prereq fill:#FAEEDA,stroke:#854F0B,color:#633806
    classDef this fill:#EEEDFE,stroke:#534AB7,color:#26215C,stroke-width:2px
    classDef next fill:#E1F5EE,stroke:#0F6E56,color:#085041
    class S4053,S4060,S3800,S3802 done
    class S4099 this
    class S4096,S4097,S4098,SREF,SNEXT next
Loading

Gray: merged. Purple: this PR. Green: other steps.

Base branch. This stack is based on main. Review only this PR's own diff.

Changes

  • Rollout collection sends a legacy_agent relay the run request row its agent reads today, rebuilt from the materialized task: the task's fields, the collector keys, and the agent's agent_ref. The agent's /run result is stored as the rollout, with the task's ID in _ng_task_id.
  • A taskset declared on a resources server routes to a relay when the relay's agent references that resources server, since a relay binds no resources server.
  • Collation validates those rows against the relay's SingleAgentTaskData and the agent's resources server schema.
  • The legacy_agent README and resources-server-apis.mdx describe taskset routing through a relay.

No issue is linked. This follows the dataset routing design for environment servers.

Validation

  • tests/unit_tests/test_rollout_collection.py: the rebuilt row matches the flat row an agent reads, and run_from_config sends a relay a run request instead of an episode request and stores the agent's result with the task's ID and the legacy_agent result type.
  • tests/unit_tests/test_benchmarks.py::TestTasksetRouteToLegacyAgentRelay: a resources-declared taskset reaches a relay through its agent, an agent that references another resources server is rejected, and collation uses the agent's resources schema.
  • The new tests fail without the change.
  • Collation check on real configs: for each resources server config with a legacy_agent relay and an agent-declared example dataset, I ran gym dataset collate +mode=example_validation as committed and again with taskset: routed to the relay. Then I compared the row each agent would receive on both paths. They are identical for all of the configs that collate. The configs that do not collate fail identically on main (stale committed metrics sidecars, judge models the config does not define, missing example files). Committed metrics sidecars did not change.
  • pytest on the affected test modules passes on every branch of this stack.
  • pre-commit run on the changed files: all pass.

Rollouts

Not run: no model endpoint credentials were available in this environment. The collation check above compares the agent's input on both paths offline. A real rollout through a relay with a declared taskset is still needed before this leaves draft.

Compatibility and benchmark impact

  • Datasets without taskset: are unaffected.
  • A taskset can route to a legacy_agent relay, and the agent behind it receives the same row as when the dataset routes by agent.
  • No benchmark impact.

@ananthsub
ananthsub added this pull request to stack #4100 October 6, 2026 13:25
@copy-pr-bot

copy-pr-bot Bot commented Oct 6, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@ananthsub
ananthsub force-pushed the ananthsub/task-schemas/legacy-agent-tasksets branch from 589aa3f to f1b8c6f Compare October 6, 2026 14:05
@ananthsub
ananthsub force-pushed the ananthsub/task-schemas/legacy-agent-tasksets branch from f1b8c6f to 4ee59c4 Compare October 6, 2026 17:02
@ananthsub
ananthsub removed this pull request from stack #4100 October 6, 2026 17:03
@ananthsub
ananthsub added this pull request to stack #4110 October 6, 2026 17:03
@ananthsub
ananthsub force-pushed the ananthsub/task-schemas/legacy-agent-tasksets branch from 4ee59c4 to 4bd567c Compare October 6, 2026 17:44
@ananthsub
ananthsub force-pushed the ananthsub/task-schemas/legacy-agent-tasksets branch from 4bd567c to b9b6ecc Compare October 7, 2026 05:22
@ananthsub
ananthsub removed this pull request from stack #4110 October 7, 2026 05:22
@ananthsub
ananthsub added this pull request to stack #4159 October 7, 2026 05:22
…nt relays

A dataset that declared taskset: could only route to an environment server
that accepts episode requests. A legacy_agent relay forwards /run to an agent
that still owns its episode, and that agent reads task fields and collector
keys such as _ng_task_index from the top level of a run request row, so an
episode request would break it. Until every agent migrated, existing datasets
could not declare a taskset.

Rollout collection now sends a legacy_agent relay the run request row the
agent reads today, rebuilt from the materialized task, and stores the agent's
result with the task's ID. A taskset declared on a resources server routes to
a relay when the relay's agent references that resources server, and
collation validates its rows against that resources server's schema.

Signed-off-by: Ananth Subramaniam <[email protected]>
@ananthsub
ananthsub force-pushed the ananthsub/task-schemas/legacy-agent-tasksets branch from b9b6ecc to 5f7cbdb Compare October 8, 2026 00:06
@svcnvidia-nemo-ci svcnvidia-nemo-ci added area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work labels Oct 20, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:evaluation Evaluation, rollout collection, reward profiling, comparison, and exporters feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants