> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.api.odyssey.ml/llms.txt
> Use this file to discover all available pages before exploring further.

# Action controls

> Send held movement inputs and relative camera motion during O3 Streaming or in a Simulation script.

Use action controls to actuate an active Odyssey-3 stream while continuing to receive video.
Use prompt interactions to change the scene or describe a world event.
Both fit into the same stream lifecycle.

## Send a complete input snapshot

Each call replaces the held keys and mouse buttons from the previous call.
An empty snapshot releases held inputs.
Mouse deltas apply once; they remain relative rather than becoming held movement.

```python Python theme={null}
# After connect() and start_stream() complete:
sequence = await client.send_action_controls({"keys": ["w", "d"]})

# On the next input update, keep W held and turn the camera.
await client.send_action_controls({"keys": ["w"], "mouse_dx": 12.0})

# On key release or loss of focus:
await client.send_action_controls({})
```

```typescript JavaScript theme={null}
// After connect() and startStream() complete:
const sequence = client.sendActionControls({keys: ['w', 'd']});

// On the next input update, keep W held and turn the camera.
client.sendActionControls({keys: ['w'], mouse_dx: 12});

// On key release or loss of focus:
client.sendActionControls({});
```

The examples show successive input events; give the model time to generate frames between them.
Sending press and release together can make the held interval too brief to affect generated video.

| Field | Values | Behavior |
| - | - | - |
| `keys` | `w`, `a`, `s`, `d`, `e`, `f`, `lalt`, `lctrl`, `lshift`, `rctrl`, `space`, `tab`, `i`, `j`, `k`, `l` | Complete set of held keys; duplicates are rejected |
| `buttons` | `mouse_left`, `mouse_middle`, `mouse_right` | Complete set of held mouse buttons |
| `mouse_dx`, `mouse_dy` | Finite numbers, clamped to −50 through 50 | Relative horizontal and vertical camera movement |
| `look_key_level` | Integer 0 through 3 | Display metadata |
| `semantic_map` | Versioned complete control map | Optional scenario-specific meanings |

I/J/K/L and `look_key_level` are display metadata.
Convert your application's look input into `mouse_dx` and `mouse_dy` to send camera movement to the model.
Actions depend on the scene and subject; these controls do not promise a deterministic game-engine response.

For a custom semantic map, use `version_id: "action_controls_semantic_map/1"`, a nonblank `mapping_id`, and exactly these seven `bindings`: `shift`, `e`, `f`, `mouse_left`, `mouse_right`, `space`, and `c`.
Each binding is a trimmed, single-line phrase of up to 96 characters; `shift` is a single impulse verb, such as `jump`.
An optional `active_subject` identifies the subject.
Use the exported `ActionControls` and `ActionControlsSemanticMap` types to construct these snapshots.

## React to incoming video

For an interactive controller, keep the latest frame, choose the next input from that observation, then send a snapshot.
Python exposes decoded RGB arrays through `on_video_frame`.
In a browser, draw the video into a canvas from `requestVideoFrameCallback` to inspect incoming pixels.
Run expensive vision or policy work outside the video callback, and discard stale observations rather than building an unbounded frame queue.

A keyboard application can instead maintain a set of pressed keys, send that set on each key change, and send `{}` when the window loses focus.
Prompt updates can run alongside this input loop through the existing `interact()` method.
Await the prompt acknowledgement before issuing another prompt update.

## Know what was observed

The returned integer is a locally sent sequence number, not a server or model acknowledgement.
Incoming video can include buffered frames or repeats while generation is busy.
A frame callback therefore does not itself acknowledge a new model generation or a consumed input.
For an audit, retrieve the stream's recording and read its events file as newline-delimited JSON.
`action_controls_consumed` entries identify the model-consumed intervals, effective held state, input transitions, and source sequence watermarks.
`prompt_applied` entries with `phase: "model_bound"` identify prompts bound to generation.

`end_stream()` / `endStream()` sends a neutral snapshot before ending when you have used controls.
Disconnect attempts the same release while the channel is open and then closes the connection.
A broken transport cannot guarantee delivery of that final snapshot; ending the stream or connection also ends its control state.

## Script the same controls in Simulation

Place controls in their own timestamped entries.
Use a separate entry for a prompt change, even when it is near a controls update.
Simulation accepts the movement keys above except the display-only I/J/K/L keys, and also accepts `c` where the assigned profile maps it.
Omit `look_key_level` in Simulation scripts.
Keep Simulation mouse deltas within −50 through 50; values outside those bounds are rejected at admission.

```json theme={null}
[
  {"timestamp_ms": 0, "start": {"prompt": "A sunlit forest path with a small red ball."}},
  {"timestamp_ms": 1000, "action_controls": {"keys": ["w", "d"]}},
  {"timestamp_ms": 2500, "interact": {"prompt": "The red ball rolls forward along the forest path."}},
  {"timestamp_ms": 2600, "action_controls": {"keys": ["w"], "mouse_dx": 12}},
  {"timestamp_ms": 4000, "action_controls": {"keys": [], "buttons": []}},
  {"timestamp_ms": 6000, "end": {}}
]
```

Poll the job until it reaches a terminal status, then download the raw video and events from the completed job.
Treat generated duration, wall-clock processing time, account usage, and delivered resolution as separate measurements.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.