Skip to content

feat(sessions): carry the task's responses_create_params on the typed resources seed - #5987

Draft
weijiac0619 wants to merge 4 commits into
mainfrom
weijiac/typed-seed-responses-create-params
Draft

weijiac0619 wants to merge 4 commits into
mainfrom
weijiac/typed-seed-responses-create-params

Conversation

@weijiac0619

@weijiac0619 weijiac0619 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

What and why

single_agent_turn seeds a resources session with the task's task_data, which leaves out the task's
responses_create_params. It then sends those params back at /verify (_verify_body). A resources server whose
session is built from the task's history or tools therefore cannot build it at seed. Today such a server has to get
the prompt some other way. The first case is AgentArena's agentic_turn_simulation (#5971): its session replays the
row's history into a model of the agent's files and prepares the tool simulator's prompt from the row's tools and
instructions.

This PR lets the typed seed carry the params:

  • ResourcesSeedSessionRequest gains an optional responses_create_params.
  • single_agent_turn fills it on the Resources server's seed, dumped exactly as _verify_body dumps it
    (mode="json", exclude_unset=True). Tool servers' seeds (_seed_tool_servers) do not get it.
  • A seed without the params leaves the key out of its JSON, as ResourcesSeedSessionResponse does for an unset
    observation. Tool-server seeds therefore keep their wire shape.
  • SimpleResourcesServer passes it into seed_request_model only when that model declares a
    responses_create_params field. No server in the repository declares one today, so every existing server's
    task_data validates exactly as before, including models with extra="forbid".
  • When a seed model that declares the field refuses the seed, the 422 says "task_data with responses_create_params is
    not a valid ...", so it names the params too.
  • Docs: the "Episode sessions" bullet in resources-server-apis.mdx and the single_agent_turn README describe the
    field. They say to declare it optional, since only single_agent_turn (and single_agent_turn_legacy) sends it.

No issue is linked: the work is tracked internally.

Compatibility

  • An older Environment Server against a newer resources server: works. Its seed has no
    responses_create_params, which validates and leaves the field None.
  • Within one checkout: works. A server whose seed model does not declare the field never sees it.
  • A newer Environment Server against a resources server from an older Gym: tool-server seeds still work, since they
    leave the key out. The Resources server's seed does not. It carries responses_create_params, and the older
    ResourcesSeedSessionRequest forbids unknown fields, so that seed gets 422. Run the Environment Server and its
    Resources server from the same Gym version. In practice this needs a Resources server from another checkout or Gym
    release: per-server venvs install nemo_gym editable from the same tree, and PyPI installs pin the parent's version.
  • Payload: the Resources server's seed now carries the task's responses_create_params. That is the same payload
    /verify already receives for the same episode.
  • No change to cookie seeds, mcp_allowed_tools_for_session (still task_data), close, verify or checkpointing.

Validation

Unit tests

New tests:

  • tests/unit_tests/server_runtime/test_typed_seed_responses_create_params.py, 5 tests:
    • a seed model that declares the field receives the params;
    • without them the field stays unset;
    • a model that forbids unknown fields validates task_data as before, and still refuses a bad one;
    • params the seed model refuses are a final 422 that names them, with no session left;
    • a seed without them leaves the key out of its JSON, and a body without the key validates.
  • environment_servers/single_agent_turn/tests/test_app.py: the Resources seed carries the task's
    responses_create_params, and the tool-server seed's JSON has no such key.

Run at the head commit (after merging main), in a fresh environment with the pinned openai:

  • tests/unit_tests/server_runtime, tests/unit_tests/test_session_contract_repo.py and
    tests/unit_tests/test_public_api_facades.py: 2801 passed.
  • environment_servers/single_agent_turn/tests: 281 passed.
  • environment_servers/single_agent_turn_legacy/tests: 47 passed.

Real runs

