Agent fleets and leases
When several agents take work from the same backlog, each one needs to know what the others have picked up. In Kanso that is a lease. An agent claims a ticket, holds it while it works, and lets it go when it is done. People see the lease on the card, and they can call their own agent off at any time.
The loop every agent runs
Call claim_next_issue with the queue's JQL and an ORDER BY. The default order is
newest first. Kanso claims one free ticket that you are allowed to edit. If there is
none, the answer is claimed: false, which is a normal result, and three counts say why.
examined: 0 with notPermitted: 0 means there is no free matching work.
notPermitted above 0 means there is free work you may not edit. contended above 0
means other agents were faster, so call again.
Call renew_lease at least every third of the TTL. For the default 900-second lease,
that is every 5 minutes. A renew only ever extends a lease you hold. It never takes back
a lease you lost.
Call release_issue so the next agent can take the ticket.
Pass an idempotencyKey to claim_next_issue. If the call is retried, for example after a
network error, it returns the same lease instead of claiming a second ticket. To claim one
specific ticket, use claim_issue. Claiming a ticket you already hold renews it.
What a claim returns
{
"claimed": true, "examined": 1, "contended": 0,
"issue": { "key": "PAY-1", "summary": "Checkout times out on 3-D Secure",
"status": "To Do", "statusCategory": "todo",
"lease": { "holder": "sam", "credential": "kat_1",
"expiresAt": "2026-10-22T19:42:13.849348Z" } },
"lease": { "holder": "sam", "heldByCaller": true, "callerMayRelease": true,
"acquiredAt": "2026-10-22T19:27:13.849348Z",
"expiresAt": "2026-10-22T19:42:13.849348Z" }
}
The holder is the credential, not the account
A lease is held by the credential that claimed it: a token, a signed-in session, or an app. It is not held by the account. Two tokens of one person exclude each other exactly as two people's tokens do:
issue_leased: held unexpired by another credential of your own account (kat_1) — wait until
2026-10-22T19:42:13.849348Z, or release it from a browser session of the account
That has two consequences for running a fleet:
- Give each agent its own token. A pool of agents that shares one token is a single holder, so the lease cannot keep them apart.
- One of your own tokens cannot release another's lease. It is refused with
lease_not_holder. Only the holder, the account's browser session, or a space admin can end it.
Calling an agent off
A lease can end without the agent's help, in two ways:
| Who | How | Recorded as |
|---|---|---|
| The person who owns the agent's token | From a signed-in browser session of the same account | recalled |
| Anyone who administers the space | From their own session | forced, attributed to them |
Neither one changes the ticket itself, so an agent waiting with await_issue is not woken
by it. The agent finds out at its next renew_lease:
lease_not_found: no unexpired lease — yours ended (expired, released, recalled or forced);
re-read the issue before claiming it again
The right response is to stop, re-read the ticket with get_issue, and claim it again only
if it is still the agent's to do. A system that must hear about it within a second can
subscribe a webhook to issue.lease_released. See
Webhooks and apps.
Advisory or enforced
By default a lease is advisory. It stops other agents from claiming the ticket, but it does not stop anyone from writing to it.
A site admin can make leases enforced, under Settings → AI access or with
KANSO_AGENT_LEASES=enforced. Then an agent cannot edit, transition or delete a ticket that
another credential holds:
policy_lease_enforced — /policy/leases: enforced — override (Settings → AI access);
/holder: sam; /holderCredential: kat_2
People are never blocked by a lease. A person can always edit a ticket an agent holds, and enforcement applies only to agents and apps.
What people see
- On the ticket: while someone holds the lease, the header shows a chip such as Being worked on by Sam · token "runner-2" · until 14:30.
- In search: every ticket summary carries the lease, and JQL can find leased work:
project = PAY AND leasedBy IS NOT EMPTY
- In the lease itself:
get_leasereturns the holder, the credential that holds it ({id, kind, name}), the TTL, when it was acquired and when it expires.
Limits worth knowing
- A lease TTL runs from 60 to 14,400 seconds, and the default is 900.
claim_next_issuelooks at 1 to 50 candidates per call (maxCandidates).- Each credential can make up to 120 tool calls a minute. Above that, the answer is
429with aRetry-After. - If an agent signs in with a username and password instead of a token, every new sign-in is a new credential, and the leases it took before refuse its renewals. Use a token.