🍳 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:

  1. You type: "Make butter chicken for 4 people"
  2. CookWithMe parses intent, expands the recipe into an ingredient list, and asks for confirmation.
  3. You select platform: Blinkit, Zepto, or both.
  4. The agent shops: searches, reads screenshots, selects best products & pack sizes, clicks Add, verifies success, and moves to next item.
  5. Self-correction handles unavailable items, wrong pages, or missing products.
  6. 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

  1. 🌐 Diverse Platform UIs β€” CSS, DOM, and patterns differ. Three-tier strategy: CSS β†’ text scan β†’ visual fallback.
  2. πŸ–₯ Dynamic SPAs β€” inconsistent ADD confirmations; multi-signal verification with Gemini vision + DOM.
  3. πŸ› Cart Navigation β€” Zepto product card navigates away; vision model localizes ADD button + recovery path.
  4. πŸ”’ 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.
  5. πŸ’¬ Conversational Context β€” tracks pre-existing cart, session additions, and new requests.
  6. πŸ“‘ 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

Share this project:

Updates

Submission history