Case studies/A conversational AI agent built around Magento
Conversational AIeCommerceMagento 2Enterprise platform

A conversational AI agent built around Magento

EnviroPack

A production-grade assistant and hybrid RAG platform for product discovery, order support and personalized commerce — designed to sit alongside an existing Magento storefront rather than replace it.

The experience

A storefront that can understand the product behind the query.

The visuals below are an illustrative catalog treatment for the case-study page.

Catalog intelligence

From a natural-language request to relevant products.

The system is designed for queries where intent, product attributes and exclusions all matter — including searches that do not resemble literal catalog terminology.

Customer experience

Embeddable AI chat widget

React + Vite widget, connected over WebSockets for real-time token streaming and product discovery.

Searchsemantic + keyword-aware
Contextmulti-turn state
Realtimestreamed responses
Operations

Enterprise control center

Next.js portal for conversation oversight, ingestion controls, transcript governance and sync operations.

GovernanceTOTP + export controls
Syncstock + pricing triggers
Observabilityaudit + tracing
Deployment
FastAPI microservice
Catalog sync
Magento 2 REST APIs
Retrieval model
Hybrid dense + sparse
Widget protocol
Realtime WebSockets
01 / THE CHALLENGE

The challenge was not just search.

Customers often describe what they want in terms of use, attributes or exclusions instead of exact product names. At the same time, the assistant needed to understand account context, order status and B2B pricing while remaining grounded in Magento data.

01

Intent ambiguity

Natural-language requests can describe meaning rather than catalog keywords.

02

Category boundaries

Accessories and neighboring products must be demoted when the shopper asks for something else.

03

Catalog sync lag

Re-indexing must not expose partial datasets or zero-point search windows.

04

Conversation continuity

Follow-up turns should inherit state instead of behaving like unrelated searches.

02 / ARCHITECTURE

Architecture

The architecture prioritizes modularity: a low-latency edge chat client, stateful LangGraph orchestration, dual vector retrieval, and resilient multi-provider LLM transport.

Decision 01

Search needed both meaning and precision.

Normalize the query, combine dense and sparse retrieval in Qdrant, rerank candidates with a cross-encoder, then pass the strongest product context to the LLM.

Search needed both meaning and precision. User query flows into query expansion, then into dense and sparse retrieval, then reranking, then final product context. User Search Query Intent & Synonym Expansion Hybrid Qdrant Retrieval Cross-Encoder Rerank Top 8 Ranked Products

Architecture Narrative

User query flows into query expansion, then into dense and sparse retrieval, then reranking, then final product context.

The live index should never become half-built. Magento catalog flows into an ingestion worker, then a staging collection, validation, and finally an atomic live alias switch. Magento 2 REST API Ingestion Pipeline Worker Staging Vector Collection Automated Validation Gate Atomic Live Alias Switch

Architecture Narrative

Magento catalog flows into an ingestion worker, then a staging collection, validation, and finally an atomic live alias switch.

Decision 02

The live index should never become half-built.

Build the new catalog in a date-stamped staging collection, validate it, then update the live collection alias atomically.

Decision 03

Conversation state had to survive the request.

Conversation state had to survive the request. Customer message enters WebSocket and FastAPI, flows through LangGraph, uses persisted PostgreSQL state and retrieval context, then returns a streamed response. Widget Chat WebSocket FastAPI Gateway LangGraph Agent Engine Postgres Checkpoint Store Token Stream Output
Conversation state had to survive the request. Customer message enters WebSocket and FastAPI, flows through LangGraph, uses persisted PostgreSQL state and retrieval context, then returns a streamed response. Widget Chat WebSocket FastAPI Gateway LangGraph Agent Engine Postgres Checkpoint Store Token Stream Output

Architecture Narrative

Customer message enters WebSocket and FastAPI, flows through LangGraph, uses persisted PostgreSQL state and retrieval context, then returns a streamed response.

LangGraph orchestrates the stateful execution flow while PostgreSQL stores checkpoints for durable conversation continuity.

Decision 04

An AI provider failure should not become a commerce failure.

Route normal requests through a primary provider and fail over on transient network or service errors.

An AI provider failure should not become a commerce failure. Agent request goes to a fallback provider abstraction, then to OpenAI as primary. A transient failure sends the request to OpenRouter. Agent Inference Request FallbackProvider Transport OpenAI Primary gpt-4o OpenRouter Secondary API Unified Stream Output
An AI provider failure should not become a commerce failure. Agent request goes to a fallback provider abstraction, then to OpenAI as primary. A transient failure sends the request to OpenRouter. Agent Inference Request FallbackProvider Transport OpenAI Primary gpt-4o Unified Stream Output OpenRouter Secondary API

Architecture Narrative

Agent request goes to a fallback provider abstraction, then to OpenAI as primary. A transient failure sends the request to OpenRouter.

03 / EXECUTION

One AI system, two focused experiences.

The customer-facing widget stays small and real-time. The admin experience exposes the controls that operations teams need to keep the system healthy and governed.

FOR CUSTOMERS

Embeddable chat widget

React + Vite, compiled as a standalone widget and connected to the backend over WebSockets.

  • Discoversemantic product search
  • Trackorders + account history
  • PersonalizeB2B tier pricing context
  • Streamtoken-by-token responses
FOR MERCHANTS

Enterprise control center

Next.js 15 portal for transcript review, ingestion jobs, synchronization and governance.

  • Reviewconversation oversight
  • Syncstock + pricing controls
  • Governraw transcript export rules
  • ProtectTOTP 2FA
04 / OUTCOMES

What the architecture makes possible.

Stateful

Conversation context persists

PostgreSQL-backed checkpoints let the agent retain context across turns.

Hybrid

Search combines semantics + precision

Dense and sparse retrieval are paired with reranking for stronger catalog matching.

Resilient

AI provider failover is built in

Transient provider failures can move to a secondary model path.

Live

Catalog updates can be staged

New indexes are validated before the live alias is switched.

Realtime

Responses stream over WebSockets

The widget receives token-by-token response updates without waiting for a full batch.

< 200 KB

Widget gzip target

The source specifies a sub-200 KB gzip engineering target; it is not presented here as a measured business result.

05 / STACK

Complex where it matters. Familiar everywhere else.

The AI layer carries the sophistication. Supporting services use mainstream infrastructure that can be monitored, maintained and extended.

AI & Retrieval

Agent orchestration, hybrid search and candidate reranking.

  • LangGraph
  • LangChain
  • Qdrant
  • SentenceTransformers

Backend

Async APIs, state persistence and commerce integration.

  • FastAPI
  • Python
  • PostgreSQL
  • Redis

Experience

Low-weight embedded customer UI plus enterprise admin tooling.

  • React 18
  • Vite
  • Next.js 15
  • Tailwind

Commerce

Existing storefront commerce remains the system of record.

  • Magento 2
  • REST APIs
  • OpenAI
  • OpenRouter
Next

Building an AI experience around an existing commerce stack?

Product discovery, account intelligence, support automation and other AI workflows can be layered onto an existing platform without rebuilding the commerce core.

Client testimonial

The team treated our operational constraints as design inputs. The agent shipped into a live support workflow without disrupting it.
Head of Operations, EnviroPack