Annapurna is a sophisticated GenAI-powered conversational agent built with LangGraph and FastAPI that helps customers browse restaurant menus and place orders seamlessly in natural language. This project demonstrates the power of AI agents in creating natural, intuitive food ordering experiences with some creative human like conversations, not the old robotic chatbots.
Main chat interface showing natural language interaction
Dynamic menu display and cart management features
- Intelligent Conversational Interface: Natural language interaction for menu browsing and order placement
- Dynamic Menu Integration: Real-time menu fetching from external services
- Smart Cart Management: Add, modify, and track items in the shopping cart
- Multi-tenant Support: Support for multiple restaurant subdomains
- Memory-Enabled Conversations: Maintains context throughout the ordering session
- RESTful API: Clean API endpoints for frontend integration
- Extensible Architecture: Built with LangGraph for easy workflow modifications
This project uses a modern AI agent architecture:
- LangGraph: Orchestrates the conversational workflow and agent behavior
- FastAPI: Provides high-performance REST API endpoints
- LangChain: Powers the LLM integration and tool calling
- Google Gemini: LLM backend for natural language processing
The system implements a state-based conversational agent that:
- Receives user messages
- Processes intent and context
- Calls appropriate tools (menu fetching, cart management)
- Maintains conversation state and memory
- Responds with helpful, contextual information
Agent workflow visualization showing the conversation flow and tool integration
chatbot-agent/
βββ backend/ # Main backend application
β βββ src/
β β βββ agents/ # Agent-related modules
β β β βββ nodes/ # LangGraph nodes (chatbot, tools)
β β β βββ prompts/ # System prompts and templates
β β β βββ tools/ # Agent tools (cart, menu)
β β β βββ graph.py # LangGraph workflow definition
β β β βββ state.py # State management
β β β βββ output_structures.py
β β βββ api/ # FastAPI routes
β β β βββ routes/ # API endpoint definitions
β β βββ services/ # Business logic services
β β βββ configs/ # Configuration management
β β βββ main.py # FastAPI application entry point
β βββ pyproject.toml # Python dependencies
β βββ uv.lock # Lock file for reproducible builds
βββ training/ # Training and development notebooks
β βββ training-agent.ipynb # Jupyter notebook for agent development
β βββ menu.json # Sample menu data
β βββ main.py # Training scripts
βββ docs/ # Documentation and diagrams
β βββ langgraph-flow.png # Workflow visualization
β βββ screenshots/ # Application screenshots
βββ README.md # This file
- Python 3.12+
- UV package manager (recommended) or pip
- Environment variables for API keys
-
Clone the repository
git clone https://github.com/shashanksrajak/chatbot-agent-food-ordering.git cd chatbot-agent-food-ordering
-
Set up the backend environment
cd backend uv sync # or pip install -e .
-
Configure environment variables Create a
.env
file in the backend directory:GOOGLE_API_KEY=your_google_api_key MENU_BACKEND_URL=your_menu_service_url
-
Run the application
cd backend uvicorn src.main:app --reload
The API will be available at
http://localhost:8000
Once running, access the interactive API documentation at:
- Swagger UI:
http://localhost:8000/docs
- ReDoc:
http://localhost:8000/redoc
curl -X POST "http://localhost:8000/chat" \
-H "Content-Type: application/json" \
-d '{
"message": "Hi, I want to see your menu",
"subdomain": "restaurant1",
"restaurant_name": "name",
"session_id": "user123"
}'
- User: "Hi, what's on your menu today?"
- Agent: Fetches and displays the current menu
- User: "I'd like to add a margherita pizza to my cart"
- Agent: Adds the item and confirms the addition
- User: "What's in my cart now?"
- Agent: Shows current cart contents and total
# Backend with auto-reload
cd backend
uvicorn src.main:app --reload --host 0.0.0.0 --port 8000
# For development with detailed logging
uvicorn src.main:app --reload --log-level debug
The training/
directory contains Jupyter notebooks for:
- Agent behavior experimentation
- Prompt engineering
- Menu data preprocessing
- Workflow testing
cd training
jupyter notebook training-agent.ipynb
get_menu()
: Fetches real-time menu data from external servicesadd_to_cart()
: Manages cart item additions with validationview_cart()
: Displays current cart contentsremove_from_cart()
: Handles item removal and modifications
The agent maintains conversation state including:
- Current cart contents
- User preferences
- Conversation history
- Restaurant context (subdomain)
Built-in memory management ensures:
- Context preservation across messages
- Session-based conversation tracking
- Stateful interactions
This project is licensed under the MIT License - see the LICENSE file for details.
- LangChain & LangGraph: For the powerful agent framework
- FastAPI: For the high-performance web framework
- Google Gemini: For the LLM capabilities
- Supabase: For the backend infrastructure
Shashank Rajak - @shashanksrajak
Project Link: https://github.com/shashanksrajak/chatbot-agent-food-ordering
Built with β€οΈ using LangGraph and FastAPI