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

> Every Polygon Agent CLI command and flag, with defaults, supported chains, environment variables, file layout, and session-mode errors.

The package is `@polygonlabs/agent-cli`, and it requires Node.js 22 or later. The command is `agent`, with `polygon-agent` as an alias. Output is JSON: `{"ok": true, ...}` on success, or `{"ok": false, "error", "code", "hint", "command"}` on failure.

## Global behavior

| Setting | Default | Override |
| - | - | - |
| Transaction mode | `dry-run`: write commands preview | `--broadcast` or `--dry-run` per command; `agent mode auto` to always broadcast |
| Wallet name | `main` | `--name <name>` on `wallet` commands, `--wallet <name>` on others |
| Chain | `polygon` | `--chain <name-or-id>` |
| Fee token | USDC when available, otherwise POL | `--prefer-native-fee` on `call` |

## Chains

`--chain` takes a name or chain ID: `polygon`, `amoy`, `mainnet` (Ethereum), `arbitrum`, `optimism`, `base`, `bsc`, `avalanche`, and `katana`. The wallet address is the same on every chain. ERC-8004 commands run on `polygon` only.

## Wallet

| Command | Description |
| - | - |
| `wallet login [--allowance <usd>] [--days <1-30>] [--chains <csv>] [--email <email>]` | Connect in session mode by approving an allowance. Defaults to \$1,000 over 30 days. |
| `wallet login --owner [--local] [--no-fund] [--force]` | Connect in owner mode with the owner's full sign-in, for about a week. |
| `wallet confirm --request <id> (--code <code> \| --wait)` | Finish a sign-in with an emailed code, or wait for a browser sign-in. |
| `wallet status` | Connection, mode, allowance left, holdings, alerts, and the dashboard link. |
| `wallet allowance` | Show the allowance. |
| `wallet allowance set [--amount <usd>] [--add <token>@<chain>] [--chains <csv>]` | Change the allowance. Needs a new sign-in. |
| `wallet allowance renew [--days <n>]` | Extend the allowance. Needs a new sign-in. |
| `wallet withdraw --to <address> --token <symbol> --amount <n> [--chain <chain>]` | Withdraw as the owner. Needs a new sign-in. |
| `wallet access [--revoke <credentialId>]` | List or revoke installs and sign-ins with access. Needs a new sign-in. |
| `wallet logout` | In session mode, revoke this install's access. In owner mode, clear the local session. |
| `wallet list`, `wallet address`, `wallet remove` | Manage stored wallets. |
| `fund` | Open the wallet's dashboard to add funds. |
| `mode [auto \| dry-run]` | Show or set the transaction mode. |
| `setup --oms-publishable-key <key>` | Use your own OMS project instead of the default. |

## Balances and transfers

| Command | Description |
| - | - |
| `balances [--chain <chain>] [--chains <csv>]` | Token balances. `--chains` takes up to 20 chains. |
| `price <symbol-or-address> [--chain <chain>]` | USD price. ETH, BTC, POL, and stablecoins need no chain. |
| `send --to <address> --amount <n> [--symbol <symbol>] [--token <address>]` | Send the native token, or an ERC-20 with `--symbol`. |
| `send-token --symbol <symbol> --to <address> --amount <n> [--token <address>] [--decimals <n>]` | Send an ERC-20. |
| `send-native --to <address> --amount <n> [--direct]` | Send the native token. Owner mode only. |
| `call --to <address> --data <hex> [--value <amount>] [--prefer-native-fee]` | Send a raw contract call. Owner mode only. |

## Trading and yield

| Command | Description |
| - | - |
| `swap --to <symbol> (--amount <n \| n% \| all> \| --amount-usd <usd> \| --to-amount <n>) [--from <symbol>] [--chain <chain>] [--to-chain <chain>] [--slippage <n>]` | Quote a swap or bridge. A dry run returns an `intentId`. Default slippage is 0.005. |
| `swap --intent <intentId> --broadcast` | Execute a quote. |
| `swap status --intent <intentId>` | Follow a trade still settling. |
| `deposit --asset <symbol> --amount <n> [--protocol aave \| morpho] [--vault <address>] [--chain <chain>]` | Deposit into a yield pool. Owner mode only. |
| `withdraw --position <address> --amount <n \| max> [--chain <chain>]` | Withdraw from an Aave aToken or ERC-4626 vault. Owner mode only. |

## Price watches

| Command | Description |
| - | - |
| `watch create --token <symbol> --mode alert \| auto [--buy-below <usd>] [--buy-amount <usd>] [--sell-above <usd>] [--sell-amount <n \| n% \| all>] [--every 15m] [--expires 30d] [--confirm]` | Create a watch. `--every` is 5m to 24h; `--expires` is up to 90d. |
| `watch list [--all]`, `watch cancel <id>` | Manage watches. |
| `watch check` | Check all watches once. Run it on a schedule. |
| `watch run` | Check in the foreground until stopped. |
| `alerts [--all]`, `alerts --ack <id>...` | Read and acknowledge alerts. |

## x402

| Command | Description |
| - | - |
| `x402-pay --url <url> [--method GET] [--body <string>] [--header Key:Value] [--max-usd <usd>] [--yes]` | Call an x402 endpoint and pay its price. The network comes from the 402 response. |

| Limit | Default |
| - | - |
| Per call, without `--yes` | \$1 |
| Per rolling 24 hours | \$10 |

## Agent identity (ERC-8004)

| Command | Description |
| - | - |
| `register --name <name> [--agent-uri <uri>] [--metadata <k=v,k=v>]` | Register the agent. Owner mode only. |
| `identity --agent-id <id> [--key <metadata-key>]` | Payment wallet and metadata. |
| `reputation --agent-id <id> [--tag1 <tag>] [--tag2 <tag>]` | Reputation score. |
| `reviews --agent-id <id> [--include-revoked]` | All feedback. |
| `feedback --agent-id <id> --value <score> [--tag1 <tag>] [--tag2 <tag>] [--endpoint <endpoint>] [--feedback-uri <uri>]` | Leave feedback. Owner mode only. |

## Polymarket

| Command | Description |
| - | - |
| `polymarket status` | Account, balance, region, and redeemable winnings. |
| `polymarket setup` | Create the account. |
| `polymarket deposit <usd> [--again] [--no-wait]` | Deposit USDC. Minimum \$2. |
| `polymarket withdraw <usd \| all>` | Withdraw to the agent wallet as USDC. Minimum \$2. |
| `polymarket markets [--search <text>] [--limit <n>] [--cursor <cursor>]` | List active markets. |
| `polymarket event <slug>`, `market <ref>`, `book <ref> <outcome>`, `history <ref> <outcome>` | Market data. |
| `polymarket buy <ref> <outcome> <usd> [--max-price <0-1>] [--price <0-1>] [--expires <minutes>]` | Buy. |
| `polymarket sell <ref> <outcome> <shares \| all> [--min-price <0-1>] [--price <0-1>] [--expires <minutes>]` | Sell. |
| `polymarket orders [--market <ref>]`, `cancel [<orderId> \| --all \| --market <ref>]` | Manage open orders. |
| `polymarket positions [--status <status>]`, `redeem [<ref> \| --all]`, `activity`, `pnl` | Positions, winnings, and history. |

## Workspace installs

| Command | Description |
| - | - |
| `workspace init --root <dir> [--skills-dir <dir>] [--name <name>] [--platform <platform>]` | Install into an assistant's workspace. `--platform` is `muse`, `openclaw`, `hermes`, `grok`, `claude-code`, `cursor`, `codex`, or `other`. |
| `skills show <name>`, `skills install <name> --dir <dir>` | Print or install the bundled Open Money Agent skill. |
| `update` | Update a workspace install to the latest CLI and skill. |

## Environment variables

None are required.

| Variable | Default | Description |
| - | - | - |
| `OMS_PUBLISHABLE_KEY` | Built-in default | Use your own OMS project. |
| `POLYGON_AGENT_HOME` | `~/.polygon-agent` | Folder for all CLI state. |
| `POLYGON_AGENT_SIGNIN` | Chosen automatically | `browser` or `email`, to force a sign-in method. |
| `POLYGON_AGENT_LOGIN_UI` | `https://agentconnect.polygon.technology` | Sign-in page. |
| `POLYGON_AGENT_OIDC_RELAY` | `https://oidc-relay.polygon.technology` | Sign-in relay. |

## Files

State lives in `~/.polygon-agent/`, or `<workspace>/.polygon-agent/state/` for a workspace install. Keys are encrypted at rest with AES-256-GCM.

| Path | Contents |
| - | - |
| `config.json` | Transaction mode. |
| `builder.json` | OMS project credentials. |
| `wallets/<name>.json` | Wallet address and access mode. |
| `session/<name>/` | Session key and approved allowance. |
| `oms/<name>/` | Owner-mode session. |
| `polymarket/<wallet>/` | Polymarket account and trading key. |
| `watches.json`, `alerts.jsonl` | Price watches and alerts. |

## Session-mode errors

| Code | Meaning |
| - | - |
| `not_connected` | No wallet connected. Run `wallet login`. |
| `not_covered` | The allowance doesn't cover this token or chain. Add it with `wallet allowance set --add`. |
| `allowance_exhausted` | The allowance is used up. Raise it with `wallet allowance set`. |
| `session_expired` | The allowance period ended. Renew it with `wallet allowance renew`. |
| `owner_required` | The command needs owner mode. |
| `native_not_supported` | Native coins can't be sent from an allowance. |
