Gateway for AI Agents
Gateway is the best swaps engine for native BTC. It supports a growing set of assets and chains — rungateway-cli routes --json to see what is available.
The Gateway CLI makes that engine available to any AI agent that can run a shell command. No SDK to bind, no language to match, no service to host. A Python agent, a TypeScript agent, a shell script, or a scheduled job can all call the same interface and get structured output back.
What your agents can do
Swap native BTC across chains
Swap BTC to and from ETH, USDC, USDT, WBTC, cbBTC, DAI, PAXG, XAUt, and more — across Ethereum, Base, BSC, Arbitrum, Avalanche and other major chains.
No routing logic needed
Gateway handles solver liquidity, cross-chain settlement, and on-chain verification. Your agent just calls
quote and swap.Quote before committing
Get real-time quotes with slippage, fees, and the exact receive amount before the agent executes anything.
Sign nothing — or sign everything
Return unsigned PSBTs or EVM transactions and pass them to your own signer. Or sign inside a trusted sandbox and track settlement asynchronously.
Who this is for
Agent developers
Building autonomous agents in Python, TypeScript, or any language that can shell out. The CLI gives you a clean tool interface without writing a Gateway SDK wrapper yourself.
Framework builders
Adding Bitcoin swap capabilities to an agent framework (LangChain, LlamaIndex, AgentKit, or your own). Wrap the CLI in a tool function and expose it to the model.
Teams building agentic DeFi
Agents that allocate capital, execute yield strategies, or rebalance across chains — and need to touch native BTC as part of those workflows.
MCP builders
The CLI is a clean blueprint for an MCP server. Wrap it once and the same BTC swap tool works across every MCP client.
Why the CLI is a good agent tool
Agents call tools and read structured output. The Gateway CLI is built around that interface. None of this is an AI feature — it is good CLI design, which turns out to be most of what an agent needs.JSON on every command
JSON on every command
Add
--json to any quote, swap, balance, routes, or status call and get structured output. Errors come back structured too — an agent can branch on a failure instead of parsing prose.Unsigned by default when you need it
Unsigned by default when you need it
The
--unsigned flag returns an unsigned Bitcoin PSBT or EVM transaction and stops. The agent never holds a key. It passes the payload to whatever signer or policy layer you trust, and that layer decides whether to sign.Fire and forget
Fire and forget
--no-wait submits a swap and returns an order ID instead of blocking until settlement. The agent moves on; your polling loop checks status separately.Amounts in dollars
Amounts in dollars
--amount 100USD resolves to the correct amount of BTC at the current price. “Move a hundred dollars of Bitcoin to Base” maps almost word-for-word onto a command.Config from the environment
Config from the environment
Keys and endpoints come from environment variables. No config file left behind — the right way to inject secrets into a sandbox or container.
The agent loop
An agentic swap follows a consistent pattern: discover what is possible, get a quote, decide, then settle.Discover available routes
The agent queries available routes so it isn’t guessing at assets or chains.
Get a quote
Slippage, fees, and the real receive amount become visible here. The agent should always quote before committing.
Settle — without handing over a key
Return an unsigned transaction and pass it to your signer:Or, if the CLI is running inside a trusted sandbox, submit and move on:
If an agent submits a transaction outside of the CLI (e.g. via a custom signer) and needs to register it for tracking, use
gateway-cli register <order-id> <txid> --json. This is the recovery path for agents that handle signing separately.Expose Gateway to a model
Wrapping the CLI in a tool takes a few lines. Here is a minimal Python example:quote and status tools and the loop runs itself. The agent quotes, reasons about the result, requests an unsigned swap, your signer approves, and the agent tracks settlement to completion. “Swap $100 of BTC to USDC on Base” becomes a sequence of tool calls with a signature you control in the middle.
Example: the Gateway starter bot
The gateway-starter-bot is a minimal, educational example of a trading bot built entirely on the Gateway CLI. It’s a single bash script that demonstrates the full agent loop in a real strategy. The bot executes a “buy the dip” round-trip:- Onramp — swap BTC → USDT on Ethereum.
- Watch — poll the reverse quote (USDT → BTC) until BTC gets cheaper.
- Buy the dip — swap USDT → BTC, ending with more sats than it started with.
gateway-cli ... --json piped through jq. Read dip-bot.sh top to bottom — that’s the whole thing.
gateway-starter-bot on GitHub
Educational “buy the dip” bot — a single bash script. Read it, run it, adapt it.
BOB Gateway integration paths
The CLI is the fastest path into BOB Gateway, not the only one. The same engine is available through multiple surfaces:| Path | Best for |
|---|---|
| Gateway CLI | Any agent that can shell out. Zero binding, works in any language, fastest to prototype. |
| Gateway SDK | Agents built in TypeScript or Node. Type-safe, same swap engine, suitable for production web services. |
| Gateway API | Any language, server-to-server. Full control over request/response handling. |
| MCP server | Agents using the Model Context Protocol. Wrap Gateway once and it works across every MCP client. |
Install and try it
BOB Gateway CLI on GitHub
Source code, installation, and full command reference.
BOB Gateway docs
Integration guides, supported routes, and SDK reference.
API reference
Use the REST API directly from your agent.
Discord
Show us what you build.