DEV Community

Navaneeth B
Navaneeth B

Posted on

Building Mathondu: How We Built an Autonomous AI Merchant & Store Factory with Google ADK, Gemini 3.5, and Cloud Run

Disclosure: I created this piece of content for the purposes of entering the Google All Things Agentic Hackathon on Devpost.

๐ŸŒŸ The Problem: Why Small Commerce Needs Autonomous Agents, Not Just Chatbots

Millions of small merchants, home bakers, and neighbourhood store owners across India run their daily business through WhatsApp and UPI.

While messaging works for basic conversations, scaling a business through chat breaks down quickly:

  • Manually typing 50+ catalog items with prices, variants, and descriptions can take hours.
  • Regional shop signs and informal receipts in languages like Kannada and Hindi are poorly supported by many standard SaaS tools.
  • Flat $30/month subscriptions + 2โ€“5% transaction fees can destroy the narrow margins of micro-retailers.

We built mathondu (เฒฎเฒคเณเฒคเณŠเฒ‚เฒฆเณ โ€” "Another One") to eliminate this friction entirely.

Our goal was simple:

Build an agent that doesn't just talk about opening a store, but actually creates the digital shop, photographs products, compiles an installable Android app, and automates WhatsApp orders end-to-end.


๐Ÿ—๏ธ System Architecture: Google ADK + Serverless GCP

Rather than building a single monolithic prompt, we leveraged the Google Agent Development Kit (ADK) to coordinate a fleet of specialized sub-agents with strict domain boundaries.

                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ Merchant Photos /        โ”‚
                         โ”‚ WhatsApp Text            โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ onboard_orchestrator     โ”‚
                         โ”‚      (Google ADK)        โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                       โ”‚                       โ”‚
              โ–ผ                       โ–ผ                       โ–ผ
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚ store_extract_  โ”‚     โ”‚ product_data_   โ”‚     โ”‚ missing_fields_ โ”‚
     โ”‚ agent           โ”‚     โ”‚ agent           โ”‚     โ”‚ agent           โ”‚
     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
              โ”‚                       โ”‚                       โ”‚
              โ–ผ                       โ–ผ                       โ–ผ
       Gemini 3.5 Flash Lite   Gemini 3.5 Flash Lite   Gemini 3.5 Flash Lite

                                      โ”‚
                                      โ–ผ
                         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                         โ”‚ catalog_image_agent      โ”‚
                         โ”‚ Gemini 3.1 Flash Lite    โ”‚
                         โ”‚ Image                    โ”‚
                         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ”‚
                                      โ–ผ
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚ Firebase Storage + Firestore    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚
                 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                 โ”‚                                     โ”‚
                 โ–ผ                                     โ–ผ
      โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
      โ”‚ Cloud Run APK Worker   โ”‚          โ”‚ WhatsApp Cloud API     โ”‚
      โ”‚                        โ”‚          โ”‚                        โ”‚
      โ”‚ Bubblewrap TWA Builder โ”‚          โ”‚ Inbound Webhooks       โ”‚
      โ”‚ Android SDK            โ”‚          โ”‚ Orders & Alerts        โ”‚
      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Enter fullscreen mode Exit fullscreen mode

๐Ÿค– The Multi-Agent Ingestion Pipeline

When a merchant sends messy photos of handwritten paper menus, receipts, or shelf items, our pipeline processes the information through specialized ADK agents.

onboard_orchestrator

The top-level ADK agent coordinates the entire onboarding workflow.

It delegates specialized tasks to sub-agents, validates their outputs, and commits the verified merchant state to Cloud Firestore.

store_extract_agent

Uses Gemini 3.5 Flash Lite to extract important business information such as:

  • Business name
  • Operating hours
  • Delivery radius
  • Currency units
  • Store metadata

product_data_agent

Converts messy product information into structured schemas, including:

  • Product names
  • Categories
  • Prices
  • Variant options
  • Variant-specific pricing

missing_fields_agent

Analyzes the extracted store data to identify missing critical information.

Instead of asking the merchant for everything at once, it generates targeted follow-up questions only for the information that is actually required.

catalog_image_agent

When product images are missing or unusable, this agent generates high-resolution square catalog photography using Gemini 3.1 Flash Lite Image.

This allows merchants to create professional-looking catalogs without hiring a photographer or manually editing every product image.


๐Ÿ“ฆ The Deliverables Factory: Generating Real Artifacts

Most AI prototypes stop after returning a text response.

mathondu doesn't.

The system turns merchant input into real, usable business assets:

  • ๐ŸŒ PWA storefront
  • ๐Ÿ“„ Branded PDF catalog
  • ๐Ÿ“ฑ Custom Android APK
  • ๐Ÿ’ฌ WhatsApp ordering experience

The goal is simple:

The agent shouldn't just tell the merchant what to do. It should do it.


๐Ÿ“ฑ 1. On-Demand Android APKs via Cloud Run

