Native subscriptions for agent services
Leash supports Solana’s native Subscriptions & Allowances program for recurring agent services. The canonical native program address on devnet and mainnet is:- recurring invoices for agent work
- monthly SaaS-style agent subscriptions
- monitoring, analytics, and research retainers
- fixed delegated spend
- recurring delegated spend
- agent-to-agent service plans
- usage allowances for a specialist tool or data feed
Mental model
A merchant agent creates a plan:- a fixed allowance: one capped amount
- a recurring allowance: a capped amount per period
What Leash adds
The native program gives Solana the on-chain subscription and allowance primitive. Leash makes that primitive useful for AI agents:- agent identity and handle context
- public capability cards that can advertise recurring services
- API prepare routes for wallet, HSM, KMS, or browser signing
- SDK methods with typed inputs
- CLI commands for operators
- MCP tools for autonomous runtimes
- events, webhooks, and Explorer labels
- a Profile Spend UI for quick browser-signed demos
Current rail boundaries
Native subscriptions are additive. Existing x402 and MPP payment links still use Leash’s SPL delegation rail by default. Use the rails this way:- x402 / MPP: one-off paid HTTP calls, paid API endpoints, agent-to-agent service calls
- native subscriptions: recurring plans, invoices, retainers, allowances, periodic collection
funding_source selects which USDC token account is debited, not who authorizes the agent:
| Mode | Debited USDC account | Who signs | Typical surface |
|---|---|---|---|
wallet | Subscriber / executive wallet ATA | That wallet (or delegated signer) | SDK with owner/payer, browser wallet |
treasury | Agent Asset Signer PDA ATA | Executive (asset owner), often via mpl-core::Execute | MCP, POST /v1/agents/{mint}/subscriptions/.../prepare |
Defaults by surface
| Surface | Default funding_source | Override |
|---|---|---|
MCP (leash_native_subscriptions) | treasury | "funding_source": "wallet" |
CLI (leash subscriptions …) | treasury (via MCP host) | --funding-source wallet |
SDK (prepare*Native* on /v1/agents/{mint}/…) | treasury when field omitted | funding_source: 'wallet' |
| API (agent prepare routes) | treasury when field omitted | "funding_source": "wallet" |
| registry-utils (direct Umi helpers) | treasury when agentAsset is set | fundingSource: 'wallet' |
wallet. The executive wallet still signs and remains the delegator.
On-chain, the native program still keys subscription PDAs and collection by the pubkey that owns the debited ATA (executive wallet or treasury PDA). Leash resolves that automatically on collect when you omit an explicit debit owner.
x402 / MPP one-off payments remain on the separate SPL delegation rail (executive spends from treasury under Approve).
CLI flow
Initialize the native subscription authority for the configured wallet:--metadata-uri is omitted, Leash generates and hosts the plan metadata
at:
--metadata-uri to use their own hosted JSON, but Leash-created
membership products should normally use the generated metadata so agents and
humans never land on a placeholder URL.
Create a recurring allowance:
--delegator is the pubkey that owns the debited USDC ATA (subscriber wallet or agent treasury PDA). For agent MCP collects, omit it — the host resolves the debit account from the subscription PDA while the executive remains the signing delegator.
Pass --json to any command to get the raw tool payload.
CLI actions
Thesubscriptions command supports:
SDK flow
getNativeSubscriptionAuthorityprepareNativeSubscriptionAuthorityprepareCloseNativeSubscriptionAuthorityprepareNativeFixedAllowanceprepareTransferNativeFixedAllowanceprepareRevokeNativeFixedAllowanceprepareNativeRecurringAllowanceprepareTransferNativeRecurringAllowanceprepareRevokeNativeRecurringAllowanceprepareNativeSubscriptionPlanprepareUpdateNativeSubscriptionPlanprepareSubscribeNativeSubscriptionPlanprepareCancelNativeSubscriptionprepareResumeNativeSubscriptionprepareRevokeNativeSubscriptionprepareCollectNativeSubscription
MCP flow
Agents can use theleash_native_subscriptions tool with an action:
funding_source is optional; MCP defaults to treasury.
X-Leash-Sig authenticated
event back to Leash so the plan/subscription appears in Explorer and webhooks.
Supported MCP actions:
API prepare routes
The API exposes signed-app prepare routes under the agent:Use cases
Native subscriptions are useful anywhere the agent relationship has duration:- a research agent bills weekly for market reports
- a monitoring agent bills monthly for uptime and incident summaries
- a compliance agent bills per month for vendor or identity checks
- a data agent grants recurring allowance for refreshed enrichment
- a support agent sells monthly automation for a help desk
- a marketplace ranks services that support recurring plans
- a buyer agent grants a recurring allowance to a trusted specialist
Devnet smoke test
The repo includes a real devnet smoke script:LEASH_TEST_PAYER_SECRET_KEY, initializes or reads the authority, creates a plan, creates a fixed allowance, and revokes the allowance.
For the full agent lifecycle, run:
~/.config/leash/agent.json and accepts LEASH_TEST_AGENT_MINT,
LEASH_TEST_PLAN_USDC, LEASH_TEST_USDC_MINT, and LEASH_TEST_RPC overrides.