agentswap
AgentSwap CLI for requesting quotes, inspecting tokens and pools, managing intents, and registering an API key against the AgentSwap service.
Install
# Or install the prebuilt binary for this platform.
|
The installer downloads release assets named
agentswap-v<version>-<target>.tar.gz for the supported targets.
Usage
Replace 0xYourProxy with your User Proxy address and ./private-key.txt with the agent's signing
key file; --dry-run returns an unsigned preview and never signs or broadcasts.
Use --chainid with a numeric chain ID such as 8453; known aliases such as base, arb,
bsc, robinhood and ethereum are also accepted. Quotes, tokens and pools resolve any of
them. Intents, policy and trade are deployed on Base (8453), Arbitrum One (42161), BNB Smart
Chain (56) and Robinhood Chain (4663) only, and an alias that resolves to another chain is
refused by those commands.
Intents and policy
Run examples/daily-sell.sh for one fraction-of-balance sale preview:
AGENTSWAP_KEY_FILE=/path/to/key examples/daily-sell.sh --owner "$OWNER" --agent "$AGENT" --token WETH --quote-token USDC.
It requires Bash, curl, bc and jq, checks the token budget and unsigned intent, and stops at the
authorization digest by default. Its example parameters select chain 8453, a 1000 bps fraction,
outputs at +100/-20 bps from the quote, a 300-second decay and a 600-second duration;
--live enables signing and relaying and requires sufficient budget and on-chain authorization.
V6 open intents are signed against the owner's V6 proxy and can be inspected before they are
announced. A live intent place needs exactly one submission mode: --relay hands the signed
intent to the AgentSwap relay, --self-submit broadcasts it from the --key-file wallet.
--dry-run returns the unsigned intent, authorization and digest after on-chain hash parity
checks, without signing, creating an envelope, relaying or broadcasting. Signature-based
authorization validation runs only on the live path. Use intent list --owner <address>
and intent status --id <bytes32> to inspect them. Raw token addresses are accepted on supported
chains, and every amount is given in the token's smallest unit.
trade and intent place are forced to dry-run unless --allow-trade is set, and the same flag
gates the MCP trade and intent_place tools. A live trade also needs --min-out: without an
explicit floor the trade is refused, because the quote server's output is not trusted as the
protection floor. Every monetary input is an unsigned decimal integer in the asset's smallest
unit; --max-amount bounds the raw input amount before signing or sending. A trade dry-run
reads policy generation and verifies the AgentOrder digest against the chain, then returns the quote,
unsigned AgentOrder and digest. Dry-run outputs omit signatures, authorization envelopes and
signed calldata; neither command signs, broadcasts or relays in dry-run.
agentswap mcp exposes nine tools: quote, batch_quote, tokens, pools, trade, intent_place,
intent_list, intent_status and policy. --allow-trade permits live execution by trade and
intent_place; without it those two run as dry-runs. Intent listing requires an owner or agent filter. MCP trade additionally defaults dry_run to true, while the
CLI defaults to a live trade once --allow-trade is set.
Intent and policy reads inspect the latest 200,000 blocks on Base, Arbitrum One, BNB Smart Chain
and Robinhood Chain. BNB Smart Chain uses 9,000 blocks with the built-in public RPC; set
AGENTSWAP_RPC_URL_56 or AGENTSWAP_RPC_URL for a keyed endpoint to use the full lookback, or
pass --lookback-blocks.
Authenticated Flows
buy-quota prints the wallet calls for a quota purchase and is available on Base and Arbitrum
only.
Set AGENTSWAP_URL to target a non-default service endpoint; the intent relay
(intent place --relay) always posts to https://app.agentswap.co and does not follow this
setting. Set SR_API_KEY, the AgentSwap API key, to override the cached key, and
AGENTSWAP_RPC_URL_<chainId> or AGENTSWAP_RPC_URL to override the V6 RPC endpoint.