Queue for the production deploy slot
Ask for a held lease, read the back-off the plane names and retry until the slot is yours.
coordination.lease
Ask for a held lease, read the back-off the plane names and retry until the slot is yours.
coordination.leasePut 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.
Several agents want the production deploy slot and one holds it. Instead of polling in a tight loop, each waits as long as the plane says, and gives up if the waiters form a cycle.
requests, and a held resourceThe code reads the key from INTRAMEDIAL_KEY. Keep it in your shell or your secret store, never in a file you commit. Calls that need a signed-in person cannot use a key: the console makes them.
Ask for the resource while another agent holds it. The refusal names the holder and, in stampede.waitMs, how long to back off.
coordination.leasecoordination-lease
curl -sS -X POST https://api.intramedial.com/api/v1/acp/coordination/lease \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"resource": "lock:deploy/production",
"actorDid": "did:web:acme.example:agent:cost"
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/coordination/lease", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
resource: "lock:deploy/production",
actorDid: "did:web:acme.example:agent:cost",
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/coordination/lease",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"resource": "lock:deploy/production",
"actorDid": "did:web:acme.example:agent:cost",
},
timeout=30,
)
print(res.status_code, res.json())Loop on the lease call and sleep waitMs between tries. Stop on deadlock, which names waitingOn.
const API = "https://api.intramedial.com/api/v1/acp";
const headers = {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
};
const ask = { resource: "lock:deploy/production", actorDid: "did:web:acme.example:agent:cost" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
let lease = null;
for (let attempt = 0; attempt < 20 && !lease; attempt++) {
const res = await fetch(`${API}/coordination/lease`, { method: "POST", headers, body: JSON.stringify(ask) });
const body = await res.json();
if (body.ok) lease = body.lease;
else if (body.reason === "deadlock") throw new Error("wait cycle, waiting on " + body.waitingOn);
else await sleep(body.stampede?.waitMs ?? 1000); // the plane names the back-off
}
if (!lease) throw new Error("no slot yet");
console.log("holding", lease.id, "until", new Date(lease.expiresAtMs).toISOString());import os, time, requests
API = "https://api.intramedial.com/api/v1/acp"
headers = {"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]}
ask = {"resource": "lock:deploy/production", "actorDid": "did:web:acme.example:agent:cost"}
lease = None
for _ in range(20):
body = requests.post(f"{API}/coordination/lease", headers=headers, json=ask, timeout=30).json()
if body.get("ok"):
lease = body["lease"]
break
if body.get("reason") == "deadlock":
raise SystemExit(f"wait cycle, waiting on {body.get('waitingOn')}")
time.sleep(body.get("stampede", {}).get("waitMs", 1000) / 1000) # the plane names the back-off
if not lease:
raise SystemExit("no slot yet")
print("holding", lease["id"], "until", lease[])Let go of the slot as soon as the deploy ends, so the next agent in the queue does not wait for the lease to lapse on its own. Release takes the resource and the agent, and an optional leaseId.
curl -sS -X POST https://api.intramedial.com/api/v1/acp/coordination/release \
-H "Authorization: Bearer $INTRAMEDIAL_KEY" \
-H "Content-Type: application/json" \
-d '{
"resource": "lock:deploy/production",
"actorDid": "did:web:acme.example:agent:cost"
}'const res = await fetch("https://api.intramedial.com/api/v1/acp/coordination/release", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.INTRAMEDIAL_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
resource: "lock:deploy/production",
actorDid: "did:web:acme.example:agent:cost",
}),
});
console.log(res.status, await res.json());import os, requests
res = requests.post(
"https://api.intramedial.com/api/v1/acp/coordination/release",
headers={"Authorization": "Bearer " + os.environ["INTRAMEDIAL_KEY"]},
json={
"resource": "lock:deploy/production",
"actorDid": "did:web:acme.example:agent:cost",
},
timeout=30,
)
print(res.status_code, res.json())Copied from: /docs/coordination-lease
The ledger is append-only and sealed under Merkle roots. The time on an entry is Intramedial's own clock, and a signed bundle can be checked offline with the published key.
Take an exclusive lease on a resource with coordination.lease, see who holds it, and let it go when you are done.
coordination.leaseRun the six fixed Intralock scenarios, read the result of each one, and set a cadence so the drill repeats on its own.
drills.frtList the detectors, run lease-overlap, and read the conflicts it cites with their evidence, then read the cases it filed for review.
detection.runOne short email when we add recipes to the cookbook. No other mail, and you can unsubscribe from any message.
No key or account: Try it on the coordination.admit module page runs the real kernel in your browser. Use a workspace key for your own workspace.