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]>
labbench2_vlm_agent embeds a task's images and PDFs in run(). Under an agent session that never ran, so the model answered without the media. The agent now declares its agent_context: artifacts.media, the task's media directory (required), and values.tag. It resolves the directory under media_base_dir when the session is seeded, also when a checkpoint restore rebuilds the session, and embeds the media in responses() with the configured dpi and media_mode. A session whose row has no agent_context, or whose media directory is missing, is refused with a terminal 422. With strip_images_from_output on, the images are removed from the session's trajectory and observations and replaced by a multimodal_history_redacted gap. prepare_data.py writes agent_context into every row, and the committed example rows carry it. The legacy /run path is unchanged. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test e5dc10f |
Contributor
…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]>
…pisode, 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 media is now embedded in _create_session_episode, which also strips the images from the session's trajectory, so responses() stays Simple Agent's. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test be18505 |
…ssions Signed-off-by: yaoyu-33 <[email protected]>
…ent-context 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]>
…ty with /run - Make values.tag required in the agent context: it picks extracted text or page images for protocolqa2 under media_mode=text, so a row without it is refused at seed instead of reaching the model with another prompt. - Test that an agent session sends the model the same request as /run for the committed protocolqa2 and figqa2 rows, in text and image mode. - READMEs: point media_base_dir at the real directory the media paths are relative to when the media lives on other storage behind a symlink; a session refuses a media directory that resolves outside it. 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]>
…ent-context Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 4c102b1 |
Signed-off-by: yaoyu-33 <[email protected]>
…o yuya/labbench2-vlm-agent-context Signed-off-by: yaoyu-33 <[email protected]>
…ent-context Signed-off-by: yaoyu-33 <[email protected]>
The environment servers move from the legacy_agent relay to single_agent_turn_legacy, so each episode runs the agent in an agent session that embeds the media named by the row's agent_context. A row prepared before agent_context existed, such as the v0.0.1 validation JSONL, is refused at the seed with HTTP 422; prepare_data.py writes the key. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
Contributor
Author
|
/ok to test 7c0c152 |
AgentContext is held by the stored seed, which is compared on every retry; freeze it as AgentContextArtifact already is. A root the agent configured but that does not exist now says so, instead of reporting each artifact as missing. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
An episode can seed several agents, so a flat context cannot say which agent a key is for. A row's agent_context now maps each participant role to the AgentContext that role's session receives. single_agent_turn has one role, `agent`, and refuses any other role, including the unkeyed shape, with a 422 at the task input. The seed contract and parse_agent_context are unchanged, and the 64 KiB limit applies to each role's context. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
A row's agent_context now maps each participant role to its context, and single_agent_turn's one role is `agent`. prepare_data.py and the example rows wrap the media and tag under it, and the session test takes the seed context through SingleAgentTurnTaskInput as an episode does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: yaoyu-33 <[email protected]>
…ent-context Signed-off-by: yaoyu-33 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…o yuya/agent-context-sessions Signed-off-by: yaoyu-33 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent-context Signed-off-by: yaoyu-33 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
/ok to test 4cb76a6 |
…ssions Signed-off-by: yaoyu-33 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ent-context Signed-off-by: yaoyu-33 <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Author
|
/ok to test 5779520 |
This branch was previously 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.
Stacked on #5703; review the
labbench2_vlm_agentcommits (feat(labbench2_vlm_agent): embed the task's media in agent sessions,refactor(labbench2_vlm_agent): embed session media in the session's episode, not responses()fix(labbench2_vlm_agent): require the task's tag and pin session parity with /runfeat(labbench2_vlm): run the shipped configs in agent sessionsandfeat(labbench2_vlm): write agent_context keyed by the agent role). The other commits are #5703's and merges.What and why
labbench2_vlm_agentembeds each task's images and PDFs inrun(), fromverifier_metadata.media_dir. It inherits Simple Agent's agent sessions, but an agent session never reachesrun(), so undersingle_agent_turnthe model was asked about images it never saw.With the agent-context contract from #5703:
Context. The agent declares
agent_context_model:media, the task's media directory (a required artifact), andtag(required: without it aprotocolqa2row would go to the model as images in text mode).prepare_data.pywritesagent_context = {"agent": {"values": {"tag": ...}, "artifacts": {"media": {"path": <media_dir>}}}}into every 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 media directory undermedia_base_dir. That also covers a checkpoint restore, which rebuilds sessions through the same method. A row withoutagent_contextorvalues.tag, or a missing media directory, is refused with a terminal 422, so a session never runs without its images.media_base_dirmust be the real directory: a media root that is a symlink to other storage resolves outside it and is refused (the READMEs give an example).Activation.
_create_session_episode, the Simple Agent hook from feat(agents): deliver per-task agent context to agent sessions #5703, embeds the media with the configureddpiandmedia_mode(text only forprotocolqa2tags, as before) through the sameembed_media_into_rowthatrun()uses. The agent does not overrideresponses(), so environment validation still inferscustom-gym-verifier, the profile the benchmark manifest declares. Overridingresponses()in the first version failedtest_infers_representative_builtin_agent_profiles[labbench2_vlm_agent-custom-gym-verifier].Observations. With
strip_images_from_outputon, the session's trajectory, and so its observations andng_trajectory, lose the base64 images and gain amultimodal_history_redactedgap. Model-call capture still keeps the original request, as on/run.Shipped configs.
resources_servers/labbench2_vlm/configs/labbench2_vlm.yamlandbenchmarks/labbench2_vlm/config.yamlnow putsingle_agent_turn_legacyin front of the agent instead of thelegacy_agentrelay, so their episodes run in agent sessions. A row prepared beforeagent_contextexisted, including the v0.0.1 validation JSONL behindgitlab_identifier, is refused at the seed with 422;prepare_data.py, which these rows need anyway for their media, writes the key. The README says so.The legacy
/runpath is unchanged.#5703 now keys a row's
agent_contextby participant role, soprepare_data.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 media delivery existed, is closed in favor of this PR.
No public issue: this is the media-delivery migration of one agent onto the contract in #5703.
Validation
Primary venv with the worktree on the path, Python 3.13,
pymupdfadded from a scratch directory:responses_api_agents/labbench2_vlm_agent/testsandresources_servers/labbench2_vlm/tests: 46 passed. New session tests check that:input_imageblock before the question;multimodal_history_redactedgap;agent_context, or with a missing media directory, is refused with 422 before any model call.app.pyin place of this one, the three new session tests fail.pre-commit run --files <changed files>: passed.At
4c102b133(#5703's updated branch and main379ae226dmerged, after a review round):labbench2_vlm_agent+labbench2_vlmtests: 50 passed;test_session_contract_repo.py+test_global_config.py: 233 passed;pre-commit run --files: clean. A new test checks that/runand a session send byte-identical model requests for the committed rows,protocolqa2in text and image mode andfigqa2-imgin text mode, so CI now covers the parity the smoke below showed; forcing image mode in the session, or defaulting the tag, makes it fail.At
7c0c1528b(#5703 atccd50dc04and main099832fa7merged, configs switched), on a Linux workstation with Python 3.13.14:labbench2_vlm_agentandlabbench2_vlmtests,test_session_contract_repo.py,tests/unit_tests/config,test_environment_validation.py,test_add_legacy_agent_environment_servers.py,test_harness_conformance_ci.pyand bothtest_agent_context.py: 654 passed.gym env validateonlabbench2_vlm.yamlwith its judge config, and onbenchmarks/labbench2_vlm/config.yaml: valid.pre-commit run --files <changed files>: clean.At
4cb76a685(role-keyed rows; #5703 at79b7c92c1merged), on a Linux workstation with Python 3.13.14:labbench2_vlm_agentandlabbench2_vlmtests,single_agent_turnandsingle_agent_turn_legacytests, andtests/unit_tests/server_runtime/test_agent_context.py: 378 passed. The session-parity test now takes the seed context from the committed rows throughSingleAgentTurnTaskInput, as an episode does.TestRepoDataMatchesSchemas: passed.pre-commit run --files <changed files>: clean.At
577952026: #5703 at12eb72992merged (mainf636596db, documentation only); no conflicts.Left: files under the media directory are read by
embed_media_into_row, shared with/run, without a per-file check that they stay under it; the directory is operator-configured, so this is not reachable from a row.Rollout evidence
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 two committed example rows: onefigqa2-img(a PNG) and oneprotocolqa2(a PDF rendered to page images). The same rows ran twice: through a scratch copy of the config that putssingle_agent_turn_legacyin front of the agent, and through the shippedlegacy_agentrelay.single_agent_turn_legacy)/run(legacy_agent)For each task, the policy request had the same SHA-256 on both paths, images included, and so did each judge request. The reward of 1.0 is the stub judge's fixed
[[A=B]], not a score.Real-model smoke (2026-11-09, at
7c0c1528b). On a Linux workstation:gym env startwith the shippedlabbench2_vlm.yaml, hostednvidia/nemotron-3.5-super-vl-120b-a12b(throughvllm_model, thinking off) as both policy and judge, and model-call capture on; thengym eval run --no-serveon the committed example rows at temperature 0. Each row ran twice: through the shipped config, an agent session (/v1/agent_sessionson the agent, 4 times), and through a run config that puts thelegacy_agentrelay back (the agent's/run, 4 times, no sessions)./run/run/ session/runand 0.0 in the session./runthe agent answered 500 and the collection stopped. In the session, Simple Agent returned the classifiedmodel_request_error(422), andsingle_agent_turn's default outcome policy (400, 413 and 422 are verified) scored it 0. The tables above leave that row out.Real-model smoke with role-keyed rows (2026-11-09, at
4cb76a685). The same setup and rows, now written as{"agent": {...}}, through the shipped config only (4 agent sessions, no failed or masked rows, no images in saved rows).7c0c1528bsession runOne row in the unkeyed shape ran through the same config as a check: the Environment Server refused it with 422 at
task.task_input.agent_contextbefore seeding the agent, no model call was made, and the failures file carries the message naming theagentrole.🤖 Generated with Claude Code