# Give important applications priority

Give higher-priority applications precedence when requests are waiting for capacity. Rank
your applications once, and the most important keep getting through longest when you're busy.

## Before you begin

You need at least two applications, one per workload: for example a coding agent and a
nightly batch job. The priority list appears once you have two.

## 1. Give each workload its own application

In [Applications](/applications), choose **Add application**, name it for the workload, and
choose **Create key**. Use that key only for that workload. A new application starts at the
bottom of the list.

## 2. Set the order

In [Applications](/applications), under **Application priority**, drag
the most important application to the top. Or open an application's menu and choose **Move
up** or **Move down**. With a keyboard, focus a row's handle, press Space, move it with the
arrow keys, and press Space again.

From the terminal, list your keys with their ids and weights, then set a weight. A higher
weight ranks higher. Keep weights from 100, where a new application starts, to 1000, as the
list does. Below 100, that application is turned away sooner when you're busy:

```bash
saylek settings account keys list
saylek settings account keys reweight KEY_ID --weight 800
```

**You know it worked when** the list shows your applications in the order you set.

## What the order does

Give higher-priority applications precedence when requests are waiting for capacity. That is
what the order sets. When you're busy, lower-ranked applications are turned away first and
higher-ranked ones keep getting through longest. It applies only to your account's own
requests. For example, with **Coding agents** above **Nightly QA**, a waiting coding-agent
request goes ahead of a waiting QA request. A request waits for a machine up to 180 seconds when it streams and up to 60 seconds
when it does not, or less if your application gives it less time.

It does not:
- stop a request that is already running;
- reserve capacity, or make a request faster;
- rank your requests against anyone else's.

It is also not the rule that lets a machine's owner go first on their own machine, which
[Make more of one GPU](/docs/make-more-of-one-gpu) explains.

## If something goes wrong

| What you see | What to do |
|---|---|
| No **Application priority** list | You have one application. Add a second |
| `reweight` refuses the weight | Use a whole number up to 1000 |
| A lower-ranked application is refused (HTTP 429) while you're busy | If the error's details name `consumer`, that is the order working. Move it up, or spread its requests out. `key_deprioritized` means its weight is below 100: set it to 100 or more |
| A request ends with an error that names `wait_elapsed` | No machine was free in time. Retry later, or add a machine |
| Important requests still wait | Priority orders your waiting requests; it adds no capacity. Add a machine, as [Add machines and GPUs](/docs/add-machines) describes |

## Reference

- [Connect your app](/docs/connect-your-app): keys and client setup.
- [Set up Saylek for a team](/docs/set-up-for-a-team): who sets priority when several people share machines.
- [CLI reference](/docs/cli-reference): every command.
