An open API service indexing awesome lists of open source software.

https://github.com/sentinelbyte/weatherforcastmas

Multi-Agent-System that fetches real-time weather data, generates activity suggestions, and organizes a 7-day forecast.
https://github.com/sentinelbyte/weatherforcastmas

Last synced: 4 months ago
JSON representation

Multi-Agent-System that fetches real-time weather data, generates activity suggestions, and organizes a 7-day forecast.

Awesome Lists containing this project

README

          

# WeatherForecastMAS 🌦️

WeatherForecastMAS is a **Multi-Agent System (MAS)** that fetches live weather data, plans daily activities, and maintains a 7-day forecast.
It is designed for learning MAS concepts and for practical use as a personal weather + activity assistant.

---

`Owner: DanCohVax`

## πŸš€ Features
- **Daily Weather Plan** β†’ Fetches today’s conditions & suggests a randomized activity.
- **Weekly Forecast** β†’ Stores 7-day weather outlook.
- **Automatic Updates** β†’ Refreshes forecast every 6 hours via UpdateAgent.
- **Dashboard** β†’ View data in a Streamlit-powered local web app.
- **Event-Driven MAS** β†’ Agents communicate via a simple Pub/Sub EventBus.
- **History Tracking** β†’ Maintains daily weather and activity history with timestamps.
- **Lightweight & Free** β†’ Uses free-tier weather APIs.

---

## πŸ“‚ Project Structure
```

weather\_mas/
β”‚
β”œβ”€β”€ agents/ # all agents live here
β”‚ β”œβ”€β”€ weather\_agent.py # fetch today’s weather, update history, publish event
β”‚ β”œβ”€β”€ planner\_agent.py # suggest activities, update history, subscribe to weather events
β”‚ β”œβ”€β”€ forecast\_agent.py # fetch 7-day forecast, update history
β”‚ β”œβ”€β”€ update\_agent.py # refresh forecast & notify planner periodically
β”‚ └── display\_agent.py # output via console or Streamlit dashboard
β”‚
β”œβ”€β”€ data/ # storage for JSON / DB
β”‚ β”œβ”€β”€ today.json # latest weather
β”‚ β”œβ”€β”€ forecast.json # 7-day forecast
β”‚ └── history/ # historical records
β”‚ β”œβ”€β”€ weather\_history.json # daily weather records with timestamps
β”‚ └── activity\_history.json # daily activity suggestions with timestamps
β”‚
β”œβ”€β”€ dashboard/ # Streamlit dashboard files
β”‚ └── app.py
β”‚
β”œβ”€β”€ utils/ # helpers (logging, API calls, config)
β”‚ β”œβ”€β”€ api\_client.py
β”‚ β”œβ”€β”€ config.py # API keys, city, units
β”‚ └── event\_bus.py # simple Pub/Sub EventBus implementation
β”‚
β”œβ”€β”€ main.py # entry point β†’ runs daily workflow using agents
β”œβ”€β”€ main\_event\_mas.py # optional: MAS workflow with EventBus and dashboard
β”œβ”€β”€ update.py # entry point β†’ runs every 6h (Update Agent)
β”œβ”€β”€ requirements.txt # dependencies: requests, streamlit, etc.
└── README.md

````

---

## βš™οΈ Configuration
Create a `utils/config.py` file with your weather API key:

```python
API_KEY = "your_weather_api_key"
CITY = "Berlin"
UNITS = "metric" # "imperial" for Fahrenheit
````

You can use [WeatherStack](https://weatherstack.com/) or another free API.

> ⚠️ Do **not** commit `config.py` to GitHub. Use `config.example.py` instead.

---

## πŸ› οΈ Installation

1. Clone the repo:

```bash
git clone https://github.com/SentinelByte/WeatherForcastMAS.git
cd WeatherForecastMAS
```

2. Install dependencies:

```bash
pip install -r requirements.txt
```

---

## ▢️ Usage

### Run Daily Workflow (fetch today’s weather + weekly forecast)

```bash
python main.py
```

### Run EventBus MAS (optional, with dashboard & inter-agent events)

```bash
python main_event_mas.py
```

### Run Forecast Updater (every 6h, via cron/Task Scheduler)

```bash
python update.py
```

### Run Dashboard (local visualization)

```bash
streamlit run dashboard/app.py
```

---

## πŸ“… Automation

Use cron (Linux/macOS) or Task Scheduler (Windows) to automate:

```bash
# Run daily plan at 7 AM
0 7 * * * /usr/bin/python3 /path/to/weather_mas/main.py

# Run forecast updater every 6 hours
0 */6 * * * /usr/bin/python3 /path/to/weather_mas/update.py
```

---

## πŸ“Œ Roadmap

* [ ] Add support for multiple cities
* [ ] Store historical weather in SQLite
* [ ] Email/Telegram notifications
* [ ] Grafana/Streamlit advanced dashboard
* [ ] Add AI-powered activity recommendations

---

## πŸ“œ License

MIT License – feel free to use and modify.