Skip to content

How to Provision Privy Agent Wallets for USDC (2026)

Step-by-step: create Privy TEE agent wallets, attach USDC spend policies, fund on Base, and pay APIs with createX402Client or the Agent CLI.

Table of Contents

AI agents that spend USDC still fail the same ops review: where does the private key live, who can revoke spend, and what stops a runaway loop from draining the treasury?

The named object is Privy agent wallets: server-provisioned wallets whose keys are reconstituted only inside Trusted Execution Environments (TEEs), controlled by authorization keys or scoped signers, and constrained by Privy's policy engine before any signature leaves the enclave. That stack is not Coinbase AgentKit paying a third-party x402 API, not Coinbase for Agents MCP/CLI identity, not Circle agent wallets, and not Alchemy x402 gateway auth for RPC credits.

📌
Stablecoin Insider's framing: use this guide when the job is provisioning policy-bound USDC wallets for agents (server create + policies + x402/MPP clients or Agent CLI). Use How to Pay for an x402 API with Coinbase AgentKit when the agent is only a payment client. Use How to Create a Circle Agent Wallet when the custody product is Circle's agent wallet surface.

Facts below come from Privy's agent wallets overview, agentic wallets recipe, create a policy, x402 integration, and Agent CLI docs as of September 27, 2026. Commands and policy shapes are copied from those pages. No invented fee schedules, undocumented chains, or unofficial facilitator URLs.

Key Takeaways

  • Provision agent-owned wallets with an authorization-key owner plus policy_ids at create time.
  • Keys stay in TEEs; agents never receive the raw private key or app secret.
  • Allowlist Base USDC (0x8335…2913) and recipients; x402 needs eth_signTypedData_v4 rules.
  • Pay APIs with createX402Client + wrapFetchWithPayment and a maxValue cap in USDC units.
  • For shell agents, use @privy-io/agent-wallet-cli (login, fund, rpc); sessions last up to 30 days.
⚠️
Named downside: eth_sendTransaction policies do not cover x402 authorizations. x402 payments are EIP-712 typed data. Without eth_signTypedData_v4 recipient rules, an agent can still sign payments your transfer allowlist never intended.

Who this is for

Use this path if you run agent workflows that must hold and spend USDC under human-defined guardrails, you can create Privy authorization keys and policies from a backend, and you want TEE key custody instead of stuffing hot keys into agent memory.

Skip it if you are accepting machine payments into Stripe (see How to Accept Stripe MPP Payments in USDC), paying arbitrary x402 merchants with AgentKit (see How to Pay for an x402 API with Coinbase AgentKit), standing up Coinbase's agent MCP/CLI surface (see How to Use Coinbase for Agents with MCP and CLI), selling MCP tools (see How to Charge for MCP Tools with Cloudflare Agents x402), or paying Alchemy itself for RPC (see How to Authenticate Alchemy APIs with x402 USDC). For funding patterns, see How to Fund an AI Agent Wallet with USDC. For Circle's agent wallet product, see How to Create a Circle Agent Wallet for USDC.

What Privy agent wallets mean

Privy documents two authorization models. Agent-owned wallets are provisioned and controlled by your service via authorization keys; the agent can transact without a user session. Delegated signing lets an agent act on a user's existing wallet with a scoped authorization key the user can revoke. This guide focuses on the agent-owned, developer-controlled path from Privy's agentic wallets recipe.

Private keys are not exposed in prompts or agent memory. Sensitive material is reconstituted inside hardware-isolated TEEs. Before a signature is produced, the enclave evaluates wallet policies (token and chain restrictions, transfer caps, recipient and contract allowlists). That is the control plane operators should treat as mandatory, not optional.

For payments, Privy supports both x402 and MPP (Machine Payments Protocol). Node clients use createX402Client from @privy-io/node; React uses useX402Fetch. Both can set per-request maxValue caps so a single 402 cannot clear the wallet.

Prerequisites

  • A Privy app with Wallet API access and TEE execution enabled for server-side wallets and policies.
  • Node.js 18+ with @privy-io/node (and @x402/fetch if you will wrap fetch for x402).
  • An authorization key (or key quorum) created in the Privy Dashboard; store the private material in your secrets manager, not in agent prompts.
  • USDC on Base for spend tests: contract 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913 (6 decimals).
  • Optional for shell agents: npm install -g @privy-io/agent-wallet-cli and access to agents.privy.io.

Step 1: Create authorization keys

Follow Privy's agentic wallets recipe: create authorization keys in the Dashboard and store the corresponding private keys in a secrets manager. Your backend signs Privy API requests with those keys on behalf of agents. For higher assurance, register keys in a key quorum so policy updates and exports need multi-party approval.

