Coinbase Agentic Wallets launched on February 12, 2026, and immediately became the default starting point for new prediction market agents. The pitch is simple: your agent gets a wallet with built-in guardrails, and you never have to touch a private key.
This guide goes beyond the quickstart. It covers the architecture, the x402 payment protocol, the AgentKit skills library, production deployment patterns, and the specific workflows for connecting to Polymarket and Kalshi.
If you just want to get a wallet running in 2 minutes: See the Polymarket + Coinbase Quickstart. Come back here when you’re ready to go to production.
Comparing wallet options? See the Agent Wallet Comparison for Coinbase vs. MoonPay vs. Safe vs. EOA vs. Lightning L402. For a focused head-to-head, see MoonPay Agents vs Coinbase.
Architecture: TEE-Isolated Key Management
The core innovation of Agentic Wallets is the separation between your agent’s code and the wallet’s private keys.
┌─────────────────────────────────────────────────────────────────┐
│ YOUR AGENT │
│ │
│ ┌─────────────┐ ┌─────────────────┐ ┌────────────────┐ │
│ │ LLM / AI │───▶│ AgentKit SDK │───▶│ npx awal CLI │ │
│ │ Decision │ │ (skills layer) │ │ (wallet ops) │ │
│ │ Engine │ │ │ │ │ │
│ └─────────────┘ └────────┬────────┘ └───────┬────────┘ │
│ │ │ │
└──────────────────────────────┼──────────────────────┼────────────┘
│ API calls │ CLI calls
▼ ▼
┌─────────────────────────────────────────────────────────────────┐
│ COINBASE INFRASTRUCTURE │
│ │
│ ┌──────────────────────────────────────────────┐ │
│ │ Trusted Execution Environment │ │
│ │ │ │
│ │ ┌──────────────┐ ┌───────────────────┐ │ │
│ │ │ Private Key │ │ Transaction Signer │ │ │
│ │ │ (never leaves │───▶│ (signs inside TEE) │ │ │
│ │ │ the TEE) │ │ │ │ │
│ │ └──────────────┘ └───────────────────┘ │ │
│ │ │ │
│ │ ┌──────────────────┐ ┌──────────────────┐ │ │
│ │ │ Spending Limits │ │ KYT Screening │ │ │
│ │ │ (enforced here) │ │ (blocks risky tx)│ │ │
│ │ └──────────────────┘ └──────────────────┘ │ │
│ └──────────────────────────────────────────────┘ │
│ │
│ ┌────────────────┐ ┌────────────────┐ ┌───────────────────┐ │
│ │ Base L2 (EVM) │ │ Gas Sponsorship│ │ x402 Payment │ │
│ │ (gasless txs) │ │ (free for Base)│ │ Protocol Server │ │
│ └────────────────┘ └────────────────┘ └───────────────────┘ │
└─────────────────────────────────────────────────────────────────┘
What this means in practice:
- Your agent code never sees the private key — it can’t be leaked, logged, or exfiltrated
- Transaction signing happens inside the TEE — even Coinbase operators can’t extract the key
- Spending limits are enforced at the TEE level — your agent can’t bypass them programmatically
- KYT (Know Your Transaction) screening blocks transactions to sanctioned addresses or known scam contracts
This is fundamentally different from a raw EOA where your agent holds the private key in memory or a .env file.
Setup: Beyond the Basics
The quickstart covers npx awal basics. Here’s the complete setup for production agents.
Create and Fund a Wallet
# Install and authenticate
npx awal status # Check if authenticated
npx awal # Follow OTP flow if not
# Create a new wallet (or use existing)
npx awal fund # Deposit USDC to your agent wallet
# Check balances
npx awal status # Shows wallet address, balance, chain
Programmatic Wallet Creation (Python)
For agents that need to create wallets programmatically:
from cdp import CdpClient, WalletConfig
client = CdpClient(api_key="your-api-key")
# Create a new agent wallet on Base
wallet = client.create_wallet(
config=WalletConfig(
chain="base",
name="polymarket-trading-agent-01"
)
)
print(f"Address: {wallet.address}")
print(f"Chain: {wallet.chain}")
# Fund it (requires existing funded source)
tx = client.transfer(
from_wallet="source-wallet-id",
to_address=wallet.address,
amount="100",
currency="USDC"
)
Environment Configuration
import os
# Required
COINBASE_API_KEY = os.getenv("COINBASE_API_KEY")
WALLET_ID = os.getenv("AGENT_WALLET_ID")
# Optional: spending limit configuration
MAX_PER_TX = float(os.getenv("MAX_PER_TX", "50")) # USD per transaction
MAX_SESSION = float(os.getenv("MAX_SESSION", "500")) # USD per session
ALLOWED_CONTRACTS = os.getenv("ALLOWED_CONTRACTS", "").split(",")
The x402 Protocol: Machine-to-Machine Payments
x402 is an open protocol built on HTTP 402 (Payment Required) that enables agents to pay for services without accounts, API keys, or pre-registration. It’s one of the most underappreciated features of the Agentic Wallets ecosystem.
How x402 Works
Agent x402-Enabled Service
│ │
│ 1. GET /api/premium-data │
│ ──────────────────────────────────▶│
│ │
│ 2. 402 Payment Required │
│ Payment-URI: base:0xABC... │
│ Payment-Amount: 0.01 USDC │
│ Payment-Network: base │
│ ◀──────────────────────────────────│
│ │
│ 3. Agent wallet auto-pays │
│ (0.01 USDC to 0xABC on Base) │
│ ──────────────────────────────────▶│
│ │
│ 4. 200 OK + premium data │
│ ◀──────────────────────────────────│
The agent doesn’t need to know the service’s pricing model in advance. The 402 response tells it exactly what to pay, and the wallet handles the rest.
x402 in Python
import requests
from cdp import CdpClient
client = CdpClient(api_key="your-api-key")
wallet = client.get_wallet("your-wallet-id")
def x402_request(url):
"""Make an HTTP request with automatic x402 payment handling."""
response = requests.get(url)
if response.status_code == 402:
# Extract payment details from headers
payment_uri = response.headers.get("X-Payment-URI")
payment_amount = response.headers.get("X-Payment-Amount")
payment_network = response.headers.get("X-Payment-Network")
# Execute payment through the wallet
tx = wallet.send(
to=payment_uri,
amount=payment_amount,
currency="USDC"
)
# Retry the request with payment proof
response = requests.get(
url,
headers={"X-Payment-Proof": tx.hash}
)
return response
# Example: access a premium data feed
data = x402_request("https://api.example.com/prediction-market-signals")
x402 Discovery via the Bazaar
Coinbase’s Bazaar is a registry of x402-enabled services. Agents can discover services programmatically:
bazaar_response = requests.get(
"https://bazaar.cdp.coinbase.com/services",
params={"category": "prediction-markets"}
)
for service in bazaar_response.json():
print(f"{service['name']}: {service['price']} USDC/request")
print(f" Endpoint: {service['url']}")
As of February 2026, the Bazaar has over 50 million x402 transactions processed. The ecosystem is growing rapidly, especially in data feeds, API access, and compute services.
Spending Limits and Guardrails
Spending limits are the primary safety mechanism for autonomous agents. They’re enforced inside the TEE, meaning your agent code cannot bypass them — even if compromised.
Types of Limits
| Limit Type | Description | Example |
|---|---|---|
| Per-transaction cap | Maximum USDC per single transaction | $50 per trade |
| Session cap | Maximum USDC across all transactions in a session | $500 per session |
| Daily cap | Maximum USDC per 24-hour period | $1,000 per day |
| Contract allowlist | Only interact with specific contract addresses | Polymarket CTF contract only |
| Function allowlist | Only call specific contract functions | fillOrder() and cancelOrder() only |
Configuring Limits
from cdp import CdpClient, SpendingPolicy
client = CdpClient(api_key="your-api-key")
wallet = client.get_wallet("your-wallet-id")
# Set spending limits
wallet.set_spending_policy(SpendingPolicy(
per_transaction_limit="50.00", # Max $50 per trade
session_limit="500.00", # Max $500 per session
daily_limit="1000.00", # Max $1,000 per day
allowed_contracts=[
"0x4bFb41d5B3570DeFd03C39a9A4D8dE6Bd8B8982E", # Polymarket CTF
"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", # USDC on Polygon
],
allowed_functions=["fillOrder", "cancelOrder", "approve"],
))
print("Spending policy updated")
The Lobstar Wilde Lesson
On February 22, 2026, an AI agent called Lobstar Wilde accidentally transferred $450,000 in tokens due to a state management bug in its trading logic. The agent held raw private keys (EOA wallet) with no spending limits. If it had used Agentic Wallets with a $500 session cap, the maximum loss would have been $500 instead of $450,000.
This incident is the strongest argument for TEE-enforced spending limits. See The Lobstar Wilde Incident for the full breakdown.
AgentKit Skills
AgentKit is Coinbase’s framework for building AI agents with wallet capabilities. It provides a set of pre-built “skills” — functions that agents can call to interact with the wallet and blockchain.
Core Skills
| Skill | Description | Example Use |
|---|---|---|
fund | Add USDC to the wallet | Initial funding or top-up |
send | Transfer USDC to an address or ENS name | Pay for a service, fund another agent |
trade | Swap tokens on Base | Convert ETH to USDC |
balance | Check wallet balance | Decide if enough capital for a trade |
pay | Execute an x402 payment | Access a premium data feed |
Using AgentKit with LLMs
AgentKit skills are designed to be called by LLMs as tools. Here’s a pattern for integrating with an LLM-powered agent:
from cdp_agentkit import AgentKit
# Initialize AgentKit with your wallet
kit = AgentKit(wallet_id="your-wallet-id")
# Get available skills as tool definitions
tools = kit.get_tools()
# Example: feed these to an LLM as available functions
# The LLM decides when to call balance(), send(), trade(), etc.
for tool in tools:
print(f"Tool: {tool.name}")
print(f" Description: {tool.description}")
print(f" Parameters: {tool.parameters}")
The key insight: AgentKit turns wallet operations into LLM-callable tools. Your agent’s reasoning engine decides when to check balances, when to fund trades, and when to pay for data — the skills provide the how.
Bridging to Polygon for Polymarket
Agentic Wallets default to Base (Coinbase’s L2). Polymarket runs on Polygon. Bridging USDC between chains is a required step.
Bridge Options
| Bridge | Speed | Cost | Reliability |
|---|---|---|---|
| Coinbase Bridge (built-in) | 5-15 min | ~$0.10-0.50 | High (Coinbase-operated) |
| Across Protocol | 1-5 min | ~$0.50-2.00 | High (battle-tested) |
| Hop Protocol | 5-10 min | ~$0.30-1.00 | High |
Automated Bridge Flow
from cdp import CdpClient
client = CdpClient(api_key="your-api-key")
wallet = client.get_wallet("your-wallet-id")
def bridge_to_polygon(amount_usdc: str):
"""Bridge USDC from Base to Polygon for Polymarket trading."""
tx = wallet.bridge(
to_chain="polygon",
amount=amount_usdc,
currency="USDC"
)
print(f"Bridge initiated: {tx.hash}")
print(f"Estimated time: {tx.estimated_time}")
# Wait for bridge completion
tx.wait_for_completion(timeout=900) # 15 min timeout
print(f"Bridge complete. Polygon balance: {tx.destination_balance}")
return tx
# Bridge $100 to Polygon before trading
bridge_to_polygon("100.00")
The Full Trading Flow
1. Agent wallet on Base (funded with USDC)
│
▼
2. Bridge USDC from Base → Polygon (~5-15 min)
│
▼
3. USDC arrives on Polygon
│
▼
4. Approve USDC spending for Polymarket CTF contract
│
▼
5. Place trades via Polymarket CLOB API
│
▼
6. Positions held as outcome tokens on Polygon
│
▼
7. On resolution: redeem winning tokens for USDC
│
▼
8. (Optional) Bridge USDC back to Base
Production Deployment
Monitoring and Alerting
import time
def monitor_agent_wallet(wallet, alert_callback):
"""Monitor wallet health and send alerts on anomalies."""
initial_balance = float(wallet.get_balance("USDC"))
while True:
current_balance = float(wallet.get_balance("USDC"))
# Alert on significant balance drop
drop_pct = (initial_balance - current_balance) / initial_balance * 100
if drop_pct > 20:
alert_callback(
f"Balance dropped {drop_pct:.1f}% from "
f"${initial_balance:.2f} to ${current_balance:.2f}"
)
# Alert on low balance
if current_balance < 10:
alert_callback(
f"Low balance: ${current_balance:.2f}. "
f"Agent may not be able to place trades."
)
time.sleep(60) # Check every minute
Error Recovery
Common failure modes and how to handle them:
| Failure | Cause | Recovery |
|---|---|---|
| Bridge timeout | Polygon congestion | Retry with longer timeout; check bridge status |
| Spending limit hit | Agent exceeded session cap | Reset session or increase limits |
| KYT rejection | Transaction to flagged address | Skip this trade; log for review |
| Insufficient balance | USDC depleted | Auto-bridge from Base; alert operator |
| Wallet auth expired | Session token expired | Re-authenticate via OTP |
Security Checklist
Before deploying to production:
- Spending limits configured (per-tx, session, daily)
- Contract allowlist set (only Polymarket + USDC contracts)
- Function allowlist set (only trading-related functions)
- Monitoring and alerting configured
- Balance alerts configured (low balance + significant drops)
- Error recovery logic tested
- Bridge flow tested with small amounts first
- Agent code reviewed for key exposure (there shouldn’t be any, but verify)
- Environment variables properly secured (not in code, not in git)
- Logging configured (transactions, errors, balance changes)
Frequently Asked Questions
What are Coinbase Agentic Wallets?
Coinbase Agentic Wallets are non-custodial crypto wallets designed specifically for AI agents. Private keys are isolated inside Trusted Execution Environments (TEEs) and never exposed to the agent code. The agent interacts through a CLI (npx awal) or AgentKit SDK, with programmable spending limits that constrain what the agent can do. Launched February 12, 2026.
How do Coinbase Agentic Wallets work with Polymarket?
Coinbase Agentic Wallets operate on Base (Coinbase’s L2). To trade on Polymarket (which runs on Polygon), you bridge USDC from Base to Polygon using a cross-chain bridge. Once USDC is on Polygon, the agent can interact with Polymarket’s CLOB API to place trades. The bridging step takes 5-15 minutes and costs a small gas fee.
What is the x402 protocol?
x402 is an open payment protocol where services respond with HTTP 402 (Payment Required) when an agent needs to pay. The response includes a payment URI and amount. The agent’s wallet automatically completes the payment, and the service grants access. This enables machine-to-machine commerce without accounts or API keys.
Are Coinbase Agentic Wallets free?
Creating an Agentic Wallet is free. Transactions on Base are gasless (Coinbase sponsors gas). Bridging to other chains (like Polygon for Polymarket) incurs a small gas fee. The x402 protocol itself is free — you only pay for the services you consume through it.
Further Reading
- Agent Wallet Comparison — Coinbase vs. MoonPay vs. Safe vs. EOA vs. Lightning L402
- Polymarket + Coinbase Quickstart — Hands-on setup in 5 steps
- The Lobstar Wilde Incident — Why spending limits matter
- Security Best Practices — Prompt injection, key management, production checklists
- The Agent Betting Stack Explained — How wallets fit into the full architecture
- MoonPay Agents vs Coinbase — Head-to-head comparison with code examples
- Build a Polymarket Trading Bot — Put your wallet to work
- Polymarket API Guide — Full Polymarket trading API reference
- Coinbase Agentic Wallets Docs — Official Coinbase documentation
- Coinbase AgentKit Docs — Official AgentKit documentation
- x402 Protocol Spec — Open protocol specification
This guide is maintained by AgentBets.ai. Found an error? Let us know on Twitter.
Not financial advice. Built for builders.