Indian merchants frequently ask for "their own app on the customer's phone."

To support this, we built an asynchronous Android compilation worker running on Google Cloud Run.

The workflow is:

Merchant clicks "Get Android APK"
              โ”‚
              โ–ผ
       Firestore apkJobs
              โ”‚
              โ–ผ
      Cloud Run Worker
              โ”‚
              โ–ผ
   Bubblewrap + Android SDK
              โ”‚
              โ–ผ
      Custom TWA APK
              โ”‚
              โ–ผ
      Firebase Storage
              โ”‚
              โ–ผ
   Secure download link
        + install QR
Enter fullscreen mode Exit fullscreen mode

When a merchant requests an APK:

  1. A build job is added to the Firestore apkJobs queue.
  2. A dedicated Cloud Run container picks up the job.
  3. Bubblewrap CLI compiles the merchant's Trusted Web Activity (TWA).
  4. The Android binary is signed.
  5. The .apk is uploaded to Firebase Storage.
  6. The merchant receives a secure 7-day download link and installable QR code.

Each merchant receives a tenant-specific package identifier such as:

com.mathondu.s.{slug}
Enter fullscreen mode Exit fullscreen mode

This architecture keeps Android compilation completely separate from the primary web application.


๐Ÿ’ฌ 2. WhatsApp Cloud API Conversational Commerce

Customers can interact with a merchant directly through WhatsApp.

WhatsApp Demo

+91 94621 46133

Customers can send:

Hi, shop {slug}
Enter fullscreen mode Exit fullscreen mode

The WhatsApp commerce engine then provides an interactive shopping experience.

It handles:

  • Interactive catalog messages
  • Cart modifications
  • Customer session state
  • Live order placement

Customer sessions are persisted in Cloud Firestore, allowing the system to maintain cart and conversation state across webhook requests.

Real-time order events then alert the seller with direct links to the admin console.

The result is a complete commerce loop:

Browse โ†’ Add to Cart โ†’ Place Order โ†’ Merchant Alert

โ€”all without requiring the customer to install another shopping application.


๐Ÿ›ก๏ธ 3. Human-in-the-Loop Shop Assist

To prevent silent catalog corruption, our admin_manager_agent follows a strict:

Proposal โ†’ Review โ†’ Accept

pattern.

For example, if an owner asks:

"Discount all bakery items by 10%."

The agent does not immediately modify the database.

Instead, it:

  1. Identifies the affected products.
  2. Calculates the proposed changes.
  3. Generates a diff card showing what will change.
  4. Presents the proposal to the merchant.
  5. Waits for explicit Accept confirmation.
  6. Only then performs the database mutation.

This gives merchants the speed of an AI agent while preserving human control over critical business data.


๐Ÿ’ป Tech Stack Overview

Layer Technology
AI Framework Google ADK 2.x
AI Models Gemini 3.5 Flash Lite, Gemini 3.1 Flash Lite Image, Gemma fallback
Frontend / PWA Next.js 15, App Router, React, Tailwind CSS
Backend / Hosting Firebase App Hosting, Cloud Run
Secrets Google Cloud Secret Manager
Database Cloud Firestore
Storage Firebase Storage
APK Worker Docker, Cloud Run, Node.js, Android SDK, Bubblewrap
Messaging WhatsApp Cloud API (Meta)

๐Ÿง  How the Agent Architecture Works

The key architectural decision was to avoid one giant AI prompt.

Instead, mathondu uses specialized agents with bounded responsibilities.

                    Merchant Input
                  Images / Text / Voice
                          โ”‚
                          โ–ผ
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚ onboard_orchestrator  โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ”‚               โ”‚                โ”‚
          โ–ผ               โ–ผ                โ–ผ
    Store Extract    Product Data    Missing Fields
       Agent            Agent             Agent
          โ”‚               โ”‚                โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                          โ–ผ
                 Catalog Image Agent
                          โ”‚
                          โ–ผ
                 Verified Store Data
                          โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚                       โ”‚
              โ–ผ                       โ–ผ
        Storefront + PDF          Android APK
              โ”‚                       โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                          โ”‚
                          โ–ผ
                  WhatsApp Commerce
                          โ”‚
                          โ–ผ
                    Real Orders
Enter fullscreen mode Exit fullscreen mode

Each agent produces structured output that can be validated before being passed to the next stage.

This makes the overall system more predictable than relying on a single general-purpose prompt.


๐Ÿงฉ Challenges We Faced

1. Multilingual Extraction and Hallucination

Indian commerce data is rarely clean.

A single shop sign can contain:

  • Kannada text
  • Hindi text
  • English product names
  • Informal abbreviations
  • Regional terminology
  • Different pricing conventions

A monolithic prompt frequently misinterpreted currency units, dropped variants, or incorrectly structured product information.

We solved this by decomposing the pipeline into specialized ADK agents with:

  • Strict JSON schemas
  • Narrow domain responsibilities
  • Explicit validation boundaries
  • Reusable domain skill definitions