Stablecoin Insider's take: treat the authorization key like a production KMS credential. Rotate it on a schedule, never paste it into chat logs, and keep root users out of the agent hot path. Privy documents that root users bypass the policy engine; agents should always be non-root principals with explicit ALLOW rules.

Step 2: Define a USDC spend policy

Create a policy before the wallet so every agent in the fleet inherits the same guardrails. Privy's create-policy examples allowlist a contract address on eth_sendTransaction. For Base USDC transfers, start with an allowlist on the USDC contract:

const policy = await privy.policies().create({
  name: 'Allow Base USDC transfers',
  version: '1.0',
  chain_type: 'ethereum',
  owner_id: 'YOUR_KEY_QUORUM_OR_OWNER_ID',
  rules: [{
    name: 'Allowlist USDC on Base',
    method: 'eth_sendTransaction',
    action: 'ALLOW',
    conditions: [{
      field_source: 'ethereum_transaction',
      field: 'to',
      operator: 'eq',
      value: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'
    }]
  }]
});

Save the returned policy.id. Add recipient allowlists and value caps for production. For x402, add separate eth_signTypedData_v4 rules that screen the EIP-712 to field (and optionally pin chainId 8453 plus the USDC verifyingContract). Privy's sanctions-screening recipe shows DENY/ALLOW pairs bound to the TransferWithAuthorization schema so a client-side schema change fails closed.

Step 3: Create the agent wallet with policy_ids

Create a wallet owned by your authorization key, with the policy attached at creation. Privy's recipe requires:

  • Set owner_id (or owner) to the authorization key / key quorum that your backend controls.
  • Set policy_ids to a singleton array containing the policy id from Step 2 (one policy per wallet today).
  • Reuse the same policy id across a fleet so every agent wallet is subject to identical controls.
const {id, address} = await privy.wallets().create({
  chain_type: 'ethereum',
  owner_id: 'YOUR_AUTHORIZATION_KEY_QUORUM_ID',
  policy_ids: [policy.id],
});
console.log(id, address);

You can also create wallets with Privy's wallet create API via REST. Persist id and address in your agent registry; you will pass walletId into x402 clients and CLI flows.

Step 4: Fund the wallet with USDC on Base

Facilitators pay gas for x402 settlement, so agents typically need USDC, not ETH, on the payment chain. Fund the agent address on Base with USDC (mainnet contract above; use Circle's faucet for Base Sepolia tests). For the Agent CLI path, humans fund via the sandbox:

npm install -g @privy-io/agent-wallet-cli
privy-agent-wallets login
privy-agent-wallets fund
privy-agent-wallets list-wallets

Login prints a verification URL and short code. A human approves once in the browser at agents.privy.io. Sessions last up to 30 days with automatic token rotation; privy-agent-wallets logout ends early. The CLI never exposes the wallet private key to the agent process; it exchanges OAuth tokens for ephemeral signing keys per request.

For deeper funding ops patterns (treasury sweeps, top-up alerts), see How to Fund an AI Agent Wallet with USDC.

Step 5: Pay APIs with createX402Client

Install the Node packages and wrap fetch so HTTP 402 challenges settle automatically from the agent wallet:

npm install @privy-io/node @x402/fetch

import {PrivyClient} from '@privy-io/node';
import {createX402Client} from '@privy-io/node/x402';
import {wrapFetchWithPayment} from '@x402/fetch';

const privy = new PrivyClient({appId, appSecret});
const wallet = await privy.wallets().get({walletId: 'your-wallet-id'});
const x402client = createX402Client(privy, {
  walletId: wallet.id,
  address: wallet.address,
});
const fetchWithPayment = wrapFetchWithPayment(fetch, x402client);
const response = await fetchWithPayment('https://api.example.com/premium');
const data = await response.json();

Add a hard ceiling. USDC has 6 decimals, so maxValue: BigInt(1_000_000) caps a single payment at 1 USDC in React's wrapFetchWithPayment options (and equivalent client-side caps for Node). If you use Privy gas sponsorship on the wallet, pass signatureOptions: { type: 'erc1271' } into createX402Client as Privy documents.

Facilitators verify and settle; Privy's x402 page lists options including Coinbase, Pay AI, and Corbits. Picking verify/settle infrastructure for your own resource server is a different job: see How to Choose an x402 Facilitator for USDC and How to Enable Circle x402 Facilitator for USDC.

Step 6: Optional Agent CLI RPC for shell agents

Coding agents that already run shell commands can sign without a custom SDK integration. After login, send RPC bodies as JSON:

privy-agent-wallets rpc --json '{"method": "eth_sendTransaction", "params": {"to": "0xRecipient", "value": "0.01"}}'
echo '{"method": "personal_sign", "params": {"message": "hello"}}' | privy-agent-wallets rpc

Supported Ethereum methods include eth_sendTransaction, eth_signTypedData_v4 (required for x402 authorizations), personal_sign, and ERC-4337 eth_signUserOperation. Solana methods cover sign, sign-and-send, and signMessage. Point agents at https://agents.privy.io/skill.md so they discover the flow from a skill file.

Operator pitfalls

  • Relying only on eth_sendTransaction allowlists while agents pay via x402 typed data.
  • Using a root Privy user for the agent path (policies are bypassed).
  • Sharing one wallet across agents with different trust levels.
  • Omitting maxValue on wrapFetchWithPayment / createX402Client so a single 402 can drain the balance.
  • Funding the wrong chain or wrong USDC contract (always verify Base vs Sepolia and the 0x8335…2913 mainnet address).
  • Leaving Agent CLI sessions alive after an incident; revoke at agents.privy.io/manage and rotate authorization keys.
SurfaceWhat it doesStablecoin angle
Privy agent wallet + policiesTEE custody + enclave-enforced spend rulesHold and constrain USDC
createX402Client / useX402FetchAuto-settle HTTP 402 from the walletPay APIs in USDC
Agent CLI (@privy-io/agent-wallet-cli)Login, fund, rpc for shell agentsSame wallets; human funds via sandbox
Coinbase AgentKit x402 clientPay third-party x402 endpointsDifferent product; see AgentKit how-to
Alchemy x402 gateway authPay Alchemy for RPC/Data APIsDifferent named object; see Alchemy how-to

When to use a different how-to instead

If you need a merchant facilitator for your own 402 resource server, start with facilitator selection, not Privy wallet provisioning. If the agent only needs Coinbase CDP wallet tooling and MCP, use the Coinbase for Agents guide. If custody must be Circle's agent wallet product, use the Circle agent wallet how-to. Privy agent wallets are the control plane for TEE keys, policies, and Privy-native x402/MPP clients.

💬
Stablecoin Insider's take: for Chief of Staff and platform ops teams, Privy agent wallets are the cleanest way to give agents a USDC balance without putting a raw key in the prompt. Ship with transfer allowlists and x402 typed-data rules on day one, keep maxValue low, and treat authorization-key rotation like any other production secret.

FAQ

What are Privy agent wallets?

Privy agent wallets are server-provisioned wallets for AI agents. Keys are reconstituted in TEEs, signing is gated by authorization keys or scoped signers, and Privy policies constrain transfers and typed-data signatures before the enclave signs.

How do you create a Privy agent wallet for USDC?

Create an authorization key, create a policy that allowlists Base USDC and approved recipients, then call wallets().create with that owner and policy_ids. Fund the returned address with USDC on Base before spending.

Do Privy policies cover x402 payments?

Not via eth_sendTransaction alone. x402 authorizations are EIP-712 typed data, so you need eth_signTypedData_v4 rules that screen the payment recipient (and ideally pin chain and USDC verifyingContract).

How do agents pay APIs with Privy and USDC?

Use createX402Client from @privy-io/node with the agent walletId and address, then wrapFetchWithPayment from @x402/fetch. Set maxValue in USDC base units to cap each payment.

What is the Privy Agent CLI?

@privy-io/agent-wallet-cli lets shell agents login via device authorization, fund through agents.privy.io, list wallets, and call rpc for eth_sendTransaction, eth_signTypedData_v4, and related methods. Sessions last up to 30 days.

Is this the same as Coinbase AgentKit or Alchemy x402 gateway auth?

No. AgentKit is a general client for paying third-party x402 APIs. Alchemy x402 gateway auth pays Alchemy for RPC and Data APIs. Privy agent wallets are TEE custody plus policies plus Privy x402/MPP clients or Agent CLI.

Which USDC contract should operators allowlist on Base?

Mainnet USDC on Base is 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913. Confirm the address in your policy conditions and funding steps before production spend.

Where should operators read the primary docs?


Need the client-side path for paying other x402 APIs? Read the AgentKit how-to next.
Pay an x402 API with AgentKit
How to Pay for an x402 API with Coinbase AgentKit (2026)
Companion guide when the agent pays third-party x402 endpoints rather than holding a Privy-managed wallet.
How to Create a Circle Agent Wallet for USDC (2026)
Related agent wallet surface on Circle, distinct from Privy TEE agent wallets.

This content is provided for informational and educational purposes only and does not constitute financial, investment, legal, or tax advice; no material herein should be interpreted as a recommendation, endorsement, or solicitation to buy or sell.

Latest