The agnic CLI lets you manage your AgnicPay wallet, make payments, and trade tokens directly from the terminal. It's designed for AI agents, scripts, and developers who prefer the command line.
Or install globally:
The CLI supports three authentication methods (in priority order):
--token flag — passed directly on each command
AGNIC_TOKEN env var — set in your shell environment
Stored token — saved locally via agnic auth login
agnic auth login
# Opens your browser → sign in → set spending limits → done!
# Output: Authenticated!
# Email: [email protected]
# Wallet: 0x046906b3...
The CLI opens your browser to AgnicPay where you sign in with your account and set spending limits. Once approved, tokens are saved locally with 90-day expiry. Tokens auto-refresh when expired.
export AGNIC_TOKEN = agnic_at_abc123...
agnic balance
agnic balance --token agnic_at_abc123...
Check authentication and wallet status.
agnic status
# User ID: did:privy:abc123
# Email: [email protected]
# Wallet: 0x046906b3...
# Token expires: 89 days
Check USDC balance across networks.
# All networks
agnic balance
# Network Currency Balance
# base USDC $125.50
# solana USDC $0.00
# Specific network
agnic balance --network base
# base: $125.50 USDC
Show your wallet address.
agnic address
# 0x046906b3cd9d73bf85eb01d795d333b364b75842
Send USDC to a wallet address.
agnic send 5.00 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7
# Sending 5.00 USDC to 0x742d35...f0bEb7...
# Transfer complete!
# Amount: $5.00 USDC
# To: 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7
# Tx: 0xabc123...
Options:
--network <network> — Network (default: base)
--memo <text> — Transaction memo
Trade/swap tokens on Base.
# Preview a trade
agnic trade 10 usdc eth --dry-run
# Trade Quote:
# Sell: 10 USDC
# Buy: 0.00396 ETH
# Price: 2525.25
# Execute
agnic trade 10 usdc eth
# Swapping 10 USDC -> ETH on Base...
# Trade complete!
# Sold: 10 USDC
# Got: 0.00396 ETH
# Tx: 0xabc123...
Options:
--slippage <percent> — Max slippage percentage (default: 1.0)
--dry-run — Show quote without executing
Search for X402-enabled APIs.
agnic x402 search "sentiment analysis"
# Found 3 API(s):
# 1. Sentiment Pro
# Real-time sentiment analysis
# Price: $0.001 /request
Options:
--category <cat> — Filter by category (AI, Crypto, Data, Trading, Finance, Weather)
--limit <n> — Max results (default: 10)
Make an x402 payment request to an API.
agnic x402 pay https://api.example.com/data
# Paying https://api.example.com/data...
# Request complete!
# Status: 200
# Cost: $0.001
# Response:
# { "result": "..." }
Options:
--method <METHOD> — HTTP method (default: GET)
--body <json> — Request body as JSON string
All commands support --json for machine-readable output:
[
{ "network" : "base" , "balance" : "125.50" , "address" : "0x046906b3..." },
{ "network" : "solana" , "balance" : "0" , "address" : "N/A" }
]
The CLI stores configuration at ~/.agnic/config.json:
{
"accessToken" : "agnic_at_abc123..." ,
"refreshToken" : "agnic_rt_xyz789..." ,
"expiresAt" : 1756000000000 ,
"userId" : "did:privy:abc123" ,
"email" : "[email protected] " ,
"walletAddress" : "0x..."
}
File permissions are set to 0600 (owner-only read/write).
Token Auto-Refresh: When your access token expires, the CLI automatically refreshes it using the stored refresh token. No manual re-authentication needed unless the refresh token also expires (90 days).
agnic --api-url https://custom.api.com balance
Check your agent's on-chain ERC-8004 identity, trust score, and delegation info.
agnic agent-identity [--json]
Example output:
Agent Identity
Agent ID: #396
Chain ID: 84532
Wallet: 0xe38b20d6eb4dbd04b7f13fa8f9b6352d3824a0e1
Trust Score: 26
Status: active
Delegation: active (ID: 4a4ce438-...)
Agent Card: https://kya.agnic.ai/.well-known/agent-cards/396.json
Manage your agent's dedicated email address (agent-{id}@agent.agnic.ai).
# Show email address
agnic email address [--json]
# Create email alias
agnic email setup [--display-name < nam e > ] [--json]
# Check inbox
agnic email inbox [--limit < n > ] [--json]
# Send email
agnic email send --to < addres s > --subject < subjec t > --body < bod y > [--json]
# Reply to a message
agnic email reply --message-id < i d > --body < bod y > [--json]
Example:
agnic email setup --display-name "Research Agent"
agnic email send --to [email protected] --subject "Results" --body "Analysis complete"
agnic email inbox --json
#!/bin/bash
# Automated agent workflow
# Check balance before operations
BALANCE = $( agnic balance --network base --json | jq -r '.[0].balance' )
echo "Current balance: $BALANCE USDC"
# Trade some USDC for ETH
agnic trade 5 usdc eth --json
# Pay for an API service
agnic x402 pay https://api.example.com/analysis \
--method POST \
--body '{"query": "latest market data"}' \
--json