A full-stack intelligent ticket booking assistant powered by Google's Agent Development Kit (ADK) and Gemini AI. SmartTicket helps users find and book flights, trains, buses, and movie tickets through natural conversation.
-
Agent System: ADK-powered conversational agent with planner, memory, and context management
-
Custom Tools:
searchTicketsTool: Search across multiple ticket types (flights, trains, buses, movies)compareOptionsTool: Compare ticket options side-by-sidebookTicketTool: Book selected tickets with passenger detailssendConfirmationTool: Send booking confirmations
-
REST API Endpoints:
POST /api/agent: Main chat interface with the AI agentPOST /api/search: Direct ticket searchPOST /api/book: Direct booking endpointGET /api/bookings: Retrieve booking history
- Modern Chat UI: Clean, responsive chat interface with typing animations
- Split-Panel Layout: Chat on the left, quick info panel on the right
- Real-time Updates: Smooth transitions and loading states
- Session Management: Persistent sessions across page reloads
smartticket/
├── backend/
│ ├── agent/
│ │ ├── __init__.py
│ │ └── smart_agent.py # ADK agent configuration
│ ├── tools/
│ │ ├── __init__.py
│ │ ├── mock_data.py # Mock datasets for tickets
│ │ └── ticket_tools.py # Custom tool implementations
│ ├── __init__.py
│ └── app.py # Flask REST API
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Main React component
│ │ ├── main.jsx # React entry point
│ │ └── index.css # Tailwind styles
│ ├── index.html
│ ├── package.json
│ ├── vite.config.js # Vite configuration with proxy
│ ├── tailwind.config.js
│ └── postcss.config.js
├── main.py # Backend entry point
└── README.md
- Python 3.10+
- Node.js 20+
- Google Gemini API Key
- Clone the repository
git clone <your-repo-url>
cd smartticket- Backend Setup
# Install Python dependencies from pyproject.toml (recommended)
pip install .
# Alternative: Install manually
# pip install google-adk flask flask-cors google-genai
# Set environment variables (optional for testing with mock mode)
export GEMINI_API_KEY="your-gemini-api-key" # Get from https://ai.google.dev/
export SESSION_SECRET="your-secret-key"
# Note: The app works without GEMINI_API_KEY using a mock agent for testing- Frontend Setup
cd frontend
npm installThe application uses a unified workflow that runs both backend and frontend:
# From the root directory
python main.py &
cd frontend && npm run devOr use the configured workflow that starts both services automatically.
- Backend: http://localhost:8000
- Frontend: http://localhost:5000
- Search: Users describe their travel or entertainment needs
- Compare: Agent presents multiple options with key details
- Recommend: Suggests best option based on price, convenience
- Book: Collects passenger details and confirms booking
- Confirm: Provides booking reference and confirmation
- Flights: Domestic and international flight bookings
- Trains: Train ticket reservations
- Buses: Bus ticket bookings
- Movies: Movie ticket purchases with showtime selection
- Natural language understanding
- Context-aware conversations
- Multi-turn dialogue support
- Session memory for personalized experience
- Intelligent price comparisons
The application includes realistic mock datasets for:
- Multiple airlines, train operators, and bus services
- Various routes and schedules
- Different price points and service classes
- Movie theaters with multiple showtimes
Backend:
- Python 3.11
- Flask (REST API framework)
- Google ADK (Agent Development Kit)
- Gemini 2.0 Flash (LLM model)
- Flask-CORS (Cross-origin support)
Frontend:
- React 18
- Tailwind CSS (Styling)
- Vite (Build tool)
- Framer Motion (Animations)
- Axios (HTTP client)
- React Icons
curl -X POST http://localhost:8000/api/agent \
-H "Content-Type: application/json" \
-d '{
"message": "I need a flight from New York to Los Angeles on December 1st",
"session_id": "optional-session-id"
}'curl -X POST http://localhost:8000/api/search \
-H "Content-Type: application/json" \
-d '{
"origin": "New York",
"destination": "Los Angeles",
"type": "flight",
"date": "2025-12-01"
}'- Persistent database integration (Firestore/Supabase)
- Real ticket booking API integrations
- Payment processing (Stripe)
- Email/SMS confirmations
- User authentication
- Booking history and user profiles
- Real-time price tracking
- Multi-language support
- Analytics dashboard
- Add mock data to
backend/tools/mock_data.py - Update search filters in
search_tickets()function - Update frontend icons and UI in
App.jsx
- Create new tool functions in
backend/tools/ticket_tools.py - Register tools in
backend/agent/smart_agent.py - Update agent instructions for new capabilities
| Variable | Description | Required |
|---|---|---|
GEMINI_API_KEY |
Google Gemini API key from https://ai.google.dev/ | No (mock mode available) |
SESSION_SECRET |
Flask session secret | No (default provided) |
PORT |
Backend port | No (default: 8000) |
Mock Mode: If GEMINI_API_KEY is not set, the application runs in mock mode with pre-programmed responses. This allows you to test the UI and application flow without requiring an API key. Set the key for real AI-powered conversations.
MIT License - Feel free to use this project as a learning resource or starting point for your own AI agent applications.
- Built with Google Agent Development Kit (ADK)
- Powered by Gemini AI
- UI inspired by modern chat applications
Note: This is a demonstration project using mock data. For production use, integrate with real ticket booking APIs and implement proper authentication, payment processing, and data persistence.