Mandate · Guide
Hand off to outside agents
Use this when your agent needs an agent run by another company to act for it: an airline's booking agent holding a seat, or a hotel's agent placing a deposit. The outside agent gets its own narrower grant, bound to its key, and the person or company that granted yours says yes first.
The receiver can be an agent registered in another Provenance account, or any agent that holds a P-256 key. A registered agent shows the grantor its registry name and operator. An agent named only by its key shows the name and origin it declared, marked unverified.
Before you begin: the receiver gives you its public key (generateHolderKey in @provenanceauth/rails/mandates makes one). Every grant handed outside the account is bound to that key, so a copied token is useless to anyone else (your account can lift that for one registered agent, step 7). See bind a grant to its holder.
1. Ask with receiver
Call POST / with receiver and the receiver's holder_key. The call answers 202 with an external_handoff, and no grant exists yet:
export GRANT_ID=$(curl -s $PROVENANCE_API/v1/mandate/grants \
-H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" \
-H "Content-Type: application/json" \
-d '{ "device_id": "dev_00000000000000000000000000000001", "purpose": "Book Maya'"'"'s Lisbon trip", "constraints": { "max_amount": 1200, "budget_amount": 2400, "budget_window": "month", "expires_at": "2027-12-31T23:59:59Z" } }' | jq -r .id)
curl -s $PROVENANCE_API/v1/mandate/grants/$GRANT_ID/delegate \
-H "Authorization: Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" \
-H "Content-Type: application/json" \
-d '{ "agent_session_id": "sess_valet_flights_1", "purpose": "Hold seat 14C on TP1351", "constraints": { "max_amount": 600, "budget_amount": 600 }, "receiver": { "kind": "key", "name": "SkyDesk Seats", "origin": "https://seats.skydesk.example" }, "holder_key": { "kty": "EC", "crv": "P-256", "x": "NeVHu4qeD40iEEgSDcTm26Y0xApkjq41T6BuENVl0js", "y": "qS59-GAPcl0bJ-yYFvPJA3omsU9DJFedMw4rou5cXo8" } }'
const asked = await provenance.mandate.grants.handOff(grantId, {
agentSessionId: "sess_valet_flights_1",
purpose: "Hold seat 14C on TP1351",
constraints: { maxAmount: 600, budgetAmount: 600 },
receiver: { kind: "key", name: "SkyDesk Seats", origin: "https://seats.skydesk.example" },
holderKey: receiverPublicJwk,
});
// asked.object === "external_handoff", asked.status === "pending"
For an agent registered in another account, send { "kind": "provenance_agent", "agent_id": "agt_…" }. An agent registered in your own account isn't an outside agent: delegate to it with agent_id.
The child is checked as any delegation is before anyone is asked: it can only narrow its parent. An outside agent can't hand its grant on, so leave out max_depth.
2. The grantor answers
The approval goes to whoever granted the grant at the top of the chain:
| The top grant | Who answers |
|---|---|
| Granted by a person with their passkey | That person, with the same passkey, through their approval channels |
| Granted by the account (an account key, no passkey) | The account's people, as an over-limit approval is |
The approval shows the receiver, the task, the limits, the expiry, that the receiver can't hand it on, and whether stores may check it offline with what that costs. approval_id is the approval; the account reads the hand-off at status_url (GET /).
3. Send the same call with handoff_id
After the yes, send the same body again with handoff_id. It answers 201 with the bound grant and its token, which you pass to the receiver:
const result = await provenance.mandate.grants.handOff(grantId, { ...params, handoffId: asked.id });
if (result.object === "grant") sendToReceiver(result.mandateToken);
| Answer | Means |
|---|---|
202 | Still waiting for the grantor |
201 | The grant, bound to the receiver's key (holder_, cnf.), with external naming the hand-off |
403 external_ | The grantor said no, or didn't answer before the approval expired |
409 external_ | This hand-off already minted its grant |
400 on handoff_ | The body isn't what the grantor was asked about |
The grant can't be handed on (max_depth is its own depth). Revoking anything above it stops it, and the receiver sees that at GET /. A registered receiver that its maker suspends stops too.
4. Choose offline checks
offline_checks says whether stores may check the grant offline:
| Value | What the token says | What it costs |
|---|---|---|
refused | status_ | Every verifier checks the grant's status online before it accepts it. Every purchase counts against the budget, and a revoke stops it at once |
allowed | Nothing extra | Stores may check it with the JWKS alone. Purchases at those stores aren't counted against the budget, and they learn of a revoke only when they check online |
Left out, a hand-off allows offline checks only when the child's budget (its own, or the tightest above it) is at or under the account's external_online_above. That is 0 by default, so every hand-off defaults to online checks.
The offline verifiers answer status_check_required for a grant that says status_check: "online" and was checked offline:
import { verifyMandate } from "@provenanceauth/rails/mandates";
const r = await verifyMandate(mandateToken, { jwks, holder, online: true, apiBase: "https://api.provenanceauth.com" });
In Python, pass online=True to verify_mandate. In Go, read the status with FetchMandateStatus and pass it to VerifyMandateOnline.
5. Turn hand-offs off
An admin key sets the account's settings with PUT /:
external:ask(the default) asks the grantor first;refuserefuses every hand-off outside the account with403 external_delegation_refused, and nobody is asked.external_online_above: the budget at or under which a hand-off that doesn't say allows offline checks.
6. Skip the ask for agents you trust
A trusted agent gets its hand-offs without the ask. There are two lists:
- Your company's, in Settings › Agent teams or with POST
/(an admin key). It covers hand-offs under grants your account issued.v1/ mandate/ trusted_ agents - A person's own, in their home under Security › Trusted agents. It covers hand-offs under grants that person signed with their passkey.
An entry names the agent one of two ways:
receiver.kind | Also send |
|---|---|
provenance_ | agent_, an agent registered in another account |
key | name, origin and holder_, the agent's P-256 public key |
Set max_amount or budget_amount to cap what skips. A hand-off over a cap, or without that limit at all, still asks the grantor.
await provenance.mandate.grants.addTrustedAgent({
receiver: { kind: "key", name: "SkyDesk Seats", origin: "https://seats.skydesk.example", holderKey: skydesk.publicJwk },
maxAmount: 600,
});
A hand-off to a trusted agent answers 201 on the first call. The grant is still bound to the agent's key and checked like any other. The hand-off has approval_id: null and names the entry in trusted_agent_id, and the ledger row says so.
7. Choose holder binding per agent
By default your own agents get bearer grants and outside agents get grants bound to their key. Change either for one agent with PUT / (an admin key), or in Settings › Agent teams:
required: every grant to this agent of yours, on grant or delegate, must carryholder_key.not_required: a hand-off to this outside registered agent may leaveholder_keyout, so its grant is a bearer grant.
Deleting the setting puts the agent back on the default. An agent named only by its key is always bound, because the key is how it's named.
For the receiving account
When the receiver is an agent registered in your account, your account gets a record of each grant handed to it. Subscribe a webhook endpoint to mandate.incoming_grant.received and mandate.incoming_grant.revoked, and read the records with GET /:
const { data } = await provenance.mandate.grants.listIncomingGrants({ agentId });
// data[0].grantId, .chain, .purpose, .constraints, .holderJkt, .offlineChecks, .status
| Event | Sent when |
|---|---|
mandate. | A grant is minted for your agent; it names the incoming grant, the grant and its purpose |
mandate. | A revoke reaches the grant: its own, or one above it, named in stopped_ |
A record holds what the grant's token already carries: the grant and chain ids, the purpose, the limits, the holder key and whether offline checks are allowed. The grant itself stays with the account that handed it, so GET / answers 404 for you. An agent named only by its key gets no record; it checks GET /.
Availability: every plan that has grants. A hand-off counts against the grant allowance when its grant is minted, and the ask is billed as the approval it is. Revocation, status checks and offline verification are free. A receiver is named by a P-256 key, and an outside agent can't hand its grant on.
Errors you might see
| Code | What to do |
|---|---|
external_ | The account's external setting is refuse. Delegate inside the account, or set it to ask. |
external_ | The grantor said no or didn't answer in time. Ask again without handoff_ if they should see it again. |
external_ | The hand-off already minted its grant. Use that grant, or start a new hand-off. |
parameter_ (holder_) | Send the receiver's P-256 public key: every grant handed outside the account is bound to it, and your account may require it for one of its own agents. |
parameter_ (handoff_) | Send the same body the grantor was asked about, with the same holder_ and offline_. |
delegation_ | Narrow the child: a hand-off can't allow more than the grant it comes from. |
See also
- A2A delegation v1: the grant over A2A
- Agent tools: the grant over MCP, in a request's
_metaundercom.provenanceauth/grant - Bind a grant to its holder
- Check an agent's grant
- Delegate to sub-agents