Applied AI Product · Datacue — Sanabil Venture

RetailGPT — Agentic Retail Intelligence Platform

Ask retail data a question in plain English and get a governed, cited, multi-format answer back — safely.

Delivered at: Datacue — Sanabil Venture
Role: Lead / solution architect — concept-to-production, designed and built end to end.

The problem

Retail teams sit on large transactional datasets but can’t query them without an analyst and a wait. The hard part of a natural-language layer over that data isn’t the chat UI — it’s the security and governance around it: who can ask what, what’s safe to execute directly, and what needs retrieval instead.

Business Context

Retail teams at Datacue sat on large transactional datasets they couldn't query without an analyst and a wait. The goal wasn't just a chat UI over that data — it was making a natural-language layer safe enough to trust with real business questions.

Architecture

Scroll sideways to see the full diagram
RetailGPT — System Architecture & WorkflowSingle end-to-end flow: query · security · governance · orchestration · execution · response1 · User consoleSubmits a natural-language query2 · AI security layerJailbreak · prompt-injection check3 · Category access checkOnly the user's own category is allowed4 · LLM orchestratorDeterministic or non-deterministic?LLM layerfallback mechanismGeminiprimaryOpenAIsecondary · if primary downServes every LLM step —orchestrator · RAG · recommendContext handlerMaintains the conversation windowboth paths can run in paralleldeterministicnon-deterministic5 · BigQueryDeterministic query executes6 · RAG pipelineVector DB · pgvector retrieval7 · RecommendationReads BigQuery · next sales actiondata5.1 · MultiprocessingBuilds four response types in parallelSummaryText overviewTableStructured rowsChartVisual graphDownloadExport link5.2 · Response to userRelevant response type shownCROSS-CUTTING · OBSERVABILITY & STORAGE8 · AI observabilitySelf-managed · tracing & metricsPostgreSQLShared data store9 · Chat & user historyConversation storeTEN ARCHITECTURE PILLARS · REVIEWED END TO ENDScalabilitySecurityAI Security / GuardrailsReliability & ResilienceObservabilityGovernanceCost OptimizationData & RAG SecurityPerformanceMaintainability / DevSecOpsLegendSecurityGovernance / accessOrchestrationData / modelProcessing / executionRecommendationObservability / storagePrimary LLM: Gemini · secondary (fallback): OpenAI · vector store: pgvector · storage & observability: PostgreSQL · deterministic → BigQuery, non-deterministic → RAG (parallel).

Key capabilities

Dual-path orchestration — deterministic warehouse queries and non-deterministic RAG retrieval run in parallel and merge into one response

AI security layer for jailbreak and prompt-injection defense, plus per-user category access control

Multi-format responses generated in parallel — summary, table, chart and export

A recommendation engine that reads the same governed data to suggest next actions

Automatic primary/secondary LLM fallback so the assistant stays available

Full conversation history and AI observability from day one

Security & Risk

The real risk in a natural-language layer over transactional data isn't the chat UI — it's authorization: who can ask what, what the agent may execute directly versus only retrieve, and what happens when a query touches data outside the requester's permission. RetailGPT enforces that boundary before generation, not after.

Outcome

A governed, cited, multi-format answer back to the business user — safe by construction, not by review after the fact.

Challenges

Running deterministic warehouse queries and non-deterministic RAG retrieval in parallel, then merging them into one coherent response, was the core architectural challenge — on top of enforcing per-user category access control and jailbreak/prompt-injection defense before generation happened at all, not as a review step afterward. Keeping the assistant available also meant building automatic primary/secondary LLM fallback into the same request path.

Lessons Learned

Authorization has to be enforced before generation, not filtered out of the answer afterward. Deciding what a user may ask, what the agent may execute directly versus only retrieve, and what data is out of scope has to happen at the query boundary — a “safe” answer generated first and checked after is just a policy violation nobody has noticed yet.

Architecture pillars

Designed and reviewed against all ten — see how I evaluate every architecture.

Want this level of review applied to your own system? Start an AI Architecture Review.

ScalabilitySecurityAI Security / GuardrailsReliability & ResilienceObservabilityGovernanceCost OptimizationData & RAG SecurityPerformanceMaintainability / DevSecOps

Technology

GeminiOpenAI (fallback)Agentic orchestrationBigQuerypgvectorPostgreSQLPython

Want something like this, built properly?

I design and ship systems like this one — from architecture through to production.