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

> ## Agent Instructions
> Treat the Dreamscale CLI and Python SDK as the supported public integration surfaces.
> Prefer `dreamscale run <robot>` for supported robots and `dreamscale.connect(model)` with `predict` or `next_action` in Python.
> Do not infer or recommend internal control-plane APIs.

# Custom robots

> Run a model on a robot that isn't listed: fine-tune a base on your robot's demos, then drive the robot from Python.

Any robot can run a Dreamscale model from Python. Your code reads the cameras
and joints and commands the robot; the model runs in the cloud. On an
[SO-101](https://docs.dreamscalelabs.com/robots/so101.md), [bimanual YAM](https://docs.dreamscalelabs.com/robots/yam.md), [Franka](https://docs.dreamscalelabs.com/robots/franka.md)
or [OpenARM](https://docs.dreamscalelabs.com/robots/openarm.md), the CLI needs no code.

"Robot" is a loose word here. Models fine-tuned on Dreamscale have cleared
cardboard with [a 1,930 kg excavator](https://www.dreamscalelabs.com/blog/excavate/)
and driven [a Tesla around a cone course](https://drivingbench.com/). If it has
cameras and takes commands, it counts.

## What you need

* Python 3.11 or newer, in a project (`uv init` makes one).
* A Dreamscale account. Sign in once with `uv run dreamscale login`, or set
  `DREAMSCALE_API_KEY` to a key from
  [Settings → API keys](https://app.dreamscalelabs.com/dashboard/settings#api-keys).
* Demos recorded on your robot as a LeRobot dataset (v2.x or v3.0): its cameras,
  `observation.state` and `action`.

## 1. Install the SDK

```bash theme={null}
uv add dreamscale
```

`uv run python -c "import dreamscale; print(dreamscale.__version__)"` prints
`0.1.0a391` or newer.

## 2. Fine-tune a model on your robot

A shared model runs one robot type. For yours, fine-tune a base on your demos
and deploy the result:

```bash theme={null}
dreamscale datasets upload ./my-robot
dreamscale train --dataset my-robot --base pi0.5
dreamscale train deploy tr_...
```

Your dataset defines the robot: its cameras, and what its state and action
hold. [Models](https://docs.dreamscalelabs.com/models.md) lists the bases and [Training](https://docs.dreamscalelabs.com/training.md) has the
walkthrough. Already have a fine-tuned checkpoint? See
[Deployments](https://docs.dreamscalelabs.com/deployments.md).

## 3. Drive your robot

> [!WARNING]
>
> The robot will move. Enforce joint, speed and workspace limits locally, and
> keep a physical e-stop within reach. Cloud inference does not replace your
> robot's safety controller.

Call `next_action` once per control tick:

```python theme={null}
import dreamscale

policy = dreamscale.connect("your-org/my-robot")

def read_observation():
    # Your robot's code: read the frames and state.
    top, left_wrist = ..., ...  # H×W×3 uint8 RGB frames
    left_joints, left_gripper = ..., ...  # in your dataset's units
    return dreamscale.robot.observation(
        cameras={"base": top, "left_wrist": left_wrist},
        state=[*left_joints, left_gripper],
    )

def send_to_robot(action):
    # Your robot's code: apply the action, in your dataset's order and units.
    ...

while True:
    send_to_robot(policy.next_action(read_observation(), instruction="pick up the red block"))
```

The deployment's dashboard page shows its camera keys and this loop filled in.
Pass a new instruction to switch tasks. No robot yet?
[Simulations](https://docs.dreamscalelabs.com/simulations.md#from-python) has a snippet that runs as it is.

## What the SDK handles

The SDK checks each observation and names any wrong field. It prepares images,
picks the fastest network path, and blends chunks so motion stays smooth. If the
connection drops, it reconnects and holds the robot still; if no server answers
within 5 minutes, `next_action()` raises `reconnect_failed`. After a minute idle, it
frees the server until the next call. Sessions close when your program
exits, or with `policy.close()`. In async code, use `await dreamscale.aconnect(...)`.
`predict()` does none of this: it returns one action chunk for
[your own executor](https://docs.dreamscalelabs.com/reference/sdk.md#running-chunks-on-your-own-clock).

Universal Robots and xArm 7 arms also have experimental CLI runners: see
[`dreamscale run`](https://docs.dreamscalelabs.com/reference/cli#dreamscale-run).


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