Case Study

RAG Agent for Operations Data

Ask plain-language questions about your business on Telegram. The AI agent retrieves data from your POS system and answers instantly.

PythonFastAPIGemini 2.0 FlashVertex AIZelty POS APITelegram Bot APIPostgreSQLGoogle Cloud RunAPScheduler
AI Operations Bot for Shawar'Mama

Client

Shawar'Mama

6-location restaurant chain, Paris

Category

AI Agent · Operations Automation

Stack

Python · Gemini 2.0 Flash · Telegram · GCP

The Problem

Running a multi-location restaurant means drowning in data spread across disconnected apps. The owner was logging into Zelty (his POS system) and Deliverect separately to check sales, orders, top-performing items, and customer data — whenever he needed a number, he had to go find it.

The real breaking point: he couldn't easily get answers in the middle of things. Investor meetings, visits to a location, conversations with partners — these were the moments he needed data most, and the least convenient times to dig through apps.

He didn't want a dashboard. He wanted to just ask.

The Solution

I built an AI operations assistant deployed on Telegram — a conversational agent connected directly to his POS system, with the ability to reason over his data and answer questions in natural language.

Morning Digest — Automatic

Every day at 8:00 AM, the bot pulls the previous day's sales data from Zelty, normalises it across all 6 locations, and sends the owner a narrative summary: total revenue, covers, average ticket, top and bottom items, and week-over-week trends — in French, delivered to his Telegram before he starts his day.

Ad-Hoc Q&A — Conversational

The owner can ask anything, in plain language. The agent reasons through the question, decides which data to fetch, queries Zelty in real time, and returns a clear formatted answer — with conversation history so follow-up questions work naturally.

// Example queries

"What was my best-selling item last week?"

"How did Saturday compare to the previous Saturday?"

"Which location had the highest average ticket this month?"

The system remembers context across the conversation, supports multiple authorised users (owner + partners), and handles failures gracefully — if the POS API is down, the owner gets notified rather than silence.

What Changed

Before

  • Logging into multiple apps to pull data
  • No way to get answers quickly in context
  • Manual reporting, no cross-location view

After

  • One Telegram conversation connected to everything
  • Answers in under 10 seconds, mid-meeting
  • Automatic daily digest before the day starts

The bot became the single interface to the business's operational data — no dashboards, no app switching, no manual reporting. The owner can ask a question mid-investor meeting and get an answer in under 10 seconds.

Agentic Design

Agentic Design Patterns

ReAct Pipeline (Planner → Executor → Analyst)

  • Planner: Understands intent, picks the right tools, resolves French dates to concrete periods
  • Executor: Calls 4 specialized tools in parallel (sales summary, raw orders, customers, cached data)
  • Analyst: Synthesizes results with conversation history to craft a natural answer

Tool Use (Function Calling)

  • The LLM doesn't hallucinate data—it must use tools to fetch it
  • Prevents "made-up" metrics

Conversation Memory

  • Stores user chat history in PostgreSQL
  • Enables follow-up questions without re-asking context
  • Example: "How did that compare to the week before?" — already knows which week you're talking about

Why It's Smart

Specialized Tools, No Hallucination

The LLM doesn't invent metrics; every number comes from a tool call that fetches real POS data

Intelligent Tool Selection

A planning stage understands intent and picks the right tools (cached summary for speed, raw orders for detail, customer data when needed)

Conversation Memory

stores user chat history in PostgreSQL, enabling multi-turn reasoning and follow-up questions without losing context

Refined Through Collaboration

Worked with a restaurant operations expert to fine-tune prompt logic and metric calculations, ensuring the agent reasons about business KPIs the way a seasoned operator would

Learns from User Data and Gets Better Over Time

Nightly Cache Backfill

Historical order data is cached each night, so the agent learns what "fast queries" should look like and serves them instantly without hitting the POS API

User Preferences Learning

The system stores each owner's language preference and custom instructions, adapting responses over time to match their communication style

Historical Context Builds Pattern Recognition

More conversation history = better comparisons ("How did today compare to last Tuesday?") because the agent has seen the data before

Want something similar built for your business?

Get in touch