None on this branch alone, since no server here declares the field. Its consumer, #5971, ran this PR's first commit
with a Nemotron checkpoint. The later commits change only the wire shape of seeds without params (those rows'
Resources seed always has them), the refusal text and docs, plus a merge of main:

  • AgentArena through single_agent_turn_legacy: 3 of 3 rows completed and scored, none masked or failed.
  • The session was built at seed from these params, and the agent sent no row data of its own.

Checks

pre-commit run on the changed files passed at the head commit, including ruff, ruff-format and import-linter. The private guardwords
catalog was unavailable, so that hook skipped.

Known limits

  • Opt-in by field name. Only a seed model that declares responses_create_params receives them. A server that
    wants them under another name, or merged into its own fields, still has to declare that field.
  • Seed size. Every Resources server's seed now carries the task's responses_create_params, whether or not its
    seed model declares them. For a task with a long history or base64 images that roughly doubles what the episode
    sends to that server, since /verify already sends the same params. Only the Resources server's seed pays it, but
    a server that keeps its seed body holds the params for the whole session (terminal_bench_4 keeps a deep copy).
    If a large-image benchmark hits this, an opt-in on the Environment Server (send the params only to Resources
    servers configured to want them) would remove the cost for everyone else.
  • Mixed versions. See Compatibility: the Resources server must not be older than the Environment Server.
  • Other Environment Servers. Only single_agent_turn (and single_agent_turn_legacy, which runs through it)
    fills the field. Other Environment Servers that send typed seeds (harbor, swe_together, nemo_user_sim) leave
    it unset.

🤖 Generated with Claude Code

… resources seed

single_agent_turn seeds a resources session with task_data, which leaves out the task's responses_create_params,
then sends them back at /verify. A server whose session is built from the task's history or tools could not build
it at seed.

ResourcesSeedSessionRequest gains an optional responses_create_params, and single_agent_turn fills it on the
Resources server's seed, dumped as _verify_body dumps it. Tool servers' seeds do not get it. The base passes it to
seed_request_model only when the model declares a responses_create_params field; every other server's task_data
validates as before, and a seed without the field (an older caller) still validates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 11, 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.

…s none

A seed without the params (every tool-server seed) dumped them as null, which a
resources server built from an older Gym refuses: its ResourcesSeedSessionRequest
forbids unknown fields. The key is now left out when it is unset, as
ResourcesSeedSessionResponse does for its observation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
yaoyu-33 added a commit that referenced this pull request Nov 11, 2026
…omationBench sessions branch

Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
yaoyu-33 added a commit that referenced this pull request Nov 11, 2026
…ped seed's params

The typed seed now carries the task's responses_create_params (#5987). The seed model declares that field, and
initialize_session_state refuses a row whose params carry no tools with ResourcesSeedRejectedError (HTTP 422, which
the Environment Server treats as terminal), so a row prepared before this server fails before any model call
instead of being masked at /verify after the episode. A seed without the params, from a caller that does not send
them, is served as before. /verify no longer checks the tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…he field

A seed model that declares responses_create_params validates them with the
task_data, but a refusal still said "task_data is not a valid ...". It now
says "task_data with responses_create_params" when the params were validated.
A test checks that bad params are a final 422 naming them, with no session left.

Document the field in the Resources Server API page and the single_agent_turn
README: declare it optional, since only single_agent_turn (and
single_agent_turn_legacy) sends it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 11, 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.

@yaoyu-33

Copy link
Copy Markdown
Contributor

/ok to test f564045

@yaoyu-33 yaoyu-33 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.

Reviewed at 6379ea6 and pushed one commit, f564045.

What held

  • No in-repo consumer breaks. Servers that read typed seeds either take ResourcesSeedSessionRequest, which now declares the field, or use their own seed model, which ignores the extra key. Tool-server seeds keep their wire shape.
  • single_agent_turn_legacy fills the params too: its flat rows go through materialize_task(row), so the Resources seed carries them, as #5971 needs.
  • The mixed-version 422 needs a Resources Server from another checkout or Gym release. Per-server venvs install nemo_gym editable from the same tree (nemo-gym = { path = "../..", editable = true }), and PyPI installs pin the parent's version. The compatibility note in the description covers it.

