Skip to main content
Robots use POST /v1/get_action, not chat completions. An episode is a loop:
  1. Send one frame per camera, the task, and the state fields the selected model requires.
  2. Check the returned action space and execute its rows at dt seconds per row, capturing frames as you go.
  3. Send those frames and the latest state with the same session_id and task.
  4. Call POST /v1/end_session when done.
After the first call, send as many frames per camera as the last answer’s 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 a session_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.