AI-powered bus travel assistant for Rwanda, built with Qwen Cloud
# SmartBus AI Agent 🚌
> AI-powered bus travel assistant for Rwanda — built with Qwen Cloud for the Global AI Hackathon (Track 4: Autopilot Agent)
SmartBus is a production-grade conversational agent that automates end-to-end bus travel booking in Rwanda. Users interact in natural language (English, Kinyarwanda, French, or Swahili) and the agent handles everything: searching routes, comparing prices, holding seats, confirming bookings, and generating PDF receipts — all backed by real database operations, never hallucinated.
---
## Demo
> 📹 Watch the 3-minute demo on YouTube *(link coming soon)*
---
## Features
- **Multi-language support** — English, Kinyarwanda, French, Swahili
- **Multi-agent routing** — intent classifier delegates to Search, Booking, or Pricing sub-agent
- **Persistent memory** — remembers preferred routes and bus types across sessions
- **Booking state machine** — enforces search → hold → confirm → book flow server-side
- **Graceful fallbacks** — retries on quota/timeout errors, surfaces friendly messages
- **PDF receipt generation** — auto-generated after every confirmed booking
- **Human-in-the-loop** — seat is held and user must explicitly confirm before booking is created
- **Tool-grounded** — all trip data, prices, and seat counts come from real DB queries, never invented
---
## Architecture
```
User (Web / WhatsApp)
│
▼
Django REST API (POST /api/chat/)
│
▼
Intent Router ←── Traveler Memory (DB)
│
┌────┼────────────┐
▼ ▼ ▼
Search Booking Pricing
Agent Agent Agent
└────┼────────────┘
│
▼
Tools Layer (deterministic)
search_routes · get_trips · compare_prices
check_seats · hold_seat · create_booking
get_booking_history · generate_booking_receipt
│
▼
PostgreSQL ←── Alibaba Cloud ECS
```
---
## Tech Stack
| Layer | Technology |
|---|---|
| LLM | Qwen Cloud (`qwen-plus-latest`) |
| Backend | Django 5 + Django REST Framework |
| Database | PostgreSQL (Alibaba Cloud) / SQLite (local dev) |
| PDF Generation | Re …