What f564045 changes

  • A seed model that declares responses_create_params and refuses them answered "task_data is not a valid …". The refusal now says "task_data with responses_create_params is not a valid …". The new test test_params_the_seed_model_refuses_are_a_final_422_that_names_them checks the final 422, the message, and that no session is left. It fails on 6379ea6.
  • Docs: the "Episode sessions" bullet in resources-server-apis.mdx and the single_agent_turn README now describe the field. They say to declare it optional, since only single_agent_turn and single_agent_turn_legacy send it.

Validation at f564045 (Linux, Python 3.13, openai==2.45.0 as pinned)

  • tests/unit_tests/server_runtime/test_typed_seed_responses_create_params.py: 5 passed. With 6379ea6's base_resources_server.py, the new test fails.
  • environment_servers/single_agent_turn/tests: 246 passed. environment_servers/single_agent_turn_legacy/tests: 44 passed.
  • tests/unit_tests/server_runtime: 1695 passed. 30 failed only because of the run's environment: its tree had no resources_servers/ (27 repo-scan tests), and its venv had mcp 2.3.0 (3 in test_mcp_auto_exposure.py). None touch this change. test_locked_env.py (needs uv on PATH) and test_review_boundary_interfaces.py (needs cloudpickle) were left out.
  • pre-commit run on the changed files passed, including guardwords and import-linter.
  • Not run: CI (/ok to test is posted for f564045), and a real-model run at this head. The description's AgentArena run used ec5c669. The later commits change only the wire shape of seeds without params, the refusal text, and docs.

Description
The Validation section predates f564045 and doesn't list the new test or the docs change. Worth updating before this leaves draft.

task_data=task_input.task_data,
# As _verify_body sends them: a server whose session is built from the task's history or tools
# reads them at seed. Tool servers' seeds do not get them.
responses_create_params=task_input.responses_create_params.model_dump(

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.

Every Resources seed now carries the task's params, whether or not that server's seed model declares them. For image tasks that roughly doubles the seed payload. Servers that keep seed bodies also hold it for the whole session: terminal_bench_4 stores body.model_copy(deep=True) per session (resources_servers/terminal_bench_4/app.py:497).

The description lists this as a known limit, so not blocking. If a large-image benchmark hits it, would an opt-in on the Environment Server (send the params only to Resources Servers that ask for them) be the way to go?

@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

…sponses-create-params

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>
@weijiac0619

Copy link
Copy Markdown
Contributor Author

/ok to test 2b78f17

@weijiac0619
weijiac0619 marked this pull request as ready for review November 12, 2026 23:00
# The task's own responses_create_params, which task_data leaves out: the prompt params /verify also receives.
# A server whose seed_request_model declares a `responses_create_params` field gets them in its seed request,
# for a session built from the task's history or tools; every other server's task_data validates as before.
responses_create_params: dict[str, JsonValue] | None = None

@ananthsub ananthsub Nov 12, 2026 •

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.

if this is needed, it points to a separate gap in the design. this wont generalize well for multiple agents, and will confuse other users. lets discuss the design gaps outside of this PR

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.

Thanks. Happy to take the design discussion outside this PR. The need: AgentArena’s resources server builds its session (a replayed workspace and the tool simulator’s prompt) from the row’s history, tools and instructions, and today the typed seed gives it only task_data. Options I can see:

  1. The benchmark’s data puts what the server needs into task_data. No core change, but the history and tools are stored twice per row.
  2. A benchmark-specific Environment Server that passes the params to this resources server only.
  3. This PR: the seed carries responses_create_params, and only servers whose seed model declares the field receive it.

@ananthsub ananthsub Nov 13, 2026 •

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.

what about migrating the resources server to be an environment server? then it can seed the state however it needs to from the whole row, while passing the agent harness a restricted subset

@svcnvidia-nemo-ci svcnvidia-nemo-ci 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.

SHIP

LGTM — no concerns found.

I reviewed all six changed files and traced the affected paths. The Resources seed uses the same serialization as verification, while tool-server seeds omit the new field. The typed-seed validation preserves task-only and cookie-seed behavior. I also checked legacy delegation, session ownership, MCP restrictions, regression tests, and documentation.

This was a static review. I didn't execute tests or independently verify the reported rollout results.

Note: formal approval is not available for this request, so this review is posted as a comment only.

Review generated by codex. This was a full review. Request a full review with /review reset=true.

@weijiac0619
weijiac0619 marked this pull request as draft November 13, 2026 02:24
auto-merge was automatically disabled November 13, 2026 02:24

Pull request was converted to draft

aroshanghias-nvd pushed a commit to aroshanghias-nvd/Gym that referenced this pull request Nov 13, 2026
…ons and run it through single_agent_turn (NVIDIA-NeMo#5961)

* feat(automationbench): serve AutomationBench as typed resources sessions

Add resources_servers/automationbench. Each typed resources session holds
one task's simulated SaaS world, built from the row's initial_state as
upstream's AutomationBenchEnv.setup_state builds it. POST /api_search,
/api_fetch and /base64_encode run upstream's api toolset on that world
through Gym's automationbench_env, and the model gets tool text and error
text as verifiers words them. /verify scores the final world with the
benchmark's rubric: aa_headline by default, with partial_credit,
task_completed_correctly and the guardrail and objective counts alongside.
A raising rubric masks the sample as verifier_error.

prepare.py now writes the environment's tool schemas and the 131072-token
output budget into each row's responses_create_params, so a Gym agent can
offer the tools. verifiers_agent reads neither. The example rows gain the
same two fields.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* feat(automationbench): run the benchmark through single_agent_turn and keep the verifiers recipe as config_legacy_agent

benchmarks/automationbench/config.yaml now runs simple_agent (50 model
calls, verifiers' max_turns) through single_agent_turn_legacy against the
automationbench resources server, with direct HTTP tool access. The
previous verifiers_agent recipe behind the legacy_agent relay is kept,
unchanged apart from a deprecation comment, as config_legacy_agent.yaml
with its own deprecated manifest. The README describes both recipes,
their sampling and the per-assertion export of each.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* fix(automationbench): mask rows without tools, pin session sampling, drop the stale agent_ref

- /verify masks a sample as verifier_error when the row's
  responses_create_params carries no tools: rows prepared before the
  resources server lack them, the model cannot act on the world, and the
  zero they would score is no grade of the model. The reason names
  `gym eval prepare --benchmark automationbench`.
- config.yaml sets the run's responses_create_params to temperature and
  top_p 1.0, the sampling config_legacy_agent.yaml sends from its agent
  config. Rows still carry neither, since verifiers_agent lets a row's
  value win over its config.
- prepare.py and the example rows no longer write
  agent_ref: verifiers_agent. Dataset collation strips a row's agent_ref
  and routes by the declaring instance (`automationbench` in both
  recipes), so the field only produced a warning.
- Both READMEs say the resources server reuses verifiers' tool dispatch
  as a transitional choice for exact tool parity, and what dropping
  verifiers would take.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* feat(sessions): carry the task's responses_create_params on the typed resources seed

single_agent_turn seeds a resources session with task_data, which leaves out the task's responses_create_params,
then sends them back at /verify. A server whose session is built from the task's history or tools could not build
it at seed.

ResourcesSeedSessionRequest gains an optional responses_create_params, and single_agent_turn fills it on the
Resources server's seed, dumped as _verify_body dumps it. Tool servers' seeds do not get it. The base passes it to
seed_request_model only when the model declares a responses_create_params field; every other server's task_data
validates as before, and a seed without the field (an older caller) still validates.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* fix(sessions): leave responses_create_params off a typed seed that has none

A seed without the params (every tool-server seed) dumped them as null, which a
resources server built from an older Gym refuses: its ResourcesSeedSessionRequest
forbids unknown fields. The key is now left out when it is unset, as
ResourcesSeedSessionResponse does for its observation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* build(automationbench): refresh the resources server lock for openai 2.45.0

main moved the root openai pin to 2.45.0; the component lock check runs on the merge.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* fix(automationbench): keep counted-zero tasks in their domain, version the session recipe 0.2.0

- compute_metrics labels a task that no /verify reached by its task_id prefix, so a task counted as zero under
  count_missing_rollouts_as_zero / count_failure_classes_as_zero stays in its domain's denominator. A domain any
  repeat reports wins.
- benchmarks/automationbench/manifest.yaml moves to 0.2.0; config_legacy_agent keeps 0.1.0, the version earlier
  results were reported under.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* feat(automationbench): refuse a row without tools at seed from the typed seed's params

The typed seed now carries the task's responses_create_params (NVIDIA-NeMo#5987). The seed model declares that field, and
initialize_session_state refuses a row whose params carry no tools with ResourcesSeedRejectedError (HTTP 422, which
the Environment Server treats as terminal), so a row prepared before this server fails before any model call
instead of being masked at /verify after the episode. A seed without the params, from a caller that does not send
them, is served as before. /verify no longer checks the tools.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(automationbench): keep the /verify no-tools mask for a seed without the task's params

A caller whose typed seed does not carry responses_create_params cannot be checked at seed, so /verify still masks a row without tools as verifier_error instead of scoring it 0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(automationbench): refuse a task whose initial_state the world rejects at seed

WorldState validation failed inside initialize_session_state as a plain exception, so /seed_session answered 500 and the Environment Server dispatched the whole episode again. The typed seed contract asks for ResourcesSeedRejectedError (422, terminal) when no retry can make the seed succeed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* docs(automationbench): say that seeds refuse rows without tools and unbuildable worlds

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>

* fix(ci): validate manifest-backed component data and verifier fixtures

Signed-off-by: yaoyu-33 <[email protected]>

* test(benchmarks): return valid dataset reports from composition stubs

Signed-off-by: yaoyu-33 <[email protected]>

* fix(ci): scope release rehearsal changelogs to PR changes

Signed-off-by: yaoyu-33 <[email protected]>

* fix(automationbench): cap simple_agent at 49 steps, write the search index before workers start, declare datasets

- config.yaml: max_steps 49. verifiers' max_turns 50 never runs the 50th call's tool calls; simple_agent runs a
  call's tool calls before it checks max_steps, so 49 caps both at 49 tool rounds on the scored world.
- setup_webserver runs one api_search, so the main process writes upstream's schema index (a non-atomic first-use
  write) before uvicorn starts any worker.
- pyproject declares datasets, which tool_env() imports for its placeholder dataset; lock refreshed.
- README: verifiers stays a dependency through automation-bench itself; only the git pin is the dispatch's cost.
  Note that the server runs with several workers.
- test_sessions_hold_separate_worlds also checks the first session's world after the second seed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: weijia chen <[email protected]>

* fix(ci): restore valid secrets baseline JSON

Signed-off-by: yaoyu-33 <[email protected]>

---------

Signed-off-by: weijia chen <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
Co-authored-by: Claude Opus 5.5 <[email protected]>
Co-authored-by: yaoyu-33 <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added feature New capabilities, enhancements, or enablement work area:core Shared APIs, servers, telemetry, health, and registries labels Nov 16, 2026

This branch was previously deployed

1 inactive (outdated) deployment
public — f5640451 Deployed Nov 11, 2026 by copy-pr-bot[bot] via release / finalize / notify #11837
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:core Shared APIs, servers, telemetry, health, and registries feature New capabilities, enhancements, or enablement work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants