A simple AI-powered weather assistant that fetches real-time weather data for any city using an external API and processes it through a structured Python backend.
- 🌍 Get real-time weather data for any city
- 🤖 AI-agent style architecture (modular design)
- ⚙️ Clean separation of logic (
app.py,_utils.py) - 🔌 API integration (WeatherAPI / Open-Meteo)
- 🧠 Easy to extend into a full AI agent
Weather-AI-Agent/
│
├── app.py # Main entry point
├── agent/
│ ├── __init__.py
│ ├── _utils.py # Utility functions (API calls, parsing)
│
├── requirements.txt
├── .gitignore
└── README.md
- Clone the repository:
git clone https://github.com/your-username/weather-ai-agent.git
cd weather-ai-agent
- Create a virtual environment:
python -m venv .venv
.venv\Scripts\activate # Windows
- Install dependencies:
pip install -r requirements.txt
This project uses a weather API.
- Get your API key from: https://www.weatherapi.com/
- Replace in code:
API_KEY = "your_api_key"
Run the application:
python app.py
Enter a city name when prompted:
Enter city: Delhi
Example output:
Temperature: 32°C
Condition: Sunny
Humidity: 45%
- Ensure correct imports:
from agent import _utils
- Check API key
- Ensure correct URL format:
http://api.weatherapi.com/v1/current.json?key=API_KEY&q=city
- Free API plans have limits
- Switch to Open-Meteo (no API key required)
- 🔄 Add forecast support
- 🌐 Build a FastAPI backend
- 💬 Integrate with LLM (LangChain)
- 📊 Add UI (React frontend)
- 🧠 Make it a fully autonomous AI agent
Pull requests are welcome! Feel free to fork and improve the project.
This project is open-source and available under the MIT License.
Mahek Patel Backend Developer | AI Enthusiast