Agentic AI-Powered Ecommerce Assistant for Retail
An end-to-end agentic AI shopping assistant for a large retail ecommerce platform, enabling customers to place grocery orders via natural conversation, image-based lists, and recipe requests — mapped accurately to thousands of SKUs through a hybrid retrieval engine and orchestrated by a hierarchical LangGraph agent system.

1The Problem
A large retailer's ecommerce platform was optimised for structured browsing but failed to handle real-world customer behaviour. Customers frequently attempted to build grocery baskets using free-text lists, photos of handwritten notes, and recipe-based requests — formats that keyword-based search and rule-driven flows could not handle. This led to high cart abandonment on multi-item orders, lost revenue from incorrect or incomplete baskets, heavy manual load on customer support for order changes and tracking, and a poor experience for mobile-first and time-constrained shoppers. Traditional chatbot architectures could not scale to this level of conversational commerce complexity.
2The Approach
We designed and delivered a hierarchical agentic AI system orchestrated using LangGraph, integrated with a custom ecommerce backend. A central supervisor agent routes user intent to specialised sub-agents responsible for product search, recipe intelligence, cart management, and order execution. Product retrieval combines lexical search (pg_trgm) with semantic vector search (pgvector) to handle misspellings, synonyms, and local grocery terminology, with business-aware re-ranking applied on top. A draft-and-confirm transaction model ensures no order is placed, modified, or cancelled without explicit user approval. Conversation state is persisted in PostgreSQL and rehydrated on each LLM turn, enabling stateful multi-turn interactions without relying on LLM memory. Multimodal inputs — text lists, conversational queries, and OCR-extracted image lists — are unified through a single downstream processing pipeline.
Technical Architecture
Conversational Orchestration Layer: LangGraph-based supervisor agent that routes user intent to specialised sub-agents (search, recipe, cart, orders) and maintains session-level state across turns
Hybrid Product Retrieval Engine: Combines lexical search (pg_trgm) and semantic vector search (pgvector) with confidence-based fusion and business-aware re-ranking on pack size, availability, and popularity
Multimodal Input Processing: Handles text-based grocery lists, conversational queries, and image-based lists via OCR — unified into a single downstream processing pipeline
Transaction-Safe Order Workflow: Draft-first order creation model with explicit confirmation gates before placing, modifying, or cancelling orders; persistent cart and order state across conversations
Recipe Intelligence Sub-Agent: Retrieves recipes from public APIs, extracts structured ingredient lists, and maps ingredients to purchasable SKUs with substitution options
Persistence Layer: PostgreSQL for conversation state, draft order identifiers as single source of truth; stateless LLM execution with full state rehydration on each turn
Frontend: React.js conversational UI for shopping interactions, basket management, and product discovery
Backend: FastAPI-based AI orchestration layer handling conversational processing, recommendation logic, and ecommerce system integration
Results
Significantly reduced time-to-basket for multi-item grocery orders
Improved SKU selection accuracy for ambiguous and colloquial user queries
Reduced dependency on manual customer support for order edits and status tracking
Enabled scalable conversational commerce without rule-based logic explosion
Delivered a foundation for future WhatsApp and voice-based ordering channels
Full audit trail maintained from user input through agent decision to backend action
Key Insights
“Conversational ecommerce fundamentally requires stateful workflows — stateless chat architectures break down the moment a user says 'add three more of those' in a follow-up message.”
“Hybrid semantic + lexical retrieval is non-negotiable for FMCG: semantic search alone misses exact brand names and pack sizes, while lexical alone fails on synonyms and misspellings.”
“Draft-and-confirm patterns are the critical safety layer for transactional AI — users tolerate an extra confirmation step far better than discovering an incorrect order was placed silently.”
“The real product shift is from reactive commerce to proactive commerce: anticipating recurring purchases and weekly patterns unlocks more customer value than any single search improvement.”
Tech Stack
Interested in a similar project?
I'd love to discuss how we can apply this kind of approach to your specific business challenge.
Let's Talk