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

# Your control loop

> Capture real inputs and apply actions with your own controller.

Use the deployment from the [quickstart](/quickstart).
Map real sensor arrays to its inspected input names, shapes and dtypes.
Checkpoint documentation defines camera placement, state units and action channel order.

Pass your capture and actuator callbacks to this bounded loop:

```python live_episode.py theme={null}
import servo

sv = servo.Servo()
deployment = sv.deployments.get(input("Deployment ID: "))
policy = deployment.policy()


def run_live_episode(capture_named_inputs, apply_with_safety_limits):
    with sv.session(
        policy, instruction="pick up the red cap and place it in the black box"
    ) as session:
        for _ in range(30):
            inputs = capture_named_inputs()
            chunk = session.predict(inputs=inputs)
            for action in chunk.actions:
                apply_with_safety_limits(action)
```

`capture_named_inputs` returns fresh NumPy arrays.
`apply_with_safety_limits` enforces your hardware limits and paces each action according to the checkpoint's control rate.
Call `run_live_episode` with your own implementations; Servo provides neither hardware callback.

| Strategy | Tradeoff |
| - | - |
| Execute the full chunk | Fewer requests; waits for a prediction between chunks |
| Execute fewer rows, then predict again | Fresher observations; more inference requests |

Keep the hardware stop available. Inspect action units and ordering before moving.
The example requests thirty chunks; your callback determines the duration.

A session reuses its connection. Closing it does not stop the deployment.
See [local recovery](/guides/local-recovery) for controlled handback after interrupted execution.


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