Use a delegate when
- A team already has an active subscription.
- The agent should not hold the owner’s USDC or subscription key.
- You want a cap on how many rounds the agent can request.
- You want to cut the agent off with one transaction.
On-chain account
add_delegate instruction and removes it with remove_delegate, which closes the account. There is no pause instruction. add_delegate requires an active subscription, a delegate key different from the owner, max_data_requests greater than 0, and a free slot under the subscription’s max_delegates (100 on the Basic plan). The web app’s Access page (https://app.molpha.io/console/access) builds both instructions for a connected owner wallet.
Flow
- The owner opens or extends a subscription.
- The owner calls
add_delegatewith the agent’s public key andmax_data_requests. - The agent authenticates on
POST /v1/round/executein one of two ways:- RequestAuth:
consumerAuthorityis the agent’s key,subscriptionOwneris the owner, and the agent signsauthSigwith a freshauthTimestamp(unix seconds) for every request. - A sign-in session: the agent requests a sign-in challenge with
addressset to its key andownerset to the owner, signs it, exchanges it atPOST /v1/session, and sends the bearer token instead of RequestAuth.
- RequestAuth:
- The gateway reads the subscription and the
Delegateaccount from chain, stamps the round and returns the signed attestation. - The round counts against the subscription’s
max_roundsand the delegate’smax_data_requestsfor the current term (see Terms and quota).
sourceId is the hash of the canonical source only. Owner and delegate requests for the same source share it, and their requests in the same 100 ms tick share one round, each spending its own quota unit. The consumer key is part of the gateway’s replay identity, not of the source.
Controls
A delegate signed in with a session can read its own usage and cap at
GET /v1/session.
Next steps
Subscriptions
Open the plan that backs the delegate.
x402 pay-per-request
Pay-per-request path when there is no subscription.