Repository navigation
Conversation
The environment tutorials taught the agent's /run path and a cookie seed that overrides seed_session with flat row fields. Under an Environment Server, single_agent_turn seeds each session with a typed ResourcesSeedSessionRequest, requires resources_session_id in the reply, keeps the session cookie, verifies, and closes the session. - stateful-environment: implement has_session_state, initialize_session_state and release_session_state with seed_request_model; 404 for a lost session in tools; verifying() and lost_session_verification() in verify; check_resources_session_contract in tests; the Environment Server seeds, verifies and closes. - real-world-environment/resources-server-implementation: the workplace toolkits move into the session hooks; tools answer a lost session with ResourcesSessionLostError. - resources-server-apis: Environment Server and agent-session flow, seed_request_model for task_data, who keeps the cookie, hooks-based state snippet, math_with_code as the reference server, single_agent_turn with a taskset in the seed/verify YAML, single_agent_turn_legacy for flat rows, Harbor task folders as an equal choice, Gymnasium still behind a legacy_agent relay. - single-step, multi-step, integrate-external: single_agent_turn is the default episode driver; a legacy_agent /run relay is not for new work. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test dca2292 |
Contributor
This was referenced Dec 2, 2026
This branch had an error being 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 changed and why
The environment tutorials taught the path that predates Environment Servers: an agent's
/runseeds the Resources Server with the dataset row as a flat cookie seed, and the Resources Server overridesseed_sessionto store state. That is not howmainruns new environments. Under thesingle_agent_turnEnvironment Server:ResourcesSeedSessionRequest(resources_session_id,episode_id,task_id,task_data), and it rejects a seed reply withoutresources_session_id(single_agent_turn/app.py L420-L451)./verify(L436, L532, L668), then closes the session through/close_session(L639-L651).SimpleResourcesServerserves seed and close through three state hooks and validatestask_dataagainstseed_request_model(base_resources_server.py L587, L1134-L1161). A repeated seed returns the existing session, and the same ID from another episode or task gets 409 (L1136-L1142). Close releases by ID and fences the session (L1163-L1190).lost_session_verification(), a masked sample, and a tool call for it raisesResourcesSessionLostError(404) (L394-L432, L1192-L1199).This PR corrects the statements that contradict that and makes
single_agent_turnwith a typedtasksetthe default path. It does not rewrite the tutorials.stateful-environment.mdxhas_session_state/initialize_session_state/release_session_statewithseed_request_modelinstead of overridingseed_session. Tools raiseResourcesSessionLostErrorinstead of creating a counter at 0.verifyusesverifying()and masks a lost session instead of scoring 0. The note that told readers to re-assign state on every seed is replaced: a repeated seed is a retry and keeps its state. Adds acheck_resources_session_contracttest. The Environment Server seeds, verifies and closes in the flow and the transcript. Points toresources_servers/math_with_code, whose tests run the checker, as the server onmainto compare with.real-world-environment/resources-server-implementation.mdx/close_sessiontoo. Notes that the shippedworkplace_assistantstill uses a cookie seed.resources-server-apis.mdx/runonly behind alegacy_agentrelay, not for new work); protocol table; Environment Server sequence; lifecycle API (typed seed,seed_request_model); who keeps the cookie; hooks-based state snippet;math_with_codeinstead of the MCP page as the hooks example; seed/verify YAML tab withsingle_agent_turnand ataskset; collating anexampledataset;single_agent_turn_legacyfor flat rows; Harbor task folders as an equal format; the Gymnasium tab names itslegacy_agentrelay, since no Environment Server drives that protocol yet.single-step-environment.mdxlegacy_agentrelay thatgym env initgenerates withsingle_agent_turnand ataskset; the run steps collate the example taskset and drop--agent.multi-step-environment.mdxsimple_agent's loop.integrate-external-environments.mdx/runrelay in new work.The companion PR for the
add-benchmarkskill is #6032. The two were split to keep each diff reviewable.No issue: these are corrections of docs that disagree with the code on
main.Validation
mainatb02f8d0:check_resources_session_contract(app, seed, keeps_state=True, holds_state=server.has_session_state, verify_body=...)passes.task_data422; increment then get returns 5; verify reward 1.0 with live state released; verify retry reward 1.0 from the retained value; close 200; tool call after close 404session_lost; verify after close masked (mask_sample: true,failure_kind: session_lost).example_single_tool_callstanding in formy_weather_tool:gym env validatereports "Config is valid" (only the model URL unset);gym dataset collate --mode example_validationwrites rows withtask_id.taskset == "my_weather_tool"andtask_input.pre-commit run --fileson the six pages: passed.cd fern && npm run check: 0 errors, 1 warning (the missing-redirects check is skipped withoutfern login; no page moved).Rollout evidence
N/A: docs-only. No environment, agent, or verifier behavior changes, so no model run is needed.
Overlapping open PRs
example_mcp_weatheron the typed sessions API) rewritesmcp-resources-server.mdxtogether with the server change. This PR leaves that page alone so the two do not conflict; its cookie-seed snippet stays until feat(example_mcp_weather): serve the typed resources sessions API #5480 merges.stateful-environment.mdxwith aseed_session/close_resources_sessionoverride whose tools answer a closed session with 409. This PR replaces that section with the hooks pattern, so feat(example-session-state-mgmt): serve Environment Server sessions #4058's doc hunk will conflict (it is already marked conflicting).resources-server-apis.mdx; expect small textual conflicts.Left unchanged
gym env initstill generates alegacy_agentrelay (nemo_gym/environment/scaffold.py); the single-step tutorial tells readers to replace it. Changing the scaffold is code and belongs in its own PR.resources_servers/workplace_assistantandresources_servers/example_session_state_mgmtstill overrideseed_sessionwith a cookie seed. The tutorials no longer present them as the pattern.gymnasium_agentstill needs a relay; the page says so.🤖 Generated with Claude Code