Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.polygon.technology/llms.txt

Use this file to discover all available pages before exploring further.

The Polygon Agentic CLI is a command-line toolkit that gives AI agents and autonomous applications full access to the Polygon payments stack in a single install. It handles wallet creation, token transfers, cross-chain bridging, x402 micropayments, and ERC-8004 onchain identity without requiring agents to manage multiple SDKs or dependencies.

View on GitHub

Source code, releases, and contribution guide.

What it includes

CapabilityDescription
Smart contract walletsSession-based wallets via Sequence. Create and manage wallets with scoped permissions per agent session.
Token operationsSend, swap, bridge, and deposit tokens via Trails routing. Single command for any cross-chain transfer.
x402 micropaymentsPay x402-protected API endpoints and register resources as a seller. Built-in buyer and seller flows.
ERC-8004 identityRegister and update onchain agent identity and reputation. Interact with Identity, Reputation, and Validation registries.
Encrypted storageAES-256-GCM encrypted local storage for keys and session state. No plaintext secrets on disk.

Install

npm install -g @0xpolygon/agent-cli
Or run directly without installing:
npx @0xpolygon/agent-cli

Quick start

1. Create a wallet
polygon-agent wallet create
This generates a smart contract wallet secured by a session key. The private key is stored locally with AES-256-GCM encryption. 2. Fund the wallet
polygon-agent wallet fund --network polygon
3. Send tokens
polygon-agent token send \
  --to 0xRecipient \
  --amount 10 \
  --token USDC \
  --network polygon
4. Pay an x402 endpoint
polygon-agent x402 pay --url https://api.example.com/resource
The CLI detects the 402 response, constructs the payment, and retries the request automatically. 5. Register agent identity
polygon-agent identity register --name "my-agent" --description "Trading agent"
This writes an ERC-8004 identity record on Polygon mainnet.

Key commands

Wallet

CommandDescription
wallet createCreate a new session-based smart contract wallet
wallet listList all managed wallets
wallet balanceShow token balances for a wallet
wallet exportExport wallet credentials

Token operations

CommandDescription
token sendTransfer tokens to an address
token swapSwap tokens via Trails routing
token bridgeBridge tokens cross-chain
token depositDeposit tokens to a protocol

x402

CommandDescription
x402 payPay an x402-protected endpoint
x402 serveProtect a local endpoint with x402 payment gating
x402 statusCheck payment status for a resource

Identity (ERC-8004)

CommandDescription
identity registerRegister onchain agent identity
identity updateUpdate identity metadata
identity reputationRead reputation score for an agent address
identity verifyVerify an agent’s credentials against the Validation registry

Configuration

The CLI reads from ~/.polygon-agent/config.json by default. You can override with --config:
polygon-agent --config ./my-config.json wallet list
Key configuration options:
{
  "network": "polygon",
  "rpc": "https://polygon-rpc.com",
  "keystore": "~/.polygon-agent/keys",
  "x402": {
    "facilitator": "https://facilitator.polygon.technology"
  }
}

Security

  • Private keys are encrypted at rest with AES-256-GCM
  • Session keys are scoped per operation with configurable spending limits
  • No keys are transmitted to external services

x402 Protocol

HTTP-native micropayments that the CLI uses under the hood.

ERC-8004

Onchain identity and reputation standard for agents.

LLM Wallet MCP

MCP server for wallet operations inside Claude and Cursor.

Agentic Wallets

Wallet infrastructure designed for autonomous agent use.