Parent sets a hard budget on a child API key. The child spends only what is allowed — and only where you say. Revoke anytime. Unused funds return to the parent.
Delegation
A parent agent opens a capped budget on a child API key. The child can spend — only within the budget, allow list, and task prefix the parent set.
Holds the balance. Opens the delegation. Can revoke anytime.
Spends against the remaining budget. Never touches the parent wallet directly.
The child never sees the parent balance. Only the remaining allowance travels with the delegation id.
Spend path
The child calls pay like any other agent. The only difference is the delegation id that rides with the request.
The child API key authenticates the call. It never holds the parent balance.
Tells the ledger which capped envelope to debit. Missing or revoked id fails the pay.
Each successful spend reduces the remaining allowance. At zero the status becomes depleted.
Parent can cap any single debit so a runaway loop cannot empty the whole envelope at once.
Constraints
Budget is only the start. A delegation can name
allow_to so the child may pay only those repos,
a task_prefix so every task string must match,
and max_per_spend so no single debit can empty the envelope.
TTL closes what the parent forgets.
A pay that breaks any rule is rejected. The remaining allowance does not move. Only a matching call drains it.
States
Child can spend. Remaining budget is live on every pay.
remaining_usd reached zero. No further debits accepted.
Parent closed it. Whatever was left returns to the parent wallet.
TTL finished. Cron closes the envelope and refunds the rest.
Control
The parent keeps the kill switch. The ledger keeps the same gates that protect every other pay.
POST /api/delegate/revoke closes the envelope immediately.
Any remaining_usd is credited back to the parent repo.
The child key stays valid for other work — only this delegation dies.
When expires_at passes, cron marks the delegation expired
and refunds the leftover balance. Nothing stays locked in the system account.
Wallet lock, velocity windows, daily cap, and the parent’s policy
(allow_to, max_amount, task rules) all still apply.
A locked parent cannot open a new delegation; a locked or over-limit path
rejects the child’s spend cleanly.
Depleted is not the same as revoked. Depleted means the budget is gone. Revoked means the parent took the rest back. Both stop further spends.
Request
The child agent does not use a special endpoint. It calls the same pay path with its own key and the delegation id.
POST /api/pay Authorization: Bearer CHILD_API_KEY X-Delegate-Id: dg_… { "to_repo": "vendor/tool", "amount": 0.05, "task": "scout-1" }
If the id is missing, revoked, expired, or over budget, the pay fails. The parent balance is never exposed to the child key.
API
Open the envelope. List what is live. Revoke when the child is done — or let TTL finish the job.
Parent sets budget, child key, optional allow_to, task_prefix, max_per_spend, and TTL.
Lists delegations for the bound agent — remaining, status, expiry, and rails.
Closes the id immediately. Leftover remaining_usd returns to the parent repo.
Delegation
Open a budget on a child key. Revoke when the job is done — the rest comes home.
Open AgentPayNow
Bind a repo. Send a POST. Agents settle — humans stay out of the way.
Join AgentPay│