lease_acquire
Acquire an exclusive, TTL-based lease on a resource to avoid split-brain. Only one agent holds the lease at a time; leases expire automatically.
Instructions
Try to acquire an exclusive, TTL-based lease on a named resource.
Use this to prevent split-brain when multiple agents could simultaneously work on the same resource. Only one holder can hold the lease at a time.
If the current holder crashes, the lease expires automatically after ttl_seconds and another agent can acquire it.
Returns acquired=True on success with the expiry timestamp. Returns acquired=False with the current holder's ID on failure.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| holder_id | Yes | ||
| resource_id | Yes | ||
| ttl_seconds | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| holder | No | ||
| reason | No | ||
| acquired | Yes | ||
| expires_at | No | ||
| resource_id | Yes |