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

# Run lifecycle

> Submit once, wait for a final status, then read the result or failure details.

The API calls each run an `execution`. A run normally moves through:

```text theme={null}
accepted → queued → running → completed
```

It can also end as `failed`, `cancelled`, or `expired`. The response includes
links for status, events, and the receipt.

## Statuses

| Status                  | Meaning                                                     |
| ----------------------- | ----------------------------------------------------------- |
| `accepted`              | Millwork accepted the request.                              |
| `queued`                | Work is waiting to run.                                     |
| `running` or `progress` | Work is in progress.                                        |
| `completed`             | Work finished successfully. A live result may be available. |
| `failed`                | Work stopped with an error.                                 |
| `cancelled`             | A user or system cancelled the work.                        |
| `expired`               | The run passed its allowed time.                            |

`completed`, `failed`, `cancelled`, and `expired` are final statuses.

## Submit once

Use a new `Idempotency-Key` for new work. If the network fails during
submission, retry with the same key and identical body. Millwork returns the
original operation instead of creating another run.

## Wait for a final status

Poll `links.status` until the run ends. Do not submit a new run because the
first one is still queued or running.

## Read the result or failure details

* After `completed`, request the result and receipt.
* After `failed`, read status, events, and the receipt.
* After `cancelled` or `expired`, read status and the receipt.
* Echo never creates a model result.

For a complete command sequence, use [Run a model](/get-started/builder).
