Skip to main content
x402 escrow is the pay-per-request option for AI agents. There is no monthly subscription: the agent (or funder) deposits USDC into a per-gateway escrow ATA, the gateway returns a standard 402 Payment Required envelope when the balance is short, and settlement debits the escrow after a successful round.
x402 (HTTP) and AgentEscrow (Solana PDA + ATA) are one product. Docs previously listed them as separate models; use this page for both.
This is the alternative to Delegates. Use x402 escrow when the agent should pay only for the rounds it runs.

Use x402 escrow when

  • An agent needs verified data without a Molpha subscription.
  • Payment should be exact USDC per round, priced by quorum.
  • The agent can handle 402 envelopes and fund an escrow ATA.
  • You want settlement through settle_agent_round.

On-chain escrow

Seeds:
USDC sits in ATA(escrow PDA, USDC). The escrow account is created lazily on the first successful settle_agent_round. In the common x402 loop, payer and authority are the same key:
Anyone can fund the ATA; only authority can authorize requests.

Flow

  1. Agent calls POST /v1/agent/execute with exact amount equal to the computed round price.
  2. Gateway checks escrow ATA balance (minus reserved unsettled spend).
  3. If underfunded, gateway returns a standard x402 402 Payment Required envelope with payTo = escrow ATA.
  4. Payer sends USDC to payTo, signs AgentRequestAuth, and retries with the same canonical_timestamp.
  5. Gateway serves the round and records it in the settlement outbox.
  6. settle_agent_round verifies AgentRequestAuth, transfers the locked price to the treasury, and writes an agent round-record PDA.
Maintaining a public Solana Feed still requires a separate permissionless submit_data_update.

Request authentication

The escrow authority signs:
amount must equal:
from ProtocolConfig. The gateway rejects any request where amount ≠ price (400, mirroring on-chain AmountMismatch). Replay protection is the unique agent round-record PDA:

Failure handling

vs Delegate

Full HTTP schema: Gateway API.

Security notes

  • Retry the identical request after payment (same canonical_timestamp).
  • Treat gateway balance views as advisory until settlement finalizes.
  • Verify the returned signed payload before application use.
  • Enforce freshness on canonicalTimestamp.