Repository navigation
Open
Description
Problem
Gym's ATIF exporters keep text only. A transcript that contains an image part cannot be exported:
transcript_to_atif()(nemo_gym/trajectory/atif_export.py) raisesAtifExportError: ... only text content parts are supportedfor aninput_imagepart in a message or a tool output. The Harbor Environment Server uses it to write/logs/agent/trajectory.jsonfor the verifier, and masks the turn asharbor:trajectory_export_failedinstead of grading it.export_rollouts_to_atif()builds ATIF rollout artifacts fromng_trajectory. It also accepts only text parts, and it rejects a user turn after agent output (later system or user turns are not supported). One such rollout fails the run's ATIF export.
Images are becoming a normal part of agent transcripts:
- feat: binary sandbox files and shared media helpers #4917 / feat(opencode): attach prompt images in agent sessions #4922 pass prompt images to harnesses.
- feat: images in tool replies, a lent-sandbox helper and OpenCode session limits for multi-harness training #5719 lets a Resources Server tool return
tool_output_images;simple_agentshows them to the model as a user message after the turn's tool outputs. - Codex returns images inside tool outputs (
view_image).
Reproduction
from nemo_gym.trajectory.atif_export import transcript_to_atif
transcript_to_atif(
[{"role": "user", "content": "Describe the image after rotating it."}],
[
{"type": "function_call", "call_id": "c1", "name": "rotate", "arguments": "{}", "id": "fc1", "status": "completed"},
{"type": "function_call_output", "call_id": "c1", "output": "{\"ok\":true}"},
{"type": "message", "role": "user", "content": [
{"type": "input_image", "image_url": "data:image/png;base64,iVBORw0KGgo=", "detail": "auto"}]},
{"type": "message", "role": "assistant", "id": "m1", "status": "completed",
"content": [{"type": "output_text", "text": "A cat.", "annotations": []}]},
],
session_id="s", agent_name="a", agent_version="0",
)
# AtifExportError: transcript[2].content[0]: only text content parts are supportedWithout the image message the same transcript exports.
Proposal
ATIF v1.7 already represents images: a content part {"type": "image", "source": {"media_type": ..., "path": ...}}, which Gym models as AtifContentPart / AtifImageSource in nemo_gym/trajectory/atif_v1_7.py.
- Decode each
input_imagedata URI (MediaFile.from_data_uri, feat: binary sandbox files and shared media helpers #4917) and write it next to the trajectory file under a content-named path, such asimages/<sha256>.<ext>. Emit an ATIF image part that points to it. - Map a user turn after agent output that carries only images (the
simple_agenttool-image message) to an observation of the preceding step, as_attach_user_observationalready does for text. - Keep refusing what ATIF cannot represent, such as remote image URLs and file IDs, so a converter gap is never graded.
- For the Harbor Environment Server, upload the image files to
/logs/agent/besidetrajectory.json, so a verifier that reads the transcript can open them.
Acceptance
- The reproduction exports, with the image file written and referenced by path.
- A Harbor turn whose transcript holds a tool image is graded, not masked.
- ATIF rollout artifacts export
simple_agentrollouts with tool images. - Text-only transcripts export byte-for-byte as before.
Related: #5719, #5868 (harness guide "Support images" section).
🤖 Generated with Claude Code
Activity
[-]ATIF export drops support for image content parts; transcripts with images are masked or fail export[/-][+]feat(trajectory): export image content parts to ATIF instead of failing the export[/+]