Our onboarding skills live under:

frontend/skills/onboard/
Enter fullscreen mode Exit fullscreen mode

This reduced the blast radius of extraction errors and made individual stages easier to debug.


โš™๏ธ 2. Long-Running APK Builds on Serverless Infrastructure

Building an Android TWA with the Android SDK and Bubblewrap is significantly heavier than a normal web request.

The build can require 2 GiB or more of memory and take approximately 10โ€“40 seconds, depending on the build environment.

Running this directly inside a normal Next.js request would make the user wait and could exceed request execution limits.

We solved this with an asynchronous job architecture:

Next.js API
     โ”‚
     โ–ผ
Firestore apkJobs
     โ”‚
     โ–ผ
Cloud Run Worker
     โ”‚
     โ–ผ
Bubblewrap + Android SDK
     โ”‚
     โ–ผ
Signed APK
     โ”‚
     โ–ผ
Firebase Storage
Enter fullscreen mode Exit fullscreen mode

The user-facing application remains responsive while the heavy build runs independently.


๐Ÿ’ฌ 3. Multi-Turn WhatsApp Session State

WhatsApp webhook events are stateless from the perspective of our application.

However, a commerce conversation requires persistent state:

  • Customer identity
  • Current shop
  • Cart contents
  • Selected variants
  • Conversation state
  • Order status
  • Session expiration

We implemented a deterministic state machine backed by Firestore transactions.

This allows concurrent webhook events to safely update cart and order state without race conditions.

It also allows us to manage WhatsApp's 24-hour customer service window constraints.


๐Ÿ’ก Key Learnings from Building with Gemini & ADK

1. Specialized Agents Beat Monolithic Prompts

Our biggest AI architecture lesson was that one powerful model does not mean one giant prompt.

By isolating:

  • Extraction
  • Product structuring
  • Missing-field detection
  • Image generation
  • Administrative operations

into specialized ADK agents, we gained better control over each stage of the workflow.

This was especially important for multilingual Indian commerce data.


2. Asynchronous Architecture Keeps Interfaces Fast

Agentic applications often combine lightweight interactions with heavyweight background operations.

APK compilation, image generation, and PDF generation can take significantly longer than a normal conversational response.

Moving these operations into asynchronous Cloud Run workers allowed us to keep the main application responsive while still producing complex deliverables.


3. Agents Should Ship Assets, Not Just Conversation

The most important lesson we learned is:

The value of an agent is measured by what it accomplishes, not just what it says.

A conversational response saying:

"You should create an online store."

is useful.

But an agent that actually produces:

  • An installable .apk
  • A live storefront
  • A branded .pdf catalog
  • Generated product photography
  • A working WhatsApp ordering flow
  • Verified database records

is dramatically more useful.

Don't just make the agent answer. Make the agent ship.


๐Ÿš€ Why This Matters

mathondu is designed around a simple observation:

Small merchants shouldn't need to become software administrators to get the benefits of digital commerce.

They already know how to:

๐Ÿ“ธ Take a photo
๐ŸŽ™๏ธ Send a voice note
๐Ÿ’ฌ Use WhatsApp
๐Ÿ’ฐ Accept UPI payments

mathondu turns those familiar actions into a complete digital commerce workflow.

             Photo / Voice / Text
                     โ”‚
                     โ–ผ
              Google ADK Agents
                     โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ–ผ          โ–ผ          โ–ผ
       Store      Catalog      Images
       Data        Data       + Assets
          โ”‚          โ”‚          โ”‚
          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ–ผ
             Digital Store
                     โ”‚
          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
          โ–ผ          โ–ผ          โ–ผ
        PWA        Android    WhatsApp
       Store         App       Orders
                                โ”‚
                                โ–ผ
                         Real Merchant
                            Orders
Enter fullscreen mode Exit fullscreen mode

๐Ÿ”— Try It Live

๐ŸŒ Live Platform

https://mathondu.com

๐Ÿš€ AI Onboarding Demo

https://mathondu.com/onboard

๐Ÿ’ฌ WhatsApp Demo

Message:

+91 94621 46133

Try:

Hi, shop {slug}
Enter fullscreen mode Exit fullscreen mode

๐Ÿ† Built for the Google #AllThingsAgenticHackathon

mathondu turns messy merchant input into a complete digital commerce business โ€” powered by autonomous AI agents.

๐Ÿ“ธ Photos / Voice / Text

โ†“

๐Ÿค– Google ADK Multi-Agent Pipeline

โ†“

๐ŸŒ Storefront + Catalog + Product Images

โ†“

๐Ÿ“ฑ Custom Android APK

โ†“

๐Ÿ’ฌ WhatsApp Commerce

โ†“

๐Ÿ›๏ธ Real Orders

If a merchant can send a photo or a voice note, mathondu should be able to build the store.


Built for the Google #AllThingsAgenticHackathon.

Top comments (0)