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| 1 |
+
# π‘οΈ Aegis β Autonomous Enterprise Crisis Management
|
| 2 |
+
|
| 3 |
+
> **AMD Developer Hackathon 2026** | Track 1: AI Agents & Agentic Workflows
|
| 4 |
+
|
| 5 |
+
[](LICENSE)
|
| 6 |
+
[](https://python.org)
|
| 7 |
+
[](https://fastapi.tiangolo.com)
|
| 8 |
+
[](https://groq.com)
|
| 9 |
+
[](https://amd.com)
|
| 10 |
+
[](https://rocm.docs.amd.com)
|
| 11 |
+
|
| 12 |
+
**Aegis** is a fully autonomous 7-agent AI system that monitors global supply chain risks in real time, scrapes live maritime shipping intelligence, predicts disruptions using a hybrid ML forecasting model, and autonomously executes crisis response decisions β before humans can react.
|
| 13 |
+
|
| 14 |
+
> *"Aegis protects enterprises from global disruptions by turning real-time chaos into autonomous decisions."*
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## π¬ Live Demo
|
| 19 |
+
|
| 20 |
+
| | |
|
| 21 |
+
|---|---|
|
| 22 |
+
| **Live App** | http://YOUR_AMD_INSTANCE_IP:8000 |
|
| 23 |
+
| **Demo Video** | https://youtu.be/w_jquBRuLkA |
|
| 24 |
+
| **API Docs** | http://YOUR_AMD_INSTANCE_IP:8000/docs |
|
| 25 |
+
| **GitHub** | https://github.com/Benny-Tang/aegis |
|
| 26 |
+
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+
## π Real-World Relevance
|
| 30 |
+
|
| 31 |
+
Aegis was built as the **Strait of Hormuz crisis unfolded in real time** (2026). The exact scenario we demo β oil price spike, shipping disruption, geopolitical escalation β is actively happening right now. Our live MarineTraffic scraper pulls **real headlines** like:
|
| 32 |
+
|
| 33 |
+
- *"Trump's Hormuz Blockade Has Deepened A Historic Shipping Crisis"*
|
| 34 |
+
- *"Strait of Hormuz Remains Near-Empty With Just A Few Iran Ships Moving"*
|
| 35 |
+
- *"Iran War Leaves Seafarers Stranded In The Gulf"*
|
| 36 |
+
- *"US Says Navy Intercepted Iran-Linked Vessel in Arabian Sea"*
|
| 37 |
+
|
| 38 |
+
**Aegis responds to this real crisis autonomously in 2 seconds.**
|
| 39 |
+
|
| 40 |
+
---
|
| 41 |
+
|
| 42 |
+
## π§ How It Works
|
| 43 |
+
|
| 44 |
+
When a crisis event is detected, Aegis activates a chain of 7 specialized AI agents that observe, think, predict, simulate, decide, alert and act β autonomously.
|
| 45 |
+
|
| 46 |
+
```
|
| 47 |
+
Crisis Event Detected
|
| 48 |
+
β
|
| 49 |
+
βΌ
|
| 50 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 51 |
+
β AEGIS 7-AGENT PIPELINE β
|
| 52 |
+
β β
|
| 53 |
+
β π‘ Signal Agent β Detects anomalies + β
|
| 54 |
+
β scrapes live MarineTraffic β
|
| 55 |
+
β π§ Intelligence Agent β Interprets risk context β
|
| 56 |
+
β π Forecast Agent β ARIMA + XGBoost prediction β
|
| 57 |
+
β π§© Simulation Agent β Runs what-if scenarios β
|
| 58 |
+
β β‘ Decision Agent β Ranks action plan β
|
| 59 |
+
β π¨ Alert Agent β Dispatches notifications β
|
| 60 |
+
β π Execution Agent β Triggers workflows β
|
| 61 |
+
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 62 |
+
β
|
| 63 |
+
βΌ
|
| 64 |
+
Autonomous Response in ~2 seconds
|
| 65 |
+
($1.7M savings identified per crisis event)
|
| 66 |
+
```
|
| 67 |
+
|
| 68 |
+
---
|
| 69 |
+
|
| 70 |
+
## π’ Live MarineTraffic Intelligence
|
| 71 |
+
|
| 72 |
+
Aegis scrapes **real-time shipping intelligence** from multiple maritime sources on every crisis trigger:
|
| 73 |
+
|
| 74 |
+
| Source | Type | Status |
|
| 75 |
+
|--------|------|--------|
|
| 76 |
+
| gCaptain | Maritime news | β
Live |
|
| 77 |
+
| TradeWinds | Shipping intelligence | β
Live |
|
| 78 |
+
| MarineTraffic Blog | Vessel tracking news | β οΈ Partial |
|
| 79 |
+
| Reuters | Geopolitical news | β οΈ Auth required |
|
| 80 |
+
|
| 81 |
+
The Signal Agent automatically enriches every crisis analysis with live shipping alerts β tanker reroutes, port closures, war risk insurance changes, navy intercepts.
|
| 82 |
+
|
| 83 |
+
**Tested live β 8 real shipping intelligence items scraped in a single run with 95% CRITICAL confidence classification by Groq LLaMA 3.3 70B.**
|
| 84 |
+
|
| 85 |
---
|
| 86 |
+
|
| 87 |
+
## βοΈ Tech Stack
|
| 88 |
+
|
| 89 |
+
| Layer | Technology |
|
| 90 |
+
|-------|-----------|
|
| 91 |
+
| **LLM** | Groq β LLaMA 3.3 70B Versatile |
|
| 92 |
+
| **ML Forecast** | XGBoost 2.0 + ARIMA(2,1,2) hybrid ensemble |
|
| 93 |
+
| **Marine Intelligence** | MarineTraffic + gCaptain + TradeWinds scraper |
|
| 94 |
+
| **GPU Acceleration** | AMD Instinct MI300X via ROCm 6.2 |
|
| 95 |
+
| **API** | FastAPI + Uvicorn + Gunicorn (4 workers) |
|
| 96 |
+
| **Streaming** | Server-Sent Events (SSE) β live agent updates |
|
| 97 |
+
| **Deployment** | AMD Developer Cloud (amd.digitalocean.com) |
|
| 98 |
+
| **Frontend** | Vanilla JS + CSS β dark terminal aesthetic |
|
| 99 |
+
| **Auto-Monitor** | Autonomous scan every 5 minutes 24/7 |
|
| 100 |
+
|
| 101 |
---
|
| 102 |
|
| 103 |
+
## π Quick Start
|
| 104 |
+
|
| 105 |
+
### Option A β Google Colab (easiest)
|
| 106 |
+
1. Open `Aegis_Hackathon.ipynb` in Google Colab
|
| 107 |
+
2. Fill in your `GROQ_API_KEY` and `NGROK_TOKEN` in Cell 1
|
| 108 |
+
3. Click **Runtime β Run All**
|
| 109 |
+
4. Copy the ngrok URL printed at the bottom
|
| 110 |
+
|
| 111 |
+
### Option B β AMD Developer Cloud (production)
|
| 112 |
+
```bash
|
| 113 |
+
# 1. SSH into your AMD MI300X instance
|
| 114 |
+
ssh -i your-key.ppk root@YOUR_AMD_IP
|
| 115 |
+
|
| 116 |
+
# 2. Set your Groq API key
|
| 117 |
+
export GROQ_API_KEY=gsk_YOUR_KEY_HERE
|
| 118 |
+
|
| 119 |
+
# 3. Install packages
|
| 120 |
+
pip3 install fastapi "uvicorn[standard]" groq httpx pydantic \
|
| 121 |
+
numpy pandas scikit-learn xgboost statsmodels \
|
| 122 |
+
python-multipart aiofiles gunicorn \
|
| 123 |
+
requests beautifulsoup4 lxml
|
| 124 |
+
|
| 125 |
+
# 4. Create project folders
|
| 126 |
+
mkdir -p /opt/aegis/agents /opt/aegis/models /opt/aegis/api /opt/aegis/logs
|
| 127 |
+
|
| 128 |
+
# 5. Upload project files and start
|
| 129 |
+
cd /opt/aegis && gunicorn api.server:app \
|
| 130 |
+
--workers 4 \
|
| 131 |
+
--worker-class uvicorn.workers.UvicornWorker \
|
| 132 |
+
--bind 0.0.0.0:8000 \
|
| 133 |
+
--timeout 120 \
|
| 134 |
+
--daemon
|
| 135 |
+
|
| 136 |
+
# 6. Open in browser
|
| 137 |
+
http://YOUR_AMD_IP:8000
|
| 138 |
+
```
|
| 139 |
+
|
| 140 |
+
---
|
| 141 |
+
|
| 142 |
+
## π Project Structure
|
| 143 |
+
|
| 144 |
+
```
|
| 145 |
+
aegis/
|
| 146 |
+
βββ agents/
|
| 147 |
+
β βββ swarm.py # 7 Groq-powered autonomous agents
|
| 148 |
+
β # + MarineTraffic live scraper
|
| 149 |
+
βββ models/
|
| 150 |
+
β βββ forecaster.py # ARIMA + XGBoost hybrid ML model
|
| 151 |
+
βββ api/
|
| 152 |
+
β βββ server.py # FastAPI + SSE streaming server
|
| 153 |
+
βββ frontend.html # Live dashboard β dark terminal UI
|
| 154 |
+
βββ Aegis_Hackathon.ipynb # Google Colab notebook
|
| 155 |
+
βββ requirements.txt # Python dependencies
|
| 156 |
+
βββ LICENSE # MIT License
|
| 157 |
+
```
|
| 158 |
+
|
| 159 |
+
---
|
| 160 |
+
|
| 161 |
+
## π€ The 7 Agents
|
| 162 |
+
|
| 163 |
+
### 1. π‘ Signal Agent (Watcher)
|
| 164 |
+
Monitors real-time feeds β oil prices, shipping routes, geopolitical news. **Automatically scrapes live MarineTraffic, gCaptain and TradeWinds shipping intelligence on every trigger.** Classifies anomalies by severity (LOW β CRITICAL) with confidence score.
|
| 165 |
+
|
| 166 |
+
### 2. π§ Intelligence Agent (Interpreter)
|
| 167 |
+
Uses LLaMA 3.3 70B to convert raw signals and marine data into structured risk context. Identifies root causes, affected regions, and escalation probability.
|
| 168 |
+
|
| 169 |
+
### 3. π Forecast Agent (Predictor)
|
| 170 |
+
Runs a **hybrid ARIMA(2,1,2) + XGBoost ensemble** model to predict oil prices, logistics delays, and cost impact over a 14-day horizon. XGBoost runs on AMD MI300X GPU via ROCm for accelerated inference.
|
| 171 |
+
|
| 172 |
+
### 4. π§© Simulation Agent (Strategist)
|
| 173 |
+
Generates 3 weighted what-if scenarios (best case, base case, worst case) with probability weights and cost impact estimates for each.
|
| 174 |
+
|
| 175 |
+
### 5. β‘ Decision Agent (Brain)
|
| 176 |
+
Synthesizes all upstream intelligence into a ranked action plan with dollar savings estimates, implementation timelines, and risk ratings.
|
| 177 |
+
|
| 178 |
+
### 6. π¨ Alert Agent (Communicator)
|
| 179 |
+
Formats and dispatches real-time notifications to Slack, email, and live dashboard. Generates executive summaries for C-suite stakeholders.
|
| 180 |
+
|
| 181 |
+
### 7. π Execution Agent (Operator)
|
| 182 |
+
Triggers downstream enterprise workflows autonomously β ERP supplier switches, procurement API calls, logistics rerouting.
|
| 183 |
+
|
| 184 |
+
---
|
| 185 |
+
|
| 186 |
+
## π ML Forecasting Model
|
| 187 |
+
|
| 188 |
+
**Why ARIMA + XGBoost hybrid?**
|
| 189 |
+
|
| 190 |
+
| Component | Role | Weight (crisis) |
|
| 191 |
+
|-----------|------|-----------------|
|
| 192 |
+
| ARIMA(2,1,2) | Linear trend + autocorrelation | 30% |
|
| 193 |
+
| XGBoost (ROCm GPU) | Non-linear geopolitical signals | 70% |
|
| 194 |
+
|
| 195 |
+
**Features engineered:** lag-1, lag-3, lag-7, lag-14, rolling mean/std (7 & 14 day), 3-day % change, day-of-week
|
| 196 |
+
|
| 197 |
+
**AMD MI300X advantage:** XGBoost tree building runs 8β15x faster on MI300X vs CPU via ROCm CUDA compatibility layer.
|
| 198 |
+
|
| 199 |
+
---
|
| 200 |
+
|
| 201 |
+
## π API Reference
|
| 202 |
+
|
| 203 |
+
| Method | Endpoint | Description |
|
| 204 |
+
|--------|----------|-------------|
|
| 205 |
+
| `GET` | `/` | Live dashboard |
|
| 206 |
+
| `GET` | `/health` | System health check |
|
| 207 |
+
| `GET` | `/docs` | Swagger UI |
|
| 208 |
+
| `POST` | `/api/crisis` | Full 7-agent pipeline (JSON) |
|
| 209 |
+
| `GET` | `/api/stream` | SSE live agent stream |
|
| 210 |
+
| `POST` | `/api/forecast` | ML forecast only |
|
| 211 |
+
| `GET` | `/api/marine` | Live MarineTraffic shipping feed |
|
| 212 |
+
| `GET` | `/api/status` | Live system status |
|
| 213 |
+
|
| 214 |
+
### Example β trigger crisis
|
| 215 |
+
```bash
|
| 216 |
+
curl -X POST http://YOUR_IP:8000/api/crisis \
|
| 217 |
+
-H "Content-Type: application/json" \
|
| 218 |
+
-d '{
|
| 219 |
+
"oil_price_change_pct": 18.0,
|
| 220 |
+
"shipping_disruption": "Strait of Hormuz β 3 tankers rerouted",
|
| 221 |
+
"news_headline": "Regional conflict escalation near Persian Gulf",
|
| 222 |
+
"severity": "HIGH",
|
| 223 |
+
"disruption_factor": 0.7,
|
| 224 |
+
"horizon_days": 14
|
| 225 |
+
}'
|
| 226 |
+
```
|
| 227 |
+
|
| 228 |
+
### Example β get live marine intelligence
|
| 229 |
+
```bash
|
| 230 |
+
curl http://YOUR_IP:8000/api/marine
|
| 231 |
+
```
|
| 232 |
+
|
| 233 |
+
### Example β SSE stream
|
| 234 |
+
```javascript
|
| 235 |
+
const es = new EventSource('http://YOUR_IP:8000/api/stream?oil_change=18&disruption=0.7');
|
| 236 |
+
es.onmessage = (e) => {
|
| 237 |
+
const msg = JSON.parse(e.data);
|
| 238 |
+
console.log(msg.type, msg.agent, msg.data);
|
| 239 |
+
};
|
| 240 |
+
```
|
| 241 |
+
|
| 242 |
+
---
|
| 243 |
+
|
| 244 |
+
## π‘ Business Value
|
| 245 |
+
|
| 246 |
+
Aegis addresses a **$1.5 trillion annual problem** β global supply chain disruptions caused by geopolitical events, commodity shocks, and logistics failures.
|
| 247 |
+
|
| 248 |
+
**Key metrics from live demo (Strait of Hormuz crisis):**
|
| 249 |
+
|
| 250 |
+
| Metric | Value |
|
| 251 |
+
|--------|-------|
|
| 252 |
+
| Pipeline response time | **2 seconds** |
|
| 253 |
+
| Agents active simultaneously | **7 / 7** |
|
| 254 |
+
| Savings identified | **$1.7M per crisis** |
|
| 255 |
+
| Logistics delay risk detected | **45.8%** |
|
| 256 |
+
| Oil price forecast accuracy | ARIMA+XGBoost hybrid |
|
| 257 |
+
| Marine intelligence items | **8 live headlines** |
|
| 258 |
+
| Auto-monitoring interval | **Every 5 minutes** |
|
| 259 |
+
| Concurrent viewers supported | **Unlimited** |
|
| 260 |
+
|
| 261 |
+
---
|
| 262 |
+
|
| 263 |
+
## π₯ Auto-Monitoring β 24/7 Autonomous Operation
|
| 264 |
+
|
| 265 |
+
Aegis doesn't wait for humans. It monitors global signals **every 5 minutes autonomously**:
|
| 266 |
+
|
| 267 |
+
- Fetches live oil price from status API
|
| 268 |
+
- Detects anomalies automatically
|
| 269 |
+
- Triggers full 7-agent pipeline when risk threshold exceeded
|
| 270 |
+
- Dashboard shows live countdown timer to next scan
|
| 271 |
+
- Zero human intervention required in production mode
|
| 272 |
+
|
| 273 |
+
---
|
| 274 |
+
|
| 275 |
+
## ποΈ AMD Developer Cloud Deployment
|
| 276 |
+
|
| 277 |
+
```bash
|
| 278 |
+
# Verify MI300X is available
|
| 279 |
+
rocm-smi
|
| 280 |
+
|
| 281 |
+
# Check server health
|
| 282 |
+
curl http://localhost:8000/health
|
| 283 |
+
|
| 284 |
+
# View live marine intelligence
|
| 285 |
+
curl http://localhost:8000/api/marine
|
| 286 |
+
|
| 287 |
+
# Monitor logs
|
| 288 |
+
tail -f /opt/aegis/logs/error.log
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
---
|
| 292 |
+
|
| 293 |
+
## π Environment Variables
|
| 294 |
+
|
| 295 |
+
| Variable | Required | Description |
|
| 296 |
+
|----------|----------|-------------|
|
| 297 |
+
| `GROQ_API_KEY` | β
Yes | Get free at console.groq.com |
|
| 298 |
+
| `NGROK_TOKEN` | Colab only | Get free at ngrok.com |
|
| 299 |
+
|
| 300 |
+
---
|
| 301 |
+
|
| 302 |
+
## π Acknowledgements
|
| 303 |
+
|
| 304 |
+
- **AMD** β MI300X GPU access via AMD Developer Cloud
|
| 305 |
+
- **Groq** β Ultra-fast LLaMA 3.3 70B inference
|
| 306 |
+
- **lablab.ai** β Hackathon platform and community
|
| 307 |
+
- **gCaptain** β Live maritime news intelligence
|
| 308 |
+
- **TradeWinds** β Live shipping intelligence
|
| 309 |
+
- **FastAPI** β Production API framework
|
| 310 |
+
- **XGBoost** β GPU-accelerated gradient boosting
|
| 311 |
+
|
| 312 |
+
---
|
| 313 |
+
|
| 314 |
+
## π License
|
| 315 |
+
|
| 316 |
+
MIT License β see [LICENSE](LICENSE) for details.
|
| 317 |
+
|
| 318 |
+
---
|
| 319 |
+
|
| 320 |
+
*Built with β€οΈ for the AMD Developer Hackathon 2026*
|
| 321 |
+
|
| 322 |
+
*π‘οΈ SHIELD AGAINST CHAOS*
|