---
title: "From Chat to Chain: Building A Production Multi-Agent AI for Web3"
description: "Web3 UX is a nightmare of seed phrases, gas calculations, and bridge protocols. But what if AI agents could handle the complexity while users just describe what they want? Here's how we architected Ask Gina's multi-agent system to execute real transactions through conversation."
canonical: "https://blog.askgina.ai/posts/from-chat-to-chain-building-production-multi-agent-ai-web3"
---

# From Chat to Chain: Building A Production Multi-Agent AI for Web3

[HTML version](https://blog.askgina.ai/posts/from-chat-to-chain-building-production-multi-agent-ai-web3)

Published September 1, 2025 · Cesar Pantoja

*Ever tried explaining gas fees to your grandma? Or helped a friend bridge tokens across chains? Web3 UX is broken - but what if AI could fix it?*

## Introduction: Web3's UX Crisis

Picture this: Your grandma wants to send you some crypto for your birthday. You spend the next hour explaining gas fees, wallet addresses, and why she needs ETH to send USDC. By the end, she's writing you a check instead.

![Confused Grandma meme](https://blog.askgina.ai/blog/images/confused_grandma.png)

*"What is a seed phrase and how do I plant it in my garden?" - Grandma, probably (Disclaimer: I'm a dad so I'm allowed to make dad jokes)*

Or maybe you're a developer, supposedly fluent in Web3, yet you still break into a cold sweat when you need to bridge tokens across chains. Which bridge is cheapest? Is it safe? Will your tokens arrive? Even for us "experts," Web3 UX just isn't fun.

The truth is brutal: **Web3's user experience is so broken that it's keeping billions of people from participating in the financial revolution we've been promising.**

But here's the thing - the complexity isn't going away. Blockchains need gas fees for security. Bridges need multiple confirmations for safety. Smart contracts need precise interactions to function. The infrastructure demands this complexity.

What if, instead of simplifying the infrastructure, we abstracted it entirely?

What if users could just say: "Send $50 to mom" or "Buy me some Bitcoin when it drops 10%" or "Move my tokens to where the yield is highest"?
![Ask Gina chat: "Send $50 to mom", answered by preparing the transaction and looking up mom's address in the address book](https://blog.askgina.ai/blog/images/send_to_mom.png)
![Ask Gina chat: "Buy me some Bitcoin when it drops 10%", answered by creating a recipe to buy $100 of BTC when the price drops 10% or more](https://blog.askgina.ai/blog/images/buy_bitcoin.png)
![Ask Gina chat: "Move my tokens to where the yield is highest", answered by researching the current yields of lending pools](https://blog.askgina.ai/blog/images/move_yield.png)

This is the promise of AI agents in Web3: not to eliminate complexity, but to handle it for you. At Ask Gina, we've built exactly this - a production multi-agent AI system that transforms natural language into on-chain actions. No seed phrases to memorize, no gas calculations, no bridge comparisons. Just conversation and execution.

In this post, I'll show you how we architected this system, the brutal lessons we learned in production, and the patterns you can steal for your own AI + Web3 applications. This isn't theoretical - it's battle-tested code handling real money for real users every day.

## The Multi-Agent Architecture

One AI agent wasn't enough. Different domains require different expertise, and a monolithic agent would consume tens of thousands of tokens just in system prompts - leaving no room for actual conversation.

We built a multi-agent system where each agent owns a specific domain. Let's assume we have the following agents:

**1. Execution Agent**: The main powerhouse - handles portfolio analytics, transaction execution, and complex operations.

**2. Automation Agent**: Manages scheduled tasks and recurring workflows like periodic investments or alerts.

**3. Research Agent**: Analyzes data queries, market trends, provides insights, and performs deep data analysis.

**4. Support Agent**: Handles user questions, provides guidance, and assists with platform navigation.

*Note: Our agent roster is constantly evolving as we develop new features and integrate new models. We add, merge, and refine agents based on user needs and capabilities.*

### The Router: Intelligent Traffic Control

How do you decide which agent handles a user's message? We use a fast, cost-effective language model as an intelligent router:

```
function routeMessage(userMessage) {
  intent = analyzeIntent(userMessage)
  
  agent = switch(intent.type) {
    case "transaction":
      ExecutionAgent()
    case "schedule":
      AutomationAgent()
    case "analysis":
      ResearchAgent()
    default:
      SupportAgent()
  }
  
  response = agent.process(userMessage)
  stream(response, user)
}
```

The router model analyzes user intent and context to select the appropriate specialist. It's optimized for speed (sub-100ms decisions) and cost-efficiency, processing millions of routing decisions monthly. The routing accuracy improves continuously through feedback loops and model fine-tuning. For more technical details on our routing architecture, see [Building Gina's Army: Technical Notes](https://blog.askgina.ai/posts/building-gina-army-technical-notes).

## Streaming AI Responses During Blockchain Operations

One of our core challenges: How do you stream AI responses while orchestrating multi-step blockchain operations that might take 30+ seconds?

The solution: A messaging pattern with real-time streaming to the frontend.

### The Architecture

```mermaid
sequenceDiagram
    participant User
    participant Frontend
    participant API
    participant MessageBus
    participant BackgroundJob
    participant Agent

    User->>Frontend: Send message
    Frontend->>API: POST /chat
    API->>API: Create stream
    API->>MessageBus: Subscribe to channel
    API->>BackgroundJob: Trigger processing
    API-->>Frontend: Open stream connection
    
    BackgroundJob->>Agent: Route & process
    Agent->>MessageBus: Publish chunks
    MessageBus-->>API: Forward chunks
    API-->>Frontend: Stream data
    Frontend-->>User: Display response
    
    Agent->>MessageBus: Send complete signal
    MessageBus-->>API: Close stream
    API-->>Frontend: End connection
```

### Background Processing

The background job engine handles the actual AI processing with durability and retries:

```mermaid
stateDiagram-v2
    [*] --> Loading: Job Started
    Loading --> Processing: Load Context
    Processing --> Streaming: Agent Selected
    Streaming --> Streaming: Chunk Published
    Streaming --> Complete: Stream Finished
    Complete --> [*]
    
    Processing --> Error: Processing Failed
    Error --> Retry: Retry Available
    Error --> Failed: Max Retries
    Retry --> Processing
    Failed --> [*]
```

### Resumable Streams

A critical feature for production - users can reconnect after network interruptions. The system maintains stream state to handle reconnections gracefully.

Imagine you're on the subway, asking Gina to do a deep dive on a new token that's trending. The research might take 30+ seconds - analyzing on-chain data, social sentiment, holder distribution, and more. Your train goes into a tunnel and you lose connection. No problem - Gina keeps working in the background. When you reconnect at the next station, you pick up right where the analysis left off. Or close the app entirely and come back an hour later - your research will be waiting for you, completed while you were away.

```mermaid
flowchart LR
    A[Client Connection] --> B{Stream Exists?}
    B -->|No| C[Create New Stream]
    B -->|Yes| D[Resume from Position]
    C --> E[Store Stream State]
    D --> E
    E --> F[Continue Streaming]
    F --> G[Update Position]
    G --> F
```

### The Result

With this architecture, users experience:
- Immediate AI responses while blockchain operations execute
- Seamless reconnection after network interruptions (thanks to resumable streams)
- Real-time updates as transactions progress through their lifecycle
- Reliable execution with automatic retries, failure handling, and graceful degradation
- Operations that complete even if the user closes their browser - background jobs persist and execute durably

The user types "swap my ETH," and immediately sees the AI thinking, fetching rates, and executing - all while the actual blockchain operations work in the background.

## Automated Execution: Recipes and Scheduled Prompts

Beyond one-off interactions, users want automation: 
- "Buy 0.1 ETH every Monday at 13:00"
- "Send me news updates relevant to my portfolio every day at 9am"
- "Check my portfolio in 2 days and suggest actions to de-risk it"
- "FED FOMC TALK at 7 PM today, 30 minutes after that, check if Altcoins are up. If up, buy $100 of the top 5 trending tokens"

We built a recipe system powered by a durable background execution engine.

### The Recipe Architecture

Each scheduled execution runs as an isolated background job:

```mermaid
flowchart TD
    A[Scheduled Trigger] --> B[Load Task]
    B --> C{Validate}
    
    C -->|Valid| D[Create Session]
    C -->|Invalid| E[Skip Execution]
    
    D --> F[Execute Task]
    F --> G{Process Result}
    
    G -->|Success| H[Update Counters]
    G -->|Failure| I[Retry Logic]
    
    I -->|Retry| F
    I -->|Max Retries| J[Alert User]
    
    H --> K[Check TTL]
    K -->|Active| L[Schedule Next]
    K -->|Expired| M[Disable Schedule]
    
    L --> N[Complete]
    M --> N
    J --> N
    E --> N
```

### The User Experience

From the user's perspective, it's simple:
1. "Schedule this" → Natural language converted to cron
2. Executions run in new chat threads automatically
3. Get notifications on success/failure
4. View history and adjust schedules anytime

Behind the scenes, we handle timezone conversions, DST transitions, retries, and all the complexity of reliable automation.

### The Power of Wallet-Connected Automation

One of the unique benefits of recipes on your wallet is that you can combine workflows that involve research and execution of actual transactions. This enables a ton of broad use cases that involve moving funds autonomously based on user-specified logic (via natural language) - including auto rebalancing of portfolio, catching trending token moves systematically, DCA or TWAP buys/sells, and more!

## Conquering Multi-Chain Chaos

Web3's multi-chain reality is painful - different wallets, gas tokens, transaction formats. Users shouldn't need a PhD in blockchain to swap tokens.

Our solution uses smart account abstraction for EVM chains and cross-chain relay protocols for seamless swaps. This creates true chain abstraction across EVM chains and Solana.

### Supertransactions: One Signature, Multiple Chains

We batch operations across chains into a single "supertransaction". Let's say for example you wanted to move some ETH on Base to USDT on Ethereum mainnet. With supertransactions, Gina does this for you on a single composed step. And you can even pay for the gas fees on a separate chain, and using any of the supported tokens - not just native tokens:

```
supertransaction = {
  operations: [
    {
      chain: "base",
      action: "swap",
      params: { from: "ETH", to: "USDC", amount: 100 }
    },
    {
      chain: "base", 
      action: "bridge",
      params: { token: "USDC", toChain: "ethereum" }
    },
    {
      chain: "ethereum",
      action: "swap",
      params: { from: "USDC", to: "USDT" }
    }
  ],
  gasPayment: {
    token: "USDC",
    chain: "base"
  }
}

// User signs once
signature = await user.sign(supertransaction)

// Execute all operations atomically
executeSupertransaction(supertransaction, signature)
```

Users execute complex multi-chain operations with a single signature and pay gas in any token they hold. The complexity of bridges, chain selection, and gas management disappears entirely.

## Conclusion: The Future of Web3 UX

> We started with a simple observation: Web3 UX is broken. Not slightly inconvenient - fundamentally, catastrophically broken. The solution wasn't to simplify the technology (we can't) or educate users (they shouldn't have to). The solution was to build an intelligence layer that handles the complexity for them.

### What We've Proven in Production

After thousands of messages and transactions, we've validated our architectural decisions:

**1. Fast Router Models Deliver**

Our sub-100ms average routing latency proves you don't need expensive models for intelligent routing. At minimal cost per token, we're routing millions of messages monthly for negligible expense. The multi-agent architecture with specialized domains maintains context efficiency while delivering expertise.

**2. Streaming Architecture Works at Scale**

Our messaging architecture eliminates race conditions while maintaining sub-50ms first token times. Combined with durable background execution and resumable streams, users experience seamless interactions even through network interruptions and 60-second blockchain confirmations.

**3. Unified Multi-Chain Execution is Possible**

Smart account abstraction for EVM chains paired with cross-chain relay protocols creates true chain abstraction. Users execute supertransactions across Base, Ethereum, Polygon, Arbitrum, Optimism, BNB, and Solana - paying gas in any token they hold. Cross-chain swaps happen optimally without users knowing bridges exist.

**4. Automation Through Natural Language Scales**

Our recipe system converts "Buy ETH every Monday" into reliable scheduled background jobs with TTL controls and isolated execution contexts. Each automation runs in its own session with full conversation history, making complex DeFi strategies accessible through simple prompts.

### The Bigger Picture

What we're building at Ask Gina is more than a chatbot that can swap tokens. It's a bridge between human intent and blockchain capability. It's making the decentralized web accessible to everyone, not just the technically sophisticated.

The infrastructure of Web3 - the blockchains, smart contracts, and cryptographic primitives - that's the foundation. But the interface? That needs to be as natural as conversation.

We've shown it's possible. We've built it. We're running it in production. And we're just getting started.

### Try It Yourself

Ready to experience AI-powered Web3? Here's what you can do with Ask Gina today:

- **Research Any Token**: Get real-time prices, charts, and deep on-chain analytics through natural conversation
- **Top Up Your Wallet**: Fund your smart account with USDC or any supported token - Gina handles the rest
- **Execute Transactions**: Swap tokens, bridge across chains, or send funds with simple commands like "swap my ETH for USDC" 
- **Schedule Recipes**: Set up automations like "buy $100 of ETH every Monday" or "alert me when gas drops below 10 gwei"

The system is live, handling real transactions for real users. Try it, break it, push its limits.

### Give Us Feedback

We're building this in public and need your input. Found a bug? Have a feature request? Want to contribute?

Reach out to the dev team:
- [@chpanto](https://twitter.com/chpanto)
- [@ericjuta](https://twitter.com/ericjuta)  
- [@sidshekhar24](https://twitter.com/sidshekhar24)
- [@0xashrk](https://twitter.com/0xashrk)

Remember, the future of Web3 isn't about making users understand blockchain.

It's about making blockchain understand users.

And with AI agents as interpreters, we're finally speaking the same language.
