Repository navigation
feat(agent_arena): run AgentArena through agent sessions and keep the relay as *_legacy_agent - #5971
Draft
weijiac0619 wants to merge 8 commits into
Draft
weijiac0619 wants to merge 8 commits into
weijiac0619 wants to merge 8 commits into
Conversation
An Environment Server seeds the resources session with a typed seed whose task_data is the row without its responses_create_params, so the server cannot build the history, workspace and simulator preamble at seed time. The session now uses the base session hooks: a typed seed binds the session to its episode and task and keeps the row's verifier_metadata, and the agent's first /harness call brings responses_create_params to finish it. The agent's /run seed (flat row, cookie) still builds the whole session at seed. /harness, /simulate_tool_call, /verify and close are serialized per session. Close is idempotent; a /harness or /simulate_tool_call after close or verify answers 404 (session_lost), and a /verify after close is masked. A retried /verify reports the simulated-call counts the first one saw. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: weijia chen <[email protected]>
The agent refused agent sessions, so its environment could only run behind the legacy_agent relay. It now serves them: /harness and /simulate_tool_call go through the session's direct HTTP grant (its URL with the attempt's rollout prefix, its headers and the session's cookies), and the first /harness call carries the row's responses_create_params, which the resources server's typed seed does not have. A session seeded without a direct HTTP grant is refused (422). The episode loop, the Cline XML protocol, the stop tools and the output-budget handling are unchanged, and /run still calls the configured resources server. Lists agentic_turn_simulation_agent in AGENT_SESSION_AGENT_TYPES. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: weijia chen <[email protected]>
…d keep the relay as *_legacy_agent benchmarks/agent_arena/config.yaml and the environment's own agentic_turn_simulation.yaml now run each turn as an Environment Server episode (single_agent_turn_legacy, resources_tool_transports: [direct_http]). The legacy_agent relay recipes are kept, with a deprecation note, as benchmarks/agent_arena/config_legacy_agent.yaml and configs/agentic_turn_simulation_legacy_agent.yaml. Instance names, the dataset path and the benchmark identity are unchanged. A test resolves both benchmark configs and checks the Environment Server each one binds. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: weijia chen <[email protected]>
|
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. |
… 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]>
…ep the whole verify result The typed seed now carries the row's responses_create_params, so the session is built at seed, as for /run. The /harness body and the pending-row state are gone, and the agent no longer sends the row: any agent that drives /harness and /simulate_tool_call can play the turn. A typed seed without responses_create_params is refused (422). /verify keeps its whole result, bound to a hash of the request: the same request sent again (after a lost reply) returns the first result without calling the judge again, and another request for the session is scored with the counts the session left. The obstacle test that verified one request twice on one session now verifies the second time on an unseeded session. Adds a test that the server is restart-only under rollout checkpointing: its seed reply carries x-ng-checkpoint-restart, and the restarted attempt seeds a fresh session. The agent keeps its _close_agent_session_state override, now commented: test_session_contract_repo requires it of an agent that defines _seed_agent_session_state. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: weijia chen <[email protected]>
…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]>
…rst result was masked A verify whose judge gave no usable verdict returns a masked JUDGE_FAILED result. Keeping it under the request's hash meant the same request, sent again on the session, always got that masked result back. Only unmasked results are kept now, so a resend is scored again with the session's call counts. Also fixes the environment config's comment, which still said the agent's first /harness call brings the row's history: the typed seed carries it now. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: weijia chen <[email protected]>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
AgentArena (
benchmarks/agent_arena/config.yaml) ranagentic_turn_simulation_agentbehind the deprecatedlegacy_agentrelay. The agent refused agent sessions, and the resources server only accepted the seed of theagent's own
/run. This PR moves both onto the Environment Server path (single_agent_turn_legacy), as BrowseComp(#5484, #5489) and the finance stack (#4948, #5491, #5492) did. The relay recipes are kept as
*_legacy_agent.yamlwith a deprecation note.
No issue is linked: the work is tracked internally.
Each episode now runs like this:
agentic_turn_simulationwith a typed seed. The server builds the session there: itpicks the row's harness, replays the history into its model of the agent's files, and prepares the simulator's
prompt.
agentic_turn_simulation_agentsession with a direct HTTP grant to that server. The agent plays theturn, calling
/harnessand/simulate_tool_callthrough the grant: the grant's URL with the attempt's rolloutprefix, its headers, and the session's cookies.
/verify, then closes the resources session.The typed seed's
task_datais the row without itsresponses_create_params, but this server needs the history,tools and instructions at seed. BrowseComp and finance never hit this: their servers need only fields that are
already in
task_data. The first commit therefore adds a small core change, below, so the typed seed carriesresponses_create_paramsbesidetask_data. Nothing benchmark-specific travels between the agent and the server.Changes:
feat(sessions)commit):ResourcesSeedSessionRequestgains an optionalresponses_create_params.single_agent_turnfills it on the Resources server's seed, dumped the way_verify_bodydumps it. Toolservers' seeds do not get it, and a seed without the params leaves the key out of its JSON.
seed_request_modelonly when that model declares aresponses_create_paramsfield.No other server declares one today, so every other server's
task_datavalidates as before. A seed without thefield, from an older caller, still validates.
resources_servers/agentic_turn_simulation/app.py: sessions use the base session hooks from feat(sessions): centralize resources lifecycle and verification ownership #5709(
has_session_state,initialize_session_state,release_session_state,verifying).task_dataplusresponses_create_params. A typed seed withoutresponses_create_paramsis refused (422)./harness,/simulate_tool_call,/verifyand close take the session lock./harnessor/simulate_tool_callafter close or verify answers 404 (session_lost).A
/verifyafter close is masked./verifykeeps its whole result, bound to a hash of the request. The same request sent again, after a lostreply, returns the first result without calling the judge again. A masked result (no usable judge verdict, say)
is not kept, so the same request sent again is scored again. Another request for the session is scored with
the call counts the session left.
/runseed (flat row, cookie) still builds the session at seed, and its/verifyreleases it.responses_api_agents/agentic_turn_simulation_agent/app.py: serves agent sessions./runstill calls the configured resources server._close_agent_session_stateonly callssuper(). It is declared becausetest_session_contract_reporequiresthe close of an agent that defines
_seed_agent_session_state.nemo_gym/config/global_config.py:agentic_turn_simulation_agentis added toAGENT_SESSION_AGENT_TYPES.benchmarks/agent_arena/config.yamland the environment's ownconfigs/agentic_turn_simulation.yamlusesingle_agent_turn_legacywithresources_tool_transports: [direct_http].benchmarks/agent_arena/config_legacy_agent.yamlandconfigs/agentic_turn_simulation_legacy_agent.yamlkeepthe relay, unchanged apart from the deprecation note.
Compatibility
--benchmark agent_arenaandgym env start --resources-server agentic_turn_simulationnow run the session path.--benchmark agent_arena/config_legacy_agentandconfigs/agentic_turn_simulation_legacy_agent.yamlrun therelay as before.
num_repeats: 4, prompts and scoring are unchanged.Does anyone train with
configs/agentic_turn_simulation.yamltoday? If so, that setup should either switch toconfigs/agentic_turn_simulation_legacy_agent.yamlor be checked on the session path first. Training was not runhere; see Known limits.
(retried within the attempt budget) instead of whatever the relay returned. A time-capped turn is still masked by
/verify(agentic_turn_simulation:time_cap).responses_create_params, the same payload/verifyalready receives. A Resources server from an older Gym refuses that seed (its seed request forbids unknown
fields), so the Environment Server and its Resources server must run from the same Gym version. Details in feat(sessions): carry the task's responses_create_params on the typed resources seed #5987.
Validation
Unit tests
New and changed tests:
tests/unit_tests/server_runtime/test_typed_seed_responses_create_params.py, 4 tests:responses_create_paramsgets them;task_dataexactly as before;environment_servers/single_agent_turn/tests/test_app.py: the Resources seed carriesresponses_create_params,and the tool-server seed's JSON has no such key.
resources_servers/agentic_turn_simulation/tests/test_sessions.py, 8 tests:check_resources_session_contracton the typed seed;/harness;x-ng-checkpoint-restart: 1, and the restarted attemptseeds a fresh session;
/runseed.responses_api_agents/agentic_turn_simulation_agent/tests/test_app.py, 6 session tests:/harness;/v1/agent_sessions,/v1/responsesand close.benchmarks/agent_arena/tests/test_configs.py: both configs resolve, and each binds the expected EnvironmentServer type to the same agent.
Run at the head commit:
resources_servers/agentic_turn_simulation/tests,responses_api_agents/agentic_turn_simulation_agent/tests,benchmarks/agent_arena/tests,tests/unit_tests/server_runtime,tests/unit_tests/config/test_global_config.py(including the
AGENT_SESSION_AGENT_TYPESconsistency test),tests/unit_tests/test_public_api_facades.py,tests/unit_tests/test_session_contract_repo.py,tests/unit_tests/environment/test_benchmarks.py,tests/unit_tests/tooling/test_add_legacy_agent_environment_servers.pyandresponses_api_agents/simple_agent/tests: 4215 passed, 2 failed. The 2 failures aretests/unit_tests/server_runtime/supervisor/test_component_compatibility.py, which compares anopenaipin withthe version installed in the test venv (2.44.0 against 2.43.0). This PR does not touch that file.
environment_servers/single_agent_turn/tests246 passed,single_agent_turn_legacy/tests44 passed,legacy_agent/tests12 passed.Real runs
gym eval runon 3 rows of the Arena validation split, 1 repeat each. The rows aresandbox-harness turns with 2 to 4 history items and 11 tools. One Nemotron checkpoint, served by vLLM, was the
policy, the tool simulator and the judge. Settings:
--max-output-tokens 32768, agentmax_time_seconds1200. Theruns used the commit before the review fixes. Those fixes change only a seed without params (the Resources seed here
always has them), the caching of a masked verify (no row was masked), a config comment and tests, so they were not
rerun.
agent_arenasingle_agent_turn_legacyagent_arenasingle_agent_turn_legacyagent_arenasingle_agent_turn_legacyagent_arena/config_legacy_agentlegacy_agentagent_arena/config_legacy_agentlegacy_agentagent_arena/config_legacy_agentlegacy_agentfaulted.
read_fileand similar calls show that the typed seed'sresponses_create_paramsbuilt the session: the workspace was replayed from the row's history at seed, and theagent sent nothing but a body-less
/harness.The server's own retry succeeded, and Gym's judge-failure recovery then re-verified the row from its saved answer,
writing a second line for it that aggregation counted once. That is existing Gym behavior. It did not recur here.
Checks
pre-commit runon the changed files passed: ruff, ruff-format, import-linter and the README table hook. Theprivate guardwords catalog was unavailable, so that hook skipped.
Known limits
/harnessand/simulate_tool_callworks, since the session needs nothing from the agent. But the rows are bound to the originalharness's system prompt, history and tool format. A different harness would change what is being measured, so this
PR keeps
agentic_turn_simulation_agent.server declares no
checkpoint_mode, so it is restart-only. Its seed reply carriesx-ng-checkpoint-restart: 1,so
single_agent_turnmarks the episode as a restart, and after a crash it starts over from its input with a newseed and a new session. A half-played turn is never continued against a used workspace.
/runturn into a retryableagent_time_capfailure. That PR overridesonly
/run, so on the session path a time-capped turn stays masked until a session equivalent lands. The two PRsalso touch nearby lines in the agent's
app.pyand README. The merge order is being coordinated.and judge setup. No score parity with earlier relay runs is claimed.
prepare.pystill copies whatever turns file it isgiven.
🤖 Generated with Claude Code