> ## 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.

# Polygon Agent CLI

> Command-line toolkit for agents on Polygon: smart wallets, OMS Cross-chain for funding, swaps, and yield, x402 micropayments, ERC-8004 identity, and Polymarket.

The Polygon Agent CLI is one binary that gives an agent everything it needs to transact on Polygon: a wallet to spend from, fiat funding, cross-chain swaps, and yield through OMS Cross-chain, x402 micropayments, ERC-8004 identity, and Polymarket trading. Every write command is dry-run by default. The same surface works for a developer testing flows from a laptop and an agent runtime running headless in production.

Configuration lives at `~/.polygon-agent/`. Keys are encrypted at rest with AES-256-GCM. Sessions last six months.

**Who this is for:**

* Agent developers building on Polygon who want one toolkit instead of stitching together five SDKs
* Enterprise teams running agent fleets with bounded spend and audit requirements
* Anyone testing x402, OMS Cross-chain, or ERC-8004 flows interactively before going to production

***

## How it works

Wallet topology

1
Operator
→
CLI
polygon-agent setup → creates EOA (auth only)

2
Operator
→
OMS Wallet
wallet create → smart wallet (the spending wallet)

3
Smart wallet
→
Cross-chain
Funded in fiat or crypto via `polygon-agent fund`

4
Smart wallet
Spends: transfers, swaps, yield, x402, identity, prediction markets

5
CLI
Dry-runs every write; broadcasts only with `--broadcast`

The CLI keeps two wallets per project: an EOA that authenticates with OMS (never funded), and a smart wallet that holds the operating balance and signs every transaction. Spending limits, contract allowlists, and DeFi permissions are scoped to the smart wallet at creation. The operator never funds or exposes the EOA.

***

## Install

```bash theme={null}
npm install -g @polygonlabs/agent-cli
```

The binary is `polygon-agent`. Re-running the install command updates to the latest version.

```bash theme={null}
polygon-agent setup --name "my-project"
polygon-agent wallet create
```

`setup` provisions the EOA and OMS access key, written to `~/.polygon-agent/builder.json`. `wallet create` opens a browser approval flow and pairs a smart wallet using a six-digit code.

***

## Supported chains

| Value | Network |
| - | - |
| `polygon` (default) | Polygon mainnet |
| `amoy` | Polygon Amoy testnet |
| `mainnet` | Ethereum mainnet |
| `arbitrum` | Arbitrum One |
| `optimism` | Optimism |
| `base` | Base |

ERC-8004 agent commands (`agent register`, `agent feedback`, etc.) operate on **Polygon mainnet only**, regardless of `--chain`.

***

## Safety model

> [!WARNING]
>
> Every write command (`send`, `send-token`, `send-native`, `swap`, `deposit`, `withdraw`, `agent register`, `agent feedback`, and the Polymarket trading commands) runs in dry-run unless you pass `--broadcast`. The one exception is `x402-pay`, which auto-pays the 402 and submits the payment as part of the request, there is no `--broadcast` flag.

Keep at least **0.1 USDC or 0.1 POL** in the smart wallet at all times for gas. The CLI auto-selects USDC over POL when both are available.

***

## Sections

> [card] [Setup and wallets](https://docs.polygon.technology/payment-services/agentic-payments/cli/setup-and-wallets.md)
>
> `setup`, `wallet create | import | list | address | remove`, spending limits, browser approval.

> [card] [Balances and funding](https://docs.polygon.technology/payment-services/agentic-payments/cli/balances-and-funding.md)
>
> `balances` (single + multi-chain), `fund` (funding widget URL), gas reserve rules.

> [card] [Transfers](https://docs.polygon.technology/payment-services/agentic-payments/cli/transfers.md)
>
> `send`, `send-native`, `send-token` with dry-run + broadcast.

> [card] [Swaps and yield](https://docs.polygon.technology/payment-services/agentic-payments/cli/swaps-and-yield.md)
>
> `swap` (OMS Cross-chain), `deposit` and `withdraw` (Aave v3, Morpho, ERC-4626).

> [card] [Pay an x402 endpoint](https://docs.polygon.technology/payment-services/agentic-payments/cli/x402-pay.md)
>
> `x402-pay` auto-pays 402 responses; prerequisite flow.

> [card] [ERC-8004 agent identity](https://docs.polygon.technology/payment-services/agentic-payments/cli/agent-identity.md)
>
> `agent register`, `reputation`, `feedback`, `reviews`. Mainnet only.

> [card] [Polymarket](https://docs.polygon.technology/payment-services/agentic-payments/cli/polymarket.md)
>
> Prediction-market trading: `markets`, `clob-buy`, `sell`, `positions`.

> [card] [View on GitHub](https://github.com/0xPolygon/polygon-agent-cli)
>
> Source, releases, and contribution guide.
