POST /v1/get_action, not chat completions. An episode is a loop:
- Send one frame per camera, the task, and the state fields the selected model requires.
- Check the returned action space and execute its rows at
dtseconds per row, capturing frames as you go. - Send those frames and the latest state with the same
session_idand task. - Call
POST /v1/end_sessionwhen done.
next_frames_per_camera, oldest first.
An idle session expires after 60 seconds. 410 session_expired means start a new episode with one frame per camera.
Example
This example uses MolmoAct2’s YAM end-effector contract. Replace the camera, state and execution functions with your drivers. The example only reads files; it moves nothing.episode.py
Retrying an observation
Choose asession_id before the first call. Send a unique observation_id and the next
expected_step (starting at zero) with each observation. Send only one call at a time.
If an answer is lost, retry the identical body under the same id. A replay does not run or bill another chunk.
While it runs, 409 observation_in_progress carries Retry-After: wait, then retry the same id and body.
observation_lost means that id will never run again: do not execute a missing chunk, and send the next observation under a new id.
observation_outcome_unknown, from a legacy gateway, means retry only that id. Never send a new observation until its outcome is known.
Idempotency-Key can replace observation_id; if both are sent they must match.
The example stops on errors rather than retrying. See Errors for retry advice.