# leases

Leases across a fleet, such as build server slots or claims approved once, which end by themselves when their holder dies.

| | |
|---|---|
| Kind | Plugin |
| Roles | None (a service the node runs) |
| Status | beta |
| Ships with Fleetlayer | Yes |
| Licence | Apache-2.0 |
| Maintainer | Fleetlayer |
| Source | https://github.com/fleetlayer/fleetlayer/tree/main/plugins/leases |
| Install | In every Fleetlayer release |
| Command | `fleetlayer-leases` |
| Platforms | Linux, macOS |
| Works with | Fleetlayer 0.3.14 and later |
| Plugin protocol | version 1 |
| Grants | `fleet.query`, `access.check`, `event.publish`, `message.send`, `reading.publish` |

## What it does

Agents on every machine take a slot before a heavy build and wait their turn, so a shared build server never runs
more than it can take. Claims the person approves once (a mail filter while an agent watches CI) start and end
with events that the owning service acts on. Every lease ends at its TTL or when its session, node or process goes
away, and the plugin reports leases that ran into their TTL and queues that are stuck.

## Setup

It comes with Fleetlayer, so there's nothing else to install. To start from:

```yaml
plugins:
  - name: leases
    command: fleetlayer-leases
    grants: [fleet.query, access.check, event.publish, message.send, reading.publish]
    # kinds go in ~/.config/fleetlayer/leases.yaml
tools:
  - name: leases
    command: fleetlayer-leases
    args: [serve, --caller, "{caller}"]
    allow: ["*"]
    check_calls: true
    call_targets: { acquire: ["/kind"] }
```

## What it can read and do

Agents reach the authority only through the tool its node shares, as the caller the control plane recorded, so every call is checked by the access policy and audited. Only a lease's own node may release it. Approvals are requests in the plugin's own name, decided by the access policy. Keeps its state in one directory and reads only its settings file; it's as trusted as its node's Unix user.

More: https://fleetlayer.ai/docs/plugins/leases.md.
