An LLM-powered agent that answers real questions about Bangladeshi hospitals, institutions, and restaurants β grounded in real datasets, not hallucinations.
Overview β’ Demo β’ Architecture β’ Setup β’ Skills Demonstrated
BD Agent is a tool-using AI agent built with LangChain that answers questions about Bangladesh by querying real structured data instead of relying purely on an LLM's memory. It combines:
- ποΈ Three real-world datasets (hospitals, educational institutions, restaurants) ingested from HuggingFace into local SQLite databases
- π§ An LLM-based agent that reasons about which tool best answers a given question
- π A live web-search tool for general knowledge questions outside the datasets
The result: a domain-specific assistant that gives accurate, data-backed answers β a practical demonstration of retrieval-augmented, tool-using AI systems, one of the most in-demand patterns in applied AI/ML engineering today.
> How many hospitals are in Dhaka?
> List hospitals with ICU facilities in Chittagong.
> What universities are listed in the institutions database?
> Show popular restaurants serving Bengali cuisine in Sylhet.
> What is the role of DGHS in Bangladesh?
The agent automatically routes each question to the correct tool β SQL query against the right database, or a live web search β without the user needing to specify which.
ββββββββββββββββββββββββ
β User Question β
ββββββββββββ¬ββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β agent.py (LangChain) β
β LLM decides best tool β
ββββββββββββββ¬ββββββββββββ
β
βββββββββββββββ¬βββββββββββΌβββββββββββ¬ββββββββββββββ
βΌ βΌ βΌ βΌ
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Hospitals ββ Institutionsββ Restaurants ββ Web Search β
β SQL Tool ββ SQL Tool ββ SQL Tool ββ (SerpAPI) β
ββββββββ¬βββββββββββββββ¬βββββββββββββββ¬βββββββββββββββββββββββ
βΌ βΌ βΌ
dbs/hospitals.db dbs/institutions.db dbs/restaurants.db
β β β
ββββββββββββββββ΄βββββββββββββββ
βΌ
βββββββββββββββββ
β Final Answer β
βββββββββββββββββ
Data pipeline: ingest.py pulls each dataset from HuggingFace β converts to a pandas DataFrame β normalizes column names β writes to a local SQLite .db file via to_sql().
bd_multi_tool_ai_agent/
βββ agent.py # Entry point β builds & runs the LangChain agent
βββ ingest.py # Downloads datasets & builds SQLite databases
βββ tools/
β βββ db_tools.py # SQL tools: hospitals, institutions, restaurants
β βββ web_search_tool.py # SerpAPI web-search tool
βββ requirements.txt # Python dependencies
βββ .env.example # API key template
βββ .gitignore # Excludes secrets, DBs, venv
| Source (HuggingFace) | Local Table |
|---|---|
Mahadih534/Institutional-Information-of-Bangladesh |
institutions |
Mahadih534/all-bangladeshi-hospitals |
hospitals |
Mahadih534/Bangladeshi-Restaurant-Data |
restaurants |
Adding a new dataset is a one-line change β add a save_dataset_to_db(dataset_name, table_name, db_path) call in ingest.py.
git clone https://github.com/delowarhossaincse63/bd_multi_tool_ai_agent.git
cd bd_multi_tool_ai_agentpython -m venv venv
venv\Scripts\activate # Windows
source venv/bin/activate # macOS / Linuxpip install -r requirements.txtcopy .env.example .env # Windows
cp .env.example .env # macOS / LinuxThen add your keys to .env:
OPENAI_API_KEY=your_openai_key_here
SERPAPI_API_KEY=your_serpapi_key_here
python ingest.pyCreates dbs/hospitals.db, dbs/institutions.db, dbs/restaurants.db.
python agent.py # interactive mode
python agent.py "How many hospitals are in Dhaka?" # direct queryThis project showcases practical, job-relevant experience with:
- LLM Agent Design β building tool-using agents with LangChain that reason about task routing
- Data Engineering β ETL pipeline: dataset ingestion, cleaning, normalization, and loading into SQLite
- API Integration β OpenAI API and SerpAPI, with secure key management via
.env - Database Design β schema normalization, SQL query tools, de-duplication logic
- Software Engineering Practices β modular code structure,
.gitignorehygiene, secret management, reproducible setup - Applied AI for Real-World Data β grounding LLM output in verified datasets to reduce hallucination
sqlite3 dbs/hospitals.db "PRAGMA table_info('hospitals');"
sqlite3 dbs/hospitals.db "SELECT COUNT(*) FROM hospitals;"Or in Python:
import sqlite3
conn = sqlite3.connect('dbs/hospitals.db')
cur = conn.cursor()
print(cur.execute("SELECT name FROM sqlite_master WHERE type='table';").fetchall())
print(cur.execute("SELECT count(*) FROM hospitals;").fetchone())
conn.close()The following are excluded from version control via .gitignore:
.envβ API keysdbs/*.dbβ generated database filesvenv//.venv/β virtual environment__pycache__/,*.pyc
If a secret is ever committed accidentally:
git rm --cached .env
git commit -m "Remove .env from tracking"
git commit --amend --no-edit
git push -f origin main| Issue | Solution |
|---|---|
OPENAI_API_KEY is required |
Confirm .env exists and contains the key; restart the terminal. |
| GitHub blocks push (secret detected) | Remove the secret, amend the commit, force-push. |
| Agent gives unexpected answers | Check console logs for tracebacks; verify all keys in .env. |
| Web search not working | Confirm SERPAPI_API_KEY is set β without it, only SQL tools work. |
- Add more Bangladesh-specific datasets (transport, weather, government services)
- Build a lightweight web UI (Streamlit/FastAPI)
- Add caching for repeated queries
- Deploy as a public demo
Contributions, issues, and feature requests are welcome. Feel free to check the issues page.
This project is licensed under the MIT License.
Delowar Hossain π§ delowarhossain.cse.63@gmail.com π GitHub
β If you find this project useful, consider giving it a star!