spend-ledger
Spend ledger with reservations: one budget for a tree of agents — A budget shared by a task tree, in integer minor units. reserve() atomically holds an amount if the remaining budget covers it (expired holds are freed automatically); commit() records what was actually spent, up to the hold; release() frees a hold. These are real reservations, not a snapshot: two workers cannot both reserve the last dollar. It records spending; it does not move money.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"op": "<op>",
"ledger": "<ledger>"
},
"name": "spend-ledger"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| op | Yes | ||
| ledger | Yes | Ledger name, e.g. task:research-42. | |
| currency | No | open: currency or token code, e.g. USD or USDC. | |
| tenantId | No | Required for API-key callers (namespaced as key:<tenantId>; keep it unguessable). Ignored when a wallet paid: the payer address is the tenant. | |
| requestId | No | Caller-chosen id for this mutation. A retry with the same id and same input returns the stored response (24 h) instead of applying twice; the same id with different input is rejected. Send one on every mutation you may retry: without it a retry is applied again (fleet-memory record appends a duplicate; a repeated spend-ledger commit or release answers NO_HOLD because the first call already took effect). | |
| ttlSeconds | No | reserve: hold lifetime; default 600. | |
| amountMinor | No | reserve: amount to hold. commit: amount actually spent (at most the hold). | |
| budgetMinor | No | open: total budget in minor units. | |
| reservationId | No |