● Flow & Architecture

From a WhatsApp message to a dock door

How the pieces fit, who owns each decision, and what a working day looks like for the two people this system serves: the driver on the road and the coordinator at Jaipur DC.

Architecture

One small container, one database, one write path. Language at the edges, deterministic code in the middle. Click any box, or play a trace to watch a real case travel through it.

Five layers, 16 components — one place a model may run

Every component, the technology behind it and the file that holds it. The blue box is the only place a language model may run, and only when the rules cannot read a message; everything else is deterministic code. Purple marks MVP 2.

1 · Channels
DriverWhatsApp Business APICoordinatorWeb console · Cognito sign-inGPS feed (MVP 2)Telematics · FASTag via ULIP
2 · API and sessions
app.pyFastAPI · WhatsApp webhook and console API · verifies sender (auth.py)session_store.pyRedis · sessions, tokens, dedupe, history, per-driver lock
3 · Orchestration and language
fixed path — the model never picks the next tool
graph.pyLangGraph · fixed pathnlu.pyRules, 7 languagesllm.pyHaiku via LangChain · only if rules say UNKNOWNreplies.pyTemplates + output guard
4 · Tools
deterministic Python
eta.pyETA + confidencetimeline.py15 checksplanner.pyProposes a plancapacity.pyOnly writerescalation.pyHand-offs
5 · Record and observability
SQLite (MVP 1) → Postgres / MongoDB (MVP 2)18 + 12 tables · 3 triggers · EXCLUDE · proposed MVP 2 tables →LangSmithtracing.py · traces per turn · guard tags · eval sets

One exception, end to end

A promise is made only after one transaction books the slot. Every path either asks one question, escalates with options, or books through one checked transaction. Pick a case to watch its path.

Adapted from the solution design: there, a pick takes a 3-minute hold and only "YES" books. Here the pick itself is the booking request, checked in one transaction — one fewer message for a driver on the road. A hold exists only while a coordinator decides.
🚚
Life of a Driver · before and after

From phone tag to one message

🎧
Life of a Coordinator · before and after

From relaying messages to making decisions

Where the two lives meet

Most driver conversations never touch the coordinator. When they do, it is a hand-off with a deadline, and the answer flows straight back to the driver's WhatsApp.