Before running any commands, use the Read tool to check
~/.polygon-agent/builder.json
:
bash
# Phase 1: Setup (creates EOA + Sequence project, returns access key)
polygon-agent setup --name "MyAgent"
# → save privateKey (not shown again), eoaAddress, accessKey
# Phase 2: Create ecosystem wallet (auto-waits for browser approval)
export SEQUENCE_PROJECT_ACCESS_KEY=<accessKey>
polygon-agent wallet create --usdc-limit 100 --native-limit 5
# → IMPORTANT: The command outputs an `approvalUrl`. You MUST send the COMPLETE,
# UNTRUNCATED URL to the user and wait for them to open it in a browser and approve.
# Do NOT proceed to the next step until the user confirms approval (or the CLI
# automatically detects the callback). The wallet address is only available after approval.
# Phase 3: Fund wallet
polygon-agent fund
# → reads walletAddress from session, builds Trails widget URL with toAddress=<walletAddress>
# → ALWAYS run this command to get the URL — never construct it manually or hardcode any address
# → send the returned `fundingUrl` to the user; `walletAddress` in the output confirms the recipient
# Phase 4: Verify (SEQUENCE_INDEXER_ACCESS_KEY is the same as your project access key)
export SEQUENCE_INDEXER_ACCESS_KEY=$SEQUENCE_PROJECT_ACCESS_KEY
polygon-agent balances
# Phase 5: Register agent on-chain (ERC-8004, Polygon mainnet)
polygon-agent agent register --name "MyAgent" --broadcast
# → mints ERC-721 NFT, emits agentId in Registered event
# → use agentId for reputation queries and feedback
When
outputs a URL in the
or
field, you
MUST send the COMPLETE, UNTRUNCATED URL to the user. The URL contains cryptographic parameters (public key, callback token) that are required for session approval. If any part is cut off, the approval will fail.
The
command automatically starts a local HTTP server and opens a
Cloudflare Quick Tunnel (
) — no account or token required. The
binary is auto-downloaded to
~/.polygon-agent/bin/cloudflared
on first use if not already installed. The connector UI POSTs the encrypted session back through the tunnel regardless of where the agent is running. The tunnel and server are torn down automatically once the session is received.
Timing: The
is only valid while the CLI process is running. Open it immediately and complete wallet approval within the timeout window (default 300s). Never reuse a URL from a previous run — the tunnel is torn down when the CLI exits.
Manual fallback (if cloudflared is unavailable): The CLI omits
so the connector UI displays the encrypted blob in the browser. The CLI then prompts:
The blob is also saved to
/tmp/polygon-session-<rid>.txt
for reference. To import later:
text
~/.polygon-agent/
├── .encryption-key # AES-256-GCM key (auto-generated, 0600)
├── builder.json # EOA privateKey (encrypted), eoaAddress, accessKey, projectId
├── wallets/<name>.json # walletAddress, session, chainId, chain
└── requests/<rid>.json # Pending wallet creation requests