
I built a cross-chain swap SDK for AI agents (MCP-native, handles cold start gas automatically)
I needed to swap 0.003 ETH (on Base) to MYST tokens (on Polygon) for an AI agent I was building. Simple enough, right? Two hours later, I had manually: Found the best DEX route on Paraswap Realized I had no POL on Polygon for gas — so the bridged USDC was stuck Manually sent POL from another wallet Set amountOutMin wrong and got sandwiched Fumbled the slippage config and the tx reverted There was no single tool that handled all of this. So I built one. What is AutoSwap? AutoSwap is a cross-chain swap SDK built specifically for AI agents. It wraps the entire swap pipeline — DEX routing, bridging, native gas resolution, and slippage protection — into a single function call . from autoswap import swap result = swap ( from_token = " ETH " , from_chain = " base " , to_token = " MYST " , to_chain = " polygon " , amount = 0.003 , slippage_max = 2.0 , dry_run = True , # simulate first — always ) print ( result . route_taken ) # → "ETH→USDC (base) | bridge USDC base→polygon | USDC→MYST (polygon
Continue reading on Dev.to Python
Opens in a new tab


