Air Quality AgentAI Agent
Toulouse Air Intelligence
Sole builder. I chose the open dataset, built the agent, the voice loop and the dashboard, and kept every answer traceable to the pandas code the agent runs on the data.
Problem
Atmo Occitanie publishes Toulouse's air-quality measurements as open data: 51,143 daily readings from 10 stations and six pollutants since August 2022. The numbers are public, but a question as simple as which station had the most NO2 last year still means opening a spreadsheet or writing pandas code, so the data mostly answers people who can program.
Solution
A personal project in Python. A dashboard with filters and five charts sits next to an AI analyst. You ask it in English or French, by typing or by voice, and a LangChain agent answers by writing and running pandas code on the data currently on screen, then reads the answer aloud. The API key stays on the server, and the public demo is behind a password.
| # | Feature | What it does |
|---|---|---|
| 01 | Ask in plain language | Questions go in as everyday sentences. The agent decides which calculation answers them, writes it in pandas and runs it, so every number comes from the data rather than from the model's memory. |
| 02 | Answers from what is on screen | Pollutant, station, monitoring context and date filters shape the charts and the agent's data at once, so a question always refers to the view in front of you. |
| 03 | Talk to it | The microphone records in the browser, Whisper transcribes the question and the agent answers it like a typed one. |
| 04 | Spoken replies | Each answer is also read aloud with Kokoro, in English or in French, following the language picked in the navbar. |
| 05 | Five charts | Weekly concentrations, monthly levels by monitoring context, a station by pollutant heatmap, distributions, and a station ranking for one pollutant at a time. |
| 06 | Keys stay on the server | The project key never reaches the browser. Visitors bring their own fal.ai key for their session, or unlock the demo with a password. |
Stack
| Layer | Technology | Role |
|---|---|---|
| Tooling | AI-assisted development | |
| Language | App, agent and voice loop | |
| AI agent | Pandas dataframe agent with tool calling | |
| Model | The agent's model, through fal.ai's OpenRouter | |
| Data | The analysis the agent writes and runs | |
| Voice | Whisper, Kokoro | Speech to text and text to speech, on fal.ai |
| Interface | NiceGUI | Dashboard, filters and chat |
| Charts | The five charts | |
| Database | Measurements and chat history | |
| Infrastructure | Local MongoDB |
Architecture
People
- VisitorDemo unlocked
- filterstoDashboard
In the browser
- DashboardFilters and five charts
NiceGUI · Plotly- filterstoData on screen
- Analyst chatTyped or spoken
MediaRecorder- questiontoPandas agent
- audiotoVoice
Python server
- Data on screen
_apply_filters - Pandas agent
answer_question- tool callstoGPT-4o mini
- Voice
transcribe_audiosynthesize_speech- speechtoWhisper · Kokoro
Data and models
- MongoDB51,143 readings · Chat history
- readingstoData on screen
- GPT-4o minifal.ai OpenRouter
- Whisper · Kokorofal.ai
Results
- 51,143Air-quality readings to ask about
- 2Ways to ask: typed or spoken
- 2Languages, English and French
The agent computes every answer from the data on screen by running pandas code, so its numbers can be checked against the dataset.
