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

# Policy

> Download a policy fine-tuned in the dashboard by its Training ID, and read what it was trained on.

A policy fine-tuned in the [dashboard](https://app.zeroruntime.ai) downloads by
its Training ID. `Policy.fetch()` returns a local folder that LeRobot's
`from_pretrained` loads.

```python theme={null}
from zeroruntime.teleops import Policy
from lerobot.policies.smolvla.modeling_smolvla import SmolVLAPolicy

# token: ZERORUNTIME_AUTH_TOKEN
p = Policy.fetch("123e4567-e89b-42d3-a456-426614174000")
policy = SmolVLAPolicy.from_pretrained(p.path)
```

Added in `zeroruntime-teleops` 0.1.2. For the whole flow from recording to a
running arm, see [Train a policy](https://docs.zeroruntime.ai/robotics/guides/train-a-policy.md).

## Policy.fetch()

```python theme={null}
Policy.fetch(training_job_id, token=None, *, cache=None, timeout=30.0, progress=print)
```

**training\_job\_id** `str` *required*

The **Training ID** from the dashboard's Training page. The run must be
**Completed**.

**token** `str`

Your auth token. Defaults to `ZERORUNTIME_AUTH_TOKEN`. It must come from the
project that ran the training.

**cache** `str | PathLike`

Where to keep downloaded policies. Defaults to `ZERORUNTIME_CACHE`, then
`~/.cache/zeroruntime`.

**timeout** `float` (default: 30.0)

Seconds to wait on each request.

**progress** `callable` (default: print)

Called with one line per file as it downloads.

Returns a `Policy`. Raises [`PolicyError`](#policyerror) if it can't.

## Caching

The checkpoint is saved under `<cache>/policies/<training id>/final/`. A second
fetch of the same id reads the cache and makes no request, so a robot that has
its weights runs offline.

A download that fails part way leaves nothing behind under the real file
names, so the next fetch starts clean.

## Fields

**path** `Path`

The checkpoint folder. Pass it to `from_pretrained`.

**id** `str`

The Training ID.

**type** `str | None`

The policy the run trained, as the API names it (the job's `policyId`).

**task** `str | None`

The task text the recording's episodes were labelled with. If they used
more than one, the most common one.

**fps** `float | None`

The dataset's frame rate. Run the policy at this rate.

**joints** `list | None`

The joint names, in the order the policy expects them.

**cameras** `list | None`

The dataset's cameras.

**rename\_map** `dict`

How the dataset's camera keys map to the policy's camera inputs, as set at
training time. Empty if there was none.

**job** `dict`

The full training job, as the API returned it.

## PolicyError

Every failure is a `PolicyError` with a message that says what went wrong.
It subclasses [`RoomError`](https://docs.zeroruntime.ai/robotics/api-reference/python/errors), so one
`except RoomError` still catches every API failure.

| Message | Cause |
| - | - |
| `not a training job id` | The id isn't a Training ID. |
| `no token to fetch policy` | No `token=` and `ZERORUNTIME_AUTH_TOKEN` unset. |
| `policy <id> is not ready: …` | The run is still going. |
| `policy <id> failed: …` | The run failed. The reason follows. |
| `the token was rejected` (4001) | The token is from another project than the training run, or has expired. |
| `has no config.json … likely a LoRA adapter` | The run left an adapter that LeRobot can't load directly. |

```python theme={null}
from zeroruntime.teleops import Policy, PolicyError

try:
    p = Policy.fetch(training_id)
except PolicyError as e:
    raise SystemExit(str(e))
```

## Related

> [card] [Train a policy](https://docs.zeroruntime.ai/robotics/guides/train-a-policy.md)
>
> Record, convert and fine-tune in the dashboard, then run it.

> [card] [Errors](https://docs.zeroruntime.ai/robotics/api-reference/python/errors.md)
>
> Every exception the SDK raises.


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