Skip to content

hylo.codeagents.scene_episode

Package: hylo-code-agents · Core contracts

scene_episode

Running one recorded episode of a scene (fixed-format or free) and writing what it produced.

env = FrameRecorder(registry.build("envs", {...}), "front")
result = run_recorded_episode(env, agent, task, out_dir / "solve", seed=0, video=out_dir / "front.mp4")

run_recorded_episode runs the kernel's EpisodeRunner with a trace store, writes the turns of a code agent to turns.jsonl, summarises the outcome (status, steps, turns, usage, model and wall time) and, with video, encodes the recorded camera frames as an MP4. It closes the agent and the environment.

VIDEO_MAX_BYTES module-attribute

VIDEO_MAX_BYTES = 3000000

FrameRecorder

FrameRecorder(env: Any, camera: str = 'front')

An Environment wrapper that keeps one camera's frames (reset and every step); everything else passes.

spec

spec() -> Any

reset

reset(task: TaskInstance) -> Any

step

step(action: Any) -> Any

close

close() -> None

write_mp4

write_mp4(frames: Sequence[ndarray], path: str | Path, fps: float = 20.0, max_bytes: int = VIDEO_MAX_BYTES) -> dict[str, Any]

H.264 MP4 of RGB frames (imageio-ffmpeg); re-encoded at lower quality / frame rate until <= max_bytes.

run_recorded_episode

run_recorded_episode(env: FrameRecorder, agent: Any, task: TaskSpec, out: Path, *, seed: int = 0, video: Path | None = None) -> dict[str, Any]

Run one episode of agent on env (traced under out/trace, code turns in out/turns.jsonl) and return the outcome: status, success, steps, reason, turns, errors, usage, wall_s, model_s, trace, episode_id, and the video record when asked. Closes the agent and the environment.