03 / 06·2026
Retailer Connect
An AI sales rep that phones a kirana store, prices the order and remembers the last call.
- Role
- Everything — built solo as a take-home prototype
- Source
- Public repo

01
Context & my role
An interview take-home: a voice agent an FMCG brand could use to call retailers about products, prices and trade schemes.
Built solo, end to end: agent loop, tools, pricing engine, UI, tests and deployment.
Role: Everything — built solo as a take-home prototype
00
At a glance
Retailer speaksInput
Web Speech API · en-IN
Gemini agent loopAI step
function calling over 6 tools
Scheme pricing engineGuardrail
every number computed in code
Rollback on failed turnGuardrail
no half-applied tool calls
JSON Schema summaryGuardrail
rule-based fallback
Order + follow-up loggedOutput
How the system works, top to bottom. Accent steps call a model; dashed steps are rules enforced in code, so the model cannot override them.
AI step Guardrail enforced in code Processing
02
Problem
An FMCG brand wants a voice agent that can call retailers, answer questions about products, prices and trade schemes, capture order enquiries and log follow-ups — without ever quoting a price the business did not set.
The hard part is not the conversation. It is making sure every number the agent says is grounded, every scheme is priced correctly, and the whole thing can be tested without burning API quota.
03
Approach
A small Express 5 server with explicit dependency injection: `createApp({ llm, createProvider, repo })` so tests swap the Gemini provider for a deterministic MockLLM and the JSON file store for an in-memory one.
The agent loop runs Gemini function calling over six tools — catalogue search, price and scheme lookup, stock and alternatives, order capture, follow-up capture and `quote_order`. Any turn that fails is rolled back so the session never holds a half-applied tool call.
Pricing is code, not prompt: a scheme engine applies buy-X-get-Y, percentage-off-above-value and combo offers, quotes net value and savings, and tells the retailer how close they are to the next tier.
04
Architecture
FMCG Voice AI & Order Dispatch Agent
simplified, illustrativeAutomated voice order placement and catalog checking platform converting conversational phone calls into validated ERP order entries.
System Overview & Accessible Text Description
Components: Retailer / Caller (client); STT Audio Streamer (service); LLM Intent Classifier (llm); Inventory & ERP Service (service); Orders Database (db); TTS Speech Synthesizer (service).
Key Data & Auth Flows: Retailer / Caller → STT Audio Streamer [WebRTC Audio]; STT Audio Streamer → LLM Intent Classifier [Transcribed Text]; LLM Intent Classifier → Inventory & ERP Service [Check SKU Stock]; Inventory & ERP Service → Orders Database [Record Order]; Inventory & ERP Service → TTS Speech Synthesizer [Confirmation JSON]; TTS Speech Synthesizer → Retailer / Caller [Synthesized Voice].
05
Key decisions & trade-offs
- 01Pricing is code, not prompt. A scheme engine computes every number and the model only talks about it. New scheme types need code, in exchange for never quoting a price the business did not set.
- 02Explicit dependency injection (`createApp({ llm, createProvider, repo })`) lets tests swap Gemini for a deterministic mock and run with no network.
- 03A failed turn is rolled back, so a session never holds a half-applied tool call.
- 04Each visitor's LLM key travels as a request header, is used for that request only, and is never stored or logged.
- 05Call summaries are validated against a JSON Schema and fall back to a rule-based summary if the model output fails.
06
Outcome
- Live at fmcg-agent-six.vercel.app with an offline mode that needs no API key.
- Delivered as an interview take-home; the public repo is a compact reference for grounded tool-calling agents.
07
Stack
- Node 20
- Express 5
- Gemini (function calling)
- Web Speech API
- node:test
- Vercel
Skills evidenced: Node.js · Express · Gemini function calling · STT / TTS
Next case study
Lead Compass →
A research engine that finds real companies and explains why they are a lead.