AI agent that lets you swap tokens & analyze Uniswap pools through natural language chat.
UniAgent is a conversational DeFi assistant built on the Uniswap API and Claude AI. Instead of navigating complex DeFi interfaces, users simply type what they want "swap 1 ETH for USDC" or "what's the best yield pool for stablecoins?" and the agent handles everything.
Under the hood, Claude acts as the reasoning layer, deciding which Uniswap API calls to make, fetching real-time quotes, pool TVL, fee tiers, APY, and price ranges, then presenting the data as actionable swap cards the user can execute onchain with one click. The agent can chain multiple tool calls autonomously : checking price, then gas, then recommending optimal timing before responding.
Built with Next.js 14 and Tailwind CSS on the frontend. The AI layer uses Claude claude-sonnet-4-20250514 with tool use enabled , we defined three tools (get_swap_quote, get_top_pools, get_pool_stats) that Claude autonomously calls based on user intent.
The Uniswap Quote API v1 powers all swap routing, proxied through a Next.js API route to handle CORS. Pool analytics come from the Uniswap v3 subgraph on The Graph. The agentic loop in lib/agent.ts keeps running until Claude stops calling tools, enabling multi-step reasoning like: fetch quote → check gas → suggest timing.
The trickiest part was parsing Claude's structured JSON tool responses and mapping them to typed swap/pool card components in real time, while keeping the chat UX feel instant and fluid.

