Repository navigation
Conversation
An agent session gets its initial model input and its grants, but no task data. Harnesses that build part of their input from the task row, such as gdp_pdf_agent's document manifest, labbench2_vlm_agent's media directory and CritPt's formatting prompt, had no supported way to receive it under single_agent_turn. A task row now carries that data in a reserved agent_context key: small inline values (at most 64 KiB) and artifact references, paths relative to a root the agent configures. SingleAgentTurnTaskInput lifts it out of task_data, so the Resources Server never receives it, and single_agent_turn passes it in AgentSeedSessionRequest.agent_context, omitted when empty. Each agent declares the keys it reads in agent_context_model. The base seed refuses with a terminal 422 a context the agent declares no model for, an undeclared key, a missing required key or a mistyped value, so a task never runs without data it was given. Agents read the typed context with parse_agent_context() and resolve artifacts with resolve_agent_context_artifact(), which refuses paths that leave the root. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…idation A server's TaskData schema validates the task-owned fields of a row and reports unknown keys. agent_context goes to the agent session, never to the Resources Server, so it joins RESERVED_ROW_KEYS instead of showing up as an unknown task field. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
gdp_pdf_agent builds the model input from the task's document manifest in run(), with a reactive DPI, compositing and text-only backoff. Under an agent session none of that ran, so the model answered the bare prompt without the document. The agent now declares its agent_context: artifacts.document_manifest, required. It resolves the manifest under documents_base_dir when the session is seeded, also when a checkpoint restore rebuilds the session, and refuses a missing manifest or one rendered at another DPI with a terminal 422. The activation builds the same request as run(), through a shared _document_request, and backs off within its one activation. In a session Simple Agent returns a model HTTP error as a failed response instead of raising, so the backoff reads the input limit from that response. A document that never fits returns the empty failed response run() scores as a zero attempt, without an outcome, so the Environment Server verifies it. Other model errors stay the classified model_request_error failure, for the Environment Server's outcome policy. The delivery record goes into the response's document_delivery metadata, and images are removed from the session's trajectory and observations. prepare.py writes agent_context into every row, and the committed example rows carry it. The legacy /run path sends the same requests as before. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 1ec247a |
…tate An agent whose task context lives in its session state, such as a document or media to put in the model request, had to override responses() to reach that state from the episode it creates. Environment validation then infers custom-gym-agent-loop for it, though the agent loop is still Simple Agent's. responses() now creates a session activation's episode through _create_session_episode(state, body, **kwargs), which by default calls _create_episode. A subclass overrides it to use the session's context and leaves responses() and the agent loop alone. The sessionless path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…s episode, not responses() Overriding responses() made environment validation infer the custom-gym-agent-loop profile, though the agent loop is still Simple Agent's and the manifest declares custom-gym-verifier. The delivery and backoff now run in _create_session_episode, which gets the session state directly, so the responses() override and its context variable are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 272f391 |
…ssions Signed-off-by: yaoyu-33 <[email protected]>
…ntext Signed-off-by: yaoyu-33 <[email protected]>
…erifier - Refuse an artifact path with a NUL byte at validation, and turn a path the filesystem cannot look up (name too long, no permission) into a 422 seed refusal instead of a 500; other OS errors stay retryable. - Count the 64 KiB values limit in UTF-8 bytes, not ASCII-escaped JSON. - Treat an empty agent_context as none in the task input and the seed, so the seed and task digest match a row without the key and an agent server that predates the key still accepts the seed. - Skip a task_data container's agent_context in dataset validation, as the task input lifts it out. - single_agent_turn_legacy: answer a row that fails the episode request model with the typed /run's 422. - Re-verification no longer sends a stored agent_context to the Resources Server's /verify. - Docs and helper docstring: a Simple Agent subclass resolves context in _new_session_state (restores rebuild through it) and overrides _create_session_episode, never responses(); configure the real directory as the root; files under a directory artifact are the agent's to confine. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…age images - Seed: a manifest that cannot be read or parsed is a final 422 refusal, not a 500 that is retried. - A manifest's page images must resolve inside the manifest's directory, on /run and in sessions, so a manifest cannot send other files on the host to the model. - Session backoff: an empty-body 5xx is still backed off as a payload limit, but if it persists through text only, the activation returns Simple Agent's classified model_request_error for the outcome policy instead of an unclassified failure scored 0; Gym's model server relays such an empty body. - Tests: /run and a session send the same model requests (all pages, max_pages, text only); empty-body 500 backoff and persistence; malformed manifests; page image confinement. - README: the session refusals, and pointing documents_base_dir at the real directory behind a symlink. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
…ntext Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 7b2075f |
Signed-off-by: yaoyu-33 <[email protected]> # Conflicts: # environment_servers/single_agent_turn_legacy/tests/test_app.py # environment_servers/swe_together/tests/test_environment.py # nemo_gym/agents/base_responses_api_agent.py # pyproject.toml # responses_api_agents/gdp_pdf_agent/README.md # responses_api_agents/gdp_pdf_agent/app.py # responses_api_agents/gdp_pdf_agent/tests/test_app.py # responses_api_agents/simple_agent/tests/test_app.py # tests/unit_tests/server_runtime/test_agent_context.py
…attempts - prepare.py writes agent_context only for rows with a rendered manifest. Rows from prepare_opencode.py (render_documents=False) carried an empty manifest path, so every OpenCode GDP.pdf session was refused with 422; its agent takes no agent context anyway. - is_prepared_data_current re-prepares a cached gdp_pdf file whose rows lack agent_context. - In a session, a document that never fits marks its delivery record when mask_failed_attempts is on, and gdp_pdf verify() applies the mark as run() does (mask_sample, failure_kind, instance_config.mask_sample). verify() also copies the record to the row's document_delivery, agent_adaptations, failure_reason and pages_truncated, so session rows match /run rows. - The seed refuses a manifest page whose text or page image the delivery would read is missing. A storage error reading the manifest (EIO, ESTALE) now fails the seed as a retryable error instead of a terminal 422; path errors still refuse it. - README, docstring and field description updates for the session path. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
|
/ok to test 8de9ca4 |
Signed-off-by: yaoyu-33 <[email protected]>
Signed-off-by: yaoyu-33 <[email protected]>
|
do we want to keep *_legacy_agent.yaml for this benchmark? |
|
could you provide before/after reward comparison in the description |
|
Agreed on keeping a single GDP.pdf preset. I checked the benchmark and component configs at |
|
Added the per-task before/after reward table near the top of the description. Over three matched examples the mean was 0.4332 on base and 0.2447 on the session head. All six rows were graded, all three policy request hashes matched, and both verifiers reproduced the same 96 criterion scores with the saved answers and judge replies. The largest observed difference was the four-page construction example, where the two policy answers named different worst subcontractors. |
|
/ok to test 9e0e042 |
GDP.pdf now delivers the PDF through agent sessions when run from the benchmark config or selected through agent composition. This builds on the role-keyed agent context from #5703.
Paired before/after rewards at
9e0e04285Compared base
c2974f7bd(shipped legacy relay → agent/run) with head9e0e04285(shipped flat-row environment → agent session) on the same three committed GDP.pdf examples as the earlier comparison. Both arms used NVIDIA NIMnvidia/nemotron-3.5-super-vl-120b-a12bfor policy and rubric judging, 150 DPI, thinking disabled, temperature 0 for policy generation and a 4,096-token policy output cap. Each task ran once per arm.9ef247ac)55fe580d)758bb8e1)All three pairs sent byte-equivalent canonical policy payloads, including the page images, and had identical input-token counts. All 96 criterion evaluations completed and all six rows were unmasked. A preliminary run hit judge HTTP 429s. The table uses the completed, rate-paced rerun. On the construction task the base answer named Norske as the worst subcontractor and earned 5/6 criteria. The session answer named Warner Stellian and earned 1/6. Replaying all six saved answers and their judge replies through each revision reproduced every criterion score and reward. One attempt on each of three tasks limits inference about benchmark-wide score changes.
The verifier graded the answers returned at the output cap for Warehouse bonuses (before, after), Production scheduling (after).
What and why
gdp_pdf_agentbuilds the model input from the task's document manifest inrun(): page images and extracted text, with a reactive DPI, compositing and text-only backoff when the policy model rejects the request's size. It inherits Simple Agent's agent sessions, but an agent session never reachesrun(), so undersingle_agent_turnthe model answered the bare prompt without the document.With the agent-context contract from #5703:
Context. The agent declares
agent_context_modelwithdocument_manifest, a required artifact.benchmarks/gdp_pdf/prepare.pywritesagent_context = {"agent": {"artifacts": {"document_manifest": {"path": ...}}}}into every rendered-document row, keyed bysingle_agent_turn's one role,agent, and the committedexample.jsonlrows carry it. Nothing else in those rows changed.Seed.
_new_session_stateresolves the manifest underdocuments_base_dir. That also covers a checkpoint restore, which rebuilds sessions through the same method. A missingagent_context, a missing, unreadable or malformed manifest, a page image outside the manifest's directory, or a manifest rendered at a DPI other thandpiis refused with a terminal 422.documents_base_dirmust be the real directory, not a symlink to other storage (the README gives an example).Activation. The delivery runs in
_create_session_episode, the Simple Agent hook from feat(agents): deliver per-task agent context to agent sessions #5703, which gets the session state. The agent does not overrideresponses(), so environment validation still inferscustom-gym-verifier, the profile the benchmark manifest declares. The session builds each attempt with_document_request, whichrun()now uses too, so both paths send the same request. The backoff runs inside the one activation. In a session, Simple Agent returns a model HTTP error as a failed response instead of raising it, so_session_model_errorreads the input limit from that response, with the same classifierrun()uses.Delivery record. It goes into the response's
document_deliverymetadata as a JSON string, withpages_truncatedin it. gdp_pdf'sverify()copies it to the row'sdocument_delivery,agent_adaptationsandfailure_reason(andverifier_metadata.pages_truncated), so a session row has the fields a/runrow has.mask_failed_attempts(feat(gdp-pdf): training reward modes and opt-in masking of failed attempts #5529). In a session the Environment Server returns the row, so for a document that never fits the agent marks its delivery record, andverify()setsmask_sample,failure_kindandinstance_config.mask_sampleasrun()does.Observations. With
strip_images_from_outputon, the session's trajectory, and so its observations andng_trajectory, lose the page images and gain amultimodal_history_redactedgap.Shipped configs.
resources_servers/gdp_pdf/configs/gdp_pdf.yamlandbenchmarks/gdp_pdf/config.yamlnow putsingle_agent_turn_legacyin front of the agent instead of thelegacy_agentrelay, so their episodes run in agent sessions. Benchmark data prepared beforeagent_contextexisted is refused at the seed with 422;gym eval prepare --benchmark gdp_pdfwrites the key. The README says so.The standard single-message rows keep their request shape on both paths. Both also accept a string prompt, preserve surrounding messages, and stop at the DPI floor when the PDF has no text for a fallback request.
#5703 now keys a row's
agent_contextby participant role, soprepare.pyand the example rows write the context underagent. A row in the earlier unkeyed shape is refused with 422 at the task input, before the agent is seeded.#5695, which refused agent sessions in this agent until document delivery existed, is closed in favor of this PR.
No public issue: this is the document-delivery migration of one agent onto the contract in #5703.
Behavior that differs from
/run(please review)Model errors other than input limits no longer differ: since #5740 on main,
run()also lets them leave as typed failures instead of scoring a zero, and a session returns themodel_request_errorfailure Simple Agent reports (after its own 5xx retries) for the Environment Server's outcome policy. In both, only a terminal input limit is a scored zero.run()retried a verify lost in transport and then masked the row with reward 0. In a session, a verify failure is the Environment Server's typed failure.skip_verification.single_agent_turnnow hasskip_verificationandskip_verification_reward, which fall back to the agent's own settings. When verification is skipped, even a document that never fit receives the fixed reward. Its delivery record stays in response metadata. Training that depends on the GDP.pdf mask needs verification enabled.model_request_error(status 500) instead of the unclassified zero; a real size verdict (413, context-length text) still ends as the scored zero.run()is unchanged.Validation
Training token capture, head
9e0e04285. Ran the shipped session environment on the four-page construction example (55fe580d) with NIMnvidia/nemotron-3.5-super-vl-120b-a12b, capture enabled for the agent, and the vLLM adapter requesting token IDs and chosen-token logprobs. The returned message and the durable Gym token record matched element for element: 10,268 prompt IDs, 16 generation IDs, and 16 generation logprobs. Finalization keptmask_sample=false. This capture-only probe skipped grading and reached its deliberate 16-token output cap. It covers a single session activation.Preset choice. GDP.pdf ships its session config only. The
single_agent_turn_legacyenvironment accepts the existing flat dataset rows and drives the agent session. There is no separate*_legacy_agent.yamlpreset for GDP.pdf.At
9e0e04285, against mainc2974f7bd:gdp_pdf_agentwith the session-capable agents used by config composition. Fixed stale role keys and mismatched document paths in the prepared-data cache, empty manifests, and seed checks for page images omitted by the configured image cap.python -m pytest --import-mode=importlibseparately onresponses_api_agents/gdp_pdf_agent/tests,resources_servers/gdp_pdf/tests,tests/unit_tests/config/test_global_config.py,tests/unit_tests/server_runtime/test_agent_context.py,environment_servers/single_agent_turn/testsandenvironment_servers/single_agent_turn_legacy/tests. 946 passed, 15 skipped (example media). Reproduced the registry, stale-cache and document-delivery failures before applying the fixes.pre-commit run --all-filespassed. The private guardwords catalog was unavailable.gym env validate --config benchmarks/gdp_pdf/config.yamlandgym env validate --config benchmarks/gdp_pdf/opencode.yaml +gdp_pdf_sandbox_image=gdp-pdf-toolsboth reported valid in non-strict mode.At
8de9ca46a2(main90e192df93merged; review fixes), on a Linux workstation with Python 3.13.14:prepare.pywritesagent_contextonly for rows with a rendered manifest.prepare_opencode.py(feat(gdp-pdf): add OpenCode environment and benchmark #5635) prepares rows without one, which carried an empty manifest path, so every OpenCode GDP.pdf session would have been refused with 422.is_prepared_data_currentprepares a cached file again when its rows lackagent_context.mask_failed_attemptsnow works in sessions, as described above.gdp_pdf_agent: 94 passed, 14 skipped.gdp_pdf: 133 passed, 1 skipped. Skips are the example documents, which are not committed. The round adds 12 tests and extends the OpenCode prepare test. With the pre-fixapp.pyfiles andprepare.py, 9 of them fail; the rest check what must not change (a page the delivery never reads, a delivered answer, a response without a record).gym env validate: valid forgdp_pdf.yamlwith its judge config,benchmarks/gdp_pdf/config.yamlandbenchmarks/gdp_pdf/opencode.yaml.pre-commit run --files <changed files>: clean.Earlier rounds:
Primary venv with the worktree on the path, Python 3.13, Pillow added from a scratch directory:
responses_api_agents/gdp_pdf_agent/tests: 66 passed, 16 skipped (the committed example manifests are fetched byprepare.py, not stored in git). The seven new session tests cover:model_request_error;app.pyin place of this one, all seven new tests fail.resources_servers/gdp_pdf/tests: 57 passed, 1 skipped.pre-commit run --files <changed files>: passed.At
7b2075f82(#5703's updated branch and main379ae226dmerged, after a review round):gdp_pdf_agent+gdp_pdftests: 146 passed, 32 skipped (example manifests are not committed);test_session_contract_repo.py+test_global_config.py: 233 passed;pre-commit run --files: clean. New tests:/runand a session send identical requests for all pages, withmax_pages=1, and text-only; an empty-body 500 backs off once and then completes; malformed manifests are refused at seed; a page image path with..or an absolute path is refused (at seed, and as aValueErrorfromrun(), like the DPI mismatch, sorun()now refuses such a manifest too). Removing any of those fixes makes a test fail.At
14169aa29(main028348701merged; only the imports conflicted with #5740):gdp_pdf_agenttests,tests/unit_tests/agents/test_raw_verify_typed_row.py,test_typed_agent_faults.pyandtest_agent_context.py: 100 passed, 14 skipped (example manifests are not committed);pre-commit run --files: clean.At
c2f4fad36(#5703 atccd50dc04and main099832fa7merged, configs switched), on a Linux workstation with Python 3.13.14:gdp_pdf_agentandgdp_pdftests,test_session_contract_repo.py,tests/unit_tests/config,test_environment_validation.py,test_add_legacy_agent_environment_servers.py,test_harness_conformance_ci.py,test_raw_verify_typed_row.pyandtest_typed_agent_faults.py: 749 passed.gym env validateongdp_pdf.yamlwith its judge config, and onbenchmarks/gdp_pdf/config.yaml: valid.pre-commit run --files <changed files>: clean.At
a276b3afa(role-keyed rows; #5703 at79b7c92c1merged), on a Linux workstation with Python 3.13.14 and the example documents rendered:gdp_pdf_agentandgdp_pdftests,single_agent_turnandsingle_agent_turn_legacytests, andtests/unit_tests/server_runtime/test_agent_context.py: 508 passed, none skipped.test_row_shapenow checks thatsingle_agent_turnseeds the agent with the row's manifest.TestRepoDataMatchesSchemas: passed.pre-commit run --files <changed files>: clean.At
7667fe90a: #5703 at12eb72992merged (mainf636596db, documentation only); no conflicts.Rollout evidence
Real-model smoke at
9e0e04285. A locally served Qwen2.5-0.5B-Instruct handled policy and rubric judging for one synthetic page withinclude_images: false. The environment's/runseeded, activated and closed an agent session, then called/verify. The question asked for an ID that appeared only in the document. The policy answered 7314, the judge scored the criterion 1, and the row had reward 1.0 andmask_sample: false. A preliminary run with a 256-token judge budget produced a maskedjudge_failedrow. The successful run used 1,024 tokens. Image backoff and interrupted capture on this head were exercised by component tests.Scripted-model smoke (no real model) at
8de9ca46a2.gym env starton the shippedgdp_pdf.yaml(agent sessions throughsingle_agent_turn_legacy), with policy and judge served byopenai_modelin front of a local stub. The stub rejects every policy request for one row with a context-length error and answers the other; its judge passes every criterion. Thengym eval run --no-serveruns a fabricated two-page document as two rows.mask_samplefailure_kindfailure_reasonagent_adaptations.input_limit_rejectionsmask_failed_attempts: falsemask_failed_attempts: falseGDP.pdf terminal input limit: contextmask_failed_attempts: truemask_failed_attempts: truemodel_context_limitGDP.pdf terminal input limit: contexttrue, with the pre-fixapp.pyfilesdocument_deliveryin the row)Both runs were healthy, and no page images were left in the saved rows.
Scripted-model smoke (no real model). Real servers from
gym env start(openai_modelfor policy and judge, both pointed at a local stub), thengym eval run --no-serveon one row: a fabricated two-page document, one rubric criterion, andagent_context. The stub rejects every request whose page images are as large as the first one with a context-length error, as an endpoint rejects the same request each time, and answers smaller ones.openai_modelrelays the upstream 400 as a 500, so Simple Agent retries it twice before the agent sees it. The row ran through a scratch config that putssingle_agent_turn_legacyin front of the agent, and through the shippedlegacy_agentrelay.single_agent_turn_legacy)image_dpi120,input_limit_rejections1, inresponse.metadata.document_delivery/run(legacy_agent)image_dpi120,input_limit_rejections1, in the row'sdocument_deliveryThe rejected and the answered request each had the same SHA-256 on both paths. The reward of 1.0 is the stub judge's fixed score, not a result.
Real-model smoke (2026-11-09, at
c2f4fad36). On a Linux workstation: the committed example documents fetched and rendered withprepare.py'sfetch_example_media;gym env startwith the shippedgdp_pdf.yaml, hostednvidia/nemotron-3.5-super-vl-120b-a12b(throughvllm_model, thinking off) as both policy and rubric judge, and model-call capture on; thengym eval run --no-serveon the example rows at temperature 0. Each row ran twice: through the shipped config, an agent session (/v1/agent_sessionson the agent, 3 times), and through a run config that puts thelegacy_agentrelay back (the agent's/run, 3 times, no sessions)./run/run/ session9ef247ac55fe580d758bb8e1document_deliveryon/runandresponse.metadata.document_deliveryin the session./run, one judge call for758bb8e1failed and Gym's collection re-judged it automatically./runthe agent raised the typed model failure (main's fix(agents): keep the typed cause of a failed custom agent run #5740) and the collection stopped. In the session, the 422 stayed the classifiedmodel_request_error(it is not an input limit), andsingle_agent_turn's default outcome policy (400, 413 and 422 are verified) scored it 0. The table above leaves those rows out.Real-model smoke with role-keyed rows (2026-11-09, at
a276b3afa). The same setup and documents, now written as{"agent": {...}}, through the shipped config only (3 agent sessions).c2f4fad36session run9ef247ac55fe580d758bb8e1judge_failedand Gym's automatic re-judge kept waiting on the same limit; I stopped that pass. The policy side was complete: the request matched, the document went at 150 DPI, and the model answered.🤖 Generated with Claude Code