AI-driven autonomous workflow for railway complaint management with role-based dashboards, AI routing, and analytics.
- AI complaint analysis and multi-department routing
- Role-based access (Passenger, Staff, Supervisor, Admin, Analyst)
- Complaint logging, status updates, and analytics dashboards
- Live chat assistant with train info lookup
python -m venv myenv
myenv\Scripts\activate
pip install -r requirements.txtstreamlit run main_app.pystreamlit run app.pyThe app reads secrets from Streamlit st.secrets and falls back to environment variables.
GEMINI_API_KEY(Google Generative AI)RAPID_API_KEY(Indian Railway API via RapidAPI)SERPER_API_KEY(Google search via Serper)
Optional:
GEMINI_MODEL_NAME(default:gemini-1.5-pro)
You can set them as environment variables before running Streamlit:
$env:GEMINI_API_KEY="<your_gemini_key>"
$env:RAPID_API_KEY="<your_rapidapi_key>"
$env:SERPER_API_KEY="<your_serper_key>"Or create .streamlit/secrets.toml:
[api_keys]
GEMINI_API_KEY = "<your_gemini_key>"
RAPID_API_KEY = "<your_rapidapi_key>"
SERPER_API_KEY = "<your_serper_key>"
[model]
GEMINI_MODEL_NAME = "gemini-1.5-pro"Gemini free key guide: Get API key
RapidAPI IRCTC playground: https://rapidapi.com/rahilkhan224/api/indian-railway-irctc/playground
The RBAC app (main_app.py) loads auth/credentials.yaml. For local testing, copy and edit the example:
copy auth\credentials_example.yaml auth\credentials.yamlAll example accounts use password test123 by default.
| Role | Username |
|---|---|
| Admin | admin1 |
| Analyst | analyst1 |
| Supervisor (Commercial) | supervisor_commercial |
| Staff (Commercial) | staff_commercial |
| Passenger | passenger1 |
You can customize users, roles, and departments in auth/credentials.yaml.
- Complaints are stored in
log_file.jsonat the repo root. - When a complaint covers multiple departments, the app creates department-specific sub-complaints that share the same complaint number (
cno).
main_app.py: RBAC Streamlit application (multi-role dashboards)app.py: Minimal demo interface (Home, LiveChat, Directory, Lodger)agents.py,tasks.py,main.py: AI agents and Crew orchestrationhelperfunctions.py: complaint storage, analytics helperstools.py: external tools (train status, search, wiki)auth/: RBAC helpers and credentialsapp_pages/: role-based page modulesvars.py: department mapping and issue routing hints
- Missing Gemini key: AI features will be disabled and a Streamlit warning appears. Set
GEMINI_API_KEY. - Missing Serper key: Internet search tool returns a friendly message; chat still works without web search.
- Missing RapidAPI key: Train status tools return mocked responses.
- YAML not found: Create
auth/credentials.yaml(copy from the example).




