TRANSFER_REQUIRE_CONFIRMATION=true (default), Uniswap swaps follow the same human-in-the-loop pattern as native transfers: the agent prepares an unsigned quote, the user reviews details in chat, then Confirm or Cancel.
The env var name is shared with transfers (
TRANSFER_REQUIRE_CONFIRMATION). Set it to false only when you want auto-sign for both transfers and swaps.Flow
Chat UI
The sample web app renders a Swap confirmation card with:
Buttons: Confirm (sign + broadcast) and Cancel (discard pending swap).
Pending swaps expire after
PENDING_SWAP_TTL_MINUTES (default 15, max 60).
REST API
Base path: your agentic-ai API (sample:/agents).
Confirm response (success):
SSE events
During chat streaming, the backend emits:
Message metadata persists
swapPending so history reloads the card without re-parsing markdown.
Environment variables
Implementing in your app
Mirror the sample web app:- Parse
swapPendingfrom assistant message metadata (or markdown fallback). - Render a confirmation card with sell/buy/network rows.
- On Confirm,
POST …/swaps/:pendingId/confirmwith the user JWT. - Show
swapTxHashwith a block explorer link.
Related
- Uniswap integration — API key and
uniswap_swap_quote - Interaction policies — block swaps that violate rules (-32404)