Intramedial is in restricted beta. At sign up or sign in, you have to provide the beta tester password you received or request one at preview@intramedial.com. Thank you.
Loading…
coordination.leaseModule 02
Plane module
Resource leases and queues
Hold a resource for one agent at a time, with a lease that lapses on its own and a queue for the agents that have to wait.
coordination.lease grants one agent an exclusive lease on a resource. A second agent that asks is refused with the holder's name and told how long to back off. Every resource has its own lease authority, so a lease cannot be granted twice, and a lease that is never released expires.
Agents act when the plane says yes, and the record says why.
Put admission in front of your MCP servers, repositories, SaaS tools and cloud accounts. Every agent gets a lease or a reason – and you keep the lever to stop any of them.
The REST route and the lease authority take resource and actorDid only. The MCP schema accepts ttlMs, but it is dropped before the lease is made, so every lease runs 30,000 ms. Release early or acquire again to extend.
Record
The record
What gets recorded
resource
What to lease, as the resource name admission uses.
actorDid
The agent asking. An authenticated agent can only name itself.
On refusal: lease_held, or deadlock when the request would close a wait cycle.
holder
On refusal: the DID that holds the resource now.
stampede
On lease_held: admitted, the waiters let through, and waitMs, how long to back off.
waitingOn
On deadlock: the resource the holder is itself waiting on.
leaseId
For release: the lease to release. A stale id is refused.
Mechanism
Step by step
How it works
Ask for the resource
Post resource and actorDid. An authenticated agent can only ask as itself. The request goes to the lease authority for that one resource.
A lease or a refusal
A free resource returns { ok: true, lease }. A held one returns lease_held with the holder and a back-off. A request that would close a wait cycle returns deadlock.
Release, or let it lapse
release frees the lease and adds 0.5 to the holder's trust score. A lease left to expire is taken back by an alarm and costs 5 points.
Waiters back off
A refusal carries stampede.waitMs, which grows with the number of waiters. GET /api/v1/acp/coordination/wait returns the queue.
Press Run (or ⌘/Ctrl + Enter) to decide the request on the left.
It runs in this browser: the plane’s own kernel, with no key, no account and no network call. Change an agent, a lease or a rule on the left and run it again to see the verdict move.
Code
Live example
A real request
A request in the shape the API accepts, and an example response in the shape the module returns.
Two release agents ask for lock:deploy/production. One gets the lease, and the other is told who holds it and when to retry.
A holder that crashed
An agent takes a lease and dies. The lease lapses, the alarm takes it back and the next agent in line can ask again.
Breaking a deadlock
Agent A holds one resource and waits for B's, while B waits for A's. The second request is refused as deadlock with waitingOn named.
Backing off a thundering herd
Fifty agents want the same file. Each refusal returns a waitMs that grows with the queue, so retries spread out instead of hammering.
When to use something else
Deciding whether an agent may act. A lease says who holds a resource, and coordination.admit says whether the action is allowed.
Telling peers you are working. Use civics.presence to report status and civics.claims to state what you intend.
Taking turns across hours. A lease lapses in seconds, so use negotiate.propose for longer agreements.
Evidence
Guarantees
What it does, and what it does not
A module is a strong claim about a narrow thing. Rely on it for exactly what it is.
It does
Each resource has one lease authority, so two agents cannot hold the same resource at once.
A lease that is never released expires and is taken back, whether or not the holder ever returns.
A refusal names the holder, so the cause of a wait is visible.
A wait that would close a cycle is refused as deadlock instead of queueing forever.
It does not
That the work was done. A released lease says the holder let go, nothing about the outcome.
That the lease length is yours to choose. Every lease runs the default, whatever ttlMs a caller sends.
That a lease holds across a partition. If the authority cannot be reached the request fails, and the lease is not granted.
Details
Build notes
Before you build
Reads can share
The resource's semantics class decides what conflicts. Two reads of a resource that is safe to read concurrently do not exclude each other, and a write or delete excludes everything.
Trust moves with leases
A release raises the holder's trust score by 0.5 and an expiry without a release lowers it by 5. Those two signals are the ones the lease authority emits.
A ledger entry
A grant writes a coordination.lease event to the ledger. The write is best effort, so a ledger outage does not stop the lease.
Limits and metering
The default lease runs 30,000 ms. The route does not read ttlMs.
The stampede back-off is the smaller of 800 ms and 25 ms doubled for each waiter, and at most 8 waiters are admitted.
release takes resource and actorDid, plus an optional leaseId. The MCP schema has no leaseId.
Lease calls are not metered. Only coordination/admit counts as a coordinated action.
Access
API & MCP
REST and MCP
Authenticate with a workspace API key as a Bearer token. The base URL is https://api.intramedial.com.
REST endpoints
POST/api/v1/acp/coordination/leaseAsk for an exclusive lease on a resource.
POST/api/v1/acp/coordination/releaseRelease a lease the caller holds.
GET/api/v1/acp/coordination/waitRead the queue of waiting agents and deadlock pairs.
MCP actions
MCPcoordination.lease.acquireAsk for a lease as an MCP action.
MCPcoordination.lease.releaseRelease a lease as an MCP action.
MCPcoordination.waitRead the wait queue as an MCP action.