π³ CookWithMe: Multi-Agent Multimodal Grocery Assistant
π‘ Inspiration
Anyone whoβs tried cooking after a long day knows the drill: find a recipe, open Blinkit or Zepto, search each ingredient one by one, compare pack sizes and prices, and finally checkout β only to find some items out of stock.
The friction isnβt logistics β itβs cognitive load. CookWithMe asks a simple question: what if you could just say "make pav bhaji for 4" and come back to a full cart?
Indiaβs quick-commerce ecosystem (10β30 min delivery, rich SKU catalogues) is the perfect playground. Geminiβs multimodal reasoning β understanding screenshots, UI context, and clicks β makes this agent possible.
π What It Does
CookWithMe is a conversational, multimodal shopping agent. You talk in plain English (or Hinglish), and it shops for you.
Typical session:
- You type:
"Make butter chicken for 4 people" - CookWithMe parses intent, expands the recipe into an ingredient list, and asks for confirmation.
- You select platform: Blinkit, Zepto, or both.
- The agent shops: searches, reads screenshots, selects best products & pack sizes, clicks Add, verifies success, and moves to next item.
- Self-correction handles unavailable items, wrong pages, or missing products.
- You get a live cart summary: items, quantities, prices, fees, and serviceability status.
Key capabilities:
- Natural language β structured shopping list
- Recipe expansion with per-serving quantity math
- Multimodal Gemini vision for product selection & UI interaction
- Pack-size reasoning for exact quantities
- Substitution for unavailable items
- Cross-platform comparison with full fee breakdown
- Live progress streaming via SSE
- Session persistence & personalization
π How I Built It
Architecture: Multi-Agent, Vision-First
| Agent | Responsibility |
|---|---|
| IntentParserAgent | Free-text β structured shopping intent |
| RecipeExpanderAgent | Recipe + servings β full ingredient list |
| FusedVisionAgent | Screenshots β page state, product selection, ADD button, quantity plan |
| SubstitutionAgent | Finds best recipe-compatible alternatives |
| CoreLoop | Orchestrates search β analyse β click β verify β self-correct |
Vision Loop (per item)
search results screenshot
β
βΌ
FusedVisionAgent.analyse()
β page_state
β selected_product + pack_size
β combination_plan (units needed)
β add_button_x_norm, add_button_y_norm
β
βΌ
BrowserManager.click_add_button() β DOM-first, vision coords as fallback
β
βΌ
FusedVisionAgent.verify_add() β before/after screenshot comparison
β success? stepper appeared? cart badge incremented?
β
if failed:
βΌ
_self_correct_add()
β go_back if navigated to product page
β re-analyse to get fresh coordinates
β retry with DOM click
π Technology Stack
- Gemini 3.1 Flash Lite β vision & text reasoning
- Google Gen AI Python SDK β async wrapper, rate limiting
- Playwright β headless Chrome automation
- FastAPI + uvicorn β WebSocket + SSE dashboard
- Pydantic v2 β strict typed models
- structlog β structured logs for all agent decisions
- Docker + noVNC β containerised browser for demo & Google Cloud for deployment
β‘ Challenges
- π Diverse Platform UIs β CSS, DOM, and patterns differ. Three-tier strategy: CSS β text scan β visual fallback.
- π₯ Dynamic SPAs β inconsistent ADD confirmations; multi-signal verification with Gemini vision + DOM.
- π Cart Navigation β Zepto product card navigates away; vision model localizes ADD button + recovery path.
- π’ Quantity Arithmetic β Recipes rarely match stock sizes. A combination planner lets the agent pick the most efficient pack mix. LLM chooses the product; Python computes exact units; cross-checked before adding.
- π¬ Conversational Context β tracks pre-existing cart, session additions, and new requests.
- π‘ Real-Time Streaming β SSE + WebSockets maintain live dashboard across async multi-agent pipeline.
π Accomplishments
- Genuinely agentic loop: sees, reasons, and decides from screenshots.
- One Gemini model, five agents: text parsing, recipe expansion, vision, verification, substitution.
- Robust quantity math: handles partial packs efficiently.
- Self-correction: retries, navigates back, re-analyzes.
- Cross-platform comparison: Blinkit & Zepto with full fees, coverage, and recommendation.
- Live dashboard: chat + mirrored browser shows agent progress in real-time.
π What I Learned
- Multimodal grounding changes the problem β vision removes hallucinations but adds UI-specific failure modes.
- Structured output is essential β Pydantic schemas enforce correctness, preventing silent downstream errors.
- Google Cloud deployment & ecosystem β got hands-on experience with Playwright automation, Cloud Run deployment, and Gen AI Python SDK, which I wasnβt familiar with before.
π What's Next
- Voice input β hands-free cooking commands
- Meal planning mode β optimised weekly carts
- Price memory & trend alerts β notify discounts per SKU
- Agent-as-API β REST/webhook for third-party apps
- Multi-user session isolation β cloud-managed concurrent browsing
Built With
- chromium
- docker
- fastapi
- gemini
- google-cloud
- google-gen-ai-sdk
- playwright
- python
Log in or sign up for Devpost to join the conversation.