An intelligent, conversational assistant for coffee shop operations, powered by LangGraph. This agent helps users navigate the menu, place orders, and receive personalized suggestions—all through a multi-turn, context-aware chat interface. All chat history is persistently stored using a SQLite backend for seamless experiences across sessions.
The app features a clean, multilingual interface with real-time streaming chat, persistent session management, and interactive messaging components.
Coffee Shop Assistant is designed to simulate a helpful AI agent in a real café setting. It guides customers through menu options, answers questions about drinks and items, and supports conversational follow-up using contextual memory.
The app architecture leverages:
- LangGraph for stateful, multi-step conversations.
- Streamlit for the interactive UI.
- SQLite for persistent chat storage.
- Gemini 2.5 Pro for fast, intelligent responses.
- Local database files for coffee menu data and interactions.
The assistant follows a structured LangGraph flow:
- Initial Greeting: Welcomes the user and presents a helpful introduction.
- Intent Recognition: Parses user intent—whether it’s asking about drinks, placing an order, or general questions.
- Data Lookup: Fetches responses from internal knowledge (e.g.
.dbfile) using the relevant LangGraph tools. - Response Generation: Crafts a helpful reply based on the query and current conversation context.
- Persistence: Logs every message into a persistent SQLite conversation history.
The architecture relies on a deterministic graph built with LangGraph that controls user interactions in clear, logical steps. It includes memory nodes, conditional branching, and fallback logic for unrecognized intents.
- Conversational Agent: Handles Arabic or English customer queries with natural language responses.
- Persistent Chat Memory: Saves each session in a local SQLite database.
- Interactive Streamlit UI: Streamlined, user-friendly experience.
- Menu Lookup: Supports intelligent retrieval of menu items and their details.
- Orchestration: LangChain & LangGraph
- LLM: Google Gemini (
gemini-2.5-pro) - Database: SQLite (
coffee_shop.db) - UI Framework: Streamlit
- Environment Management: Python
venvor Docker
-
Clone the Repository
git clone https://github.com/eslammohamedtolba/Coffee-Shop-Assistant.git cd Coffee-Shop-Assistant -
Create and Activate a Virtual Environment
# Create the environment python -m venv venv # Activate on Windows PowerShell .\venv\Scripts\Activate.ps1 # On macOS/Linux source venv/bin/activate
-
Install Dependencies
pip install -r requirements.txt
-
Add Environment Variables
- Create a
.envfile in the root directory and add:GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
- Create a
-
Launch the App
streamlit run main.py
-
Access the App
Openhttp://localhost:8501in your browser and start chatting.
-
Ensure Docker is Running
-
Build the Docker Image
docker build -t coffee-shop-assistant . -
Run the Container
docker run -p 8501:8501 \ -v "$(pwd)/coffee_shop.db:/app/coffee_shop.db" \ -v "$(pwd)/.env:/app/.env" \ coffee-shop-assistant
Explanation:
-p 8501:8501: Maps Streamlit port-v "$(pwd)/coffee_shop.db:/app/coffee_shop.db": Mounts your local database-v "$(pwd)/.env:/app/.env": Injects your local API keys
-
Access the Application
Go to:http://localhost:8501 -
Stop the Container
docker stop coffee-shop-assistant
-
(Optional) Remove the Container
docker rm coffee-shop-assistant
Feel free to fork this repo, open issues, or submit pull requests to enhance functionality, add features, or improve performance.
