Project Info
Inspiration
Energy markets are notoriously volatile, and a single price spike can cost utilities and traders millions. Yet understanding why a spike happened requires cross-referencing real-time prices, grid load, fuel mix, and weather data across multiple sources. We wanted to build an AI copilot that could do this analysis in seconds, using only free, public data. This democratizes energy market intelligence that typically costs $50K+/year from incumbent platforms. Identification of these spikes also provide opportunities for more sustainable energy consumption.
What it does
EnergyX monitors ERCOT and CAISO power markets in real-time and answers three questions: what happened, why, and what's likely next. It features: Live Dashboard with WebSocket price feeds, load curves, and fuel mix charts AI Spike Explainer that uses a multi-agent LangGraph pipeline (Data, Analysis, Narrative, Verification) to produce evidence-backed explanations of price anomalies ML Forecasting with XGBoost models that predict next-interval prices and spike probabilities Geographic Grid Map showing live node prices and spike hotspots RAG-powered Search using ChromaDB and Elasticsearch to find historical patterns Automated Daily Briefs and configurable email alerts
How we built it
Backend: FastAPI with async SQLite for low-latency data access. We built a data pipeline using the open-source gridstatus library to ingest ISO market data and NWS weather forecasts on a 15-minute schedule, with a 45-second WebSocket live feed. AI Layer: A LangGraph multi-agent pipeline where specialized agents collect data, run spike detection (z-score based), build context packs, generate narratives via GPT-5, and cross-verify results using a secondary Mistral 7B model on RunPod. Spike explanations are indexed into ChromaDB and Elasticsearch for RAG retrieval for future analysis. ML: XGBoost models trained on engineered features (price lags, rolling stats, hour/day cyclical encodings, momentum indicators) for price regression and spike classification with 90% confidence intervals. Frontend: React 19 + TypeScript with Tailwind CSS, Recharts for interactive visualizations, SSE streaming for real-time AI explanations, and a responsive sidebar layout with live connection indicators and toast alerts.
Challenges we ran into
Market data reliability: ISO APIs are slow and inconsistent, so we implemented a DB-first, live-fallback strategy with stale-while-revalidate caching to handle outages gracefully. LLM verification: Single-model explanations sometimes gave us hallucinated drivers. We added a verification loop in LangGraph and cross-verification via a secondary model to catch errors. Timezone complexity: ERCOT runs on Central time, CAISO on Pacific, so the solar generation relevance depends on local time (6 AM–7 PM), requiring careful timezone-aware logic throughout. SSL issues with CAISO: macOS Python's SSL certificates don't include CAISO's CA, requiring a certifi-based patch.
What we learned
We learned that the hardest part of AI applications isn't the model, it's actually building reliable data pipelines and context assembly. The quality of our spike explanations improved dramatically when we invested in better context packs (correlating prices with load ramps, fuel mix shifts, and weather data) rather than prompt engineering alone. We also gained deep appreciation for multi-agent architectures where verification agents catch hallucinations that single-pass generation misses.
What's next
Expand ISO coverage — Add PJM, NYISO, SPP, and MISO to cover all major US power markets, giving nationwide visibility into price dynamics. Real-time trading signals — Evolve spike predictions from informational alerts into actionable buy/sell signals with backtested confidence scores for energy traders. Fine-tuned energy LLM — Train a domain-specific model on our growing RAG corpus of indexed spike explanations and market briefs to reduce reliance on standard LLM models and lower our latency. Renewable integration forecasting — Add solar irradiance and wind speed forecasting models to predict how renewable generation ramps will impact prices before they happen. Mobile app with push alerts — React Native companion app so grid operators and traders get spike alerts and AI briefs on the go. Utility partnerships — Integrate with SCADA/DERMS data from willing utility partners to unlock even deeper root-cause analysis that public data alone can't provide. Historical pattern matching — Use our Elasticsearch index of past spike events to surface "this spike looks like X from last summer" comparisons, giving analysts instant historical context.
EnergyX — Real-Time Energy Market Intelligence Copilot
EnergyX answers "what happened, why, and what's likely next" in US power markets using public ISO/RTO and weather data. It produces evidence-backed spike explanations, alerts, and daily briefs — without requiring utility/SCADA/DERMS integrations.
Quick Start
Backend (Python / FastAPI)
cd backend
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your OpenAI API key (required) and other credentials
# Run the server
uvicorn app.main:app --reload --port 8000
API docs available at: http://localhost:8000/docs
Frontend (React / TypeScript)
cd frontend
# Install dependencies
npm install
# Run dev server (proxies /api to backend on port 8000)
npm run dev
Open http://localhost:5173 in your browser.
Architecture
backend/
├── app/
│ ├── main.py # FastAPI entry point
│ ├── config.py # Environment config
│ ├── database.py # SQLAlchemy async setup
│ ├── models/ # DB models (prices, load, weather, alerts)
│ ├── ingestion/ # Data pipeline (gridstatus + NWS)
│ │ ├── iso_fetcher.py # ERCOT + CAISO data via gridstatus
│ │ ├── weather.py # NWS API client
│ │ └── scheduler.py # APScheduler for periodic ingestion
│ ├── analytics/ # Deterministic metrics + spike detection
│ │ ├── metrics.py # Volatility, ramps, forecast error
│ │ └── spike_detector.py # Threshold-based anomaly detection
│ ├── intelligence/ # AI-powered analysis
│ │ ├── context_builder.py # Assembles "context pack" for LLM
│ │ ├── explainer.py # OpenAI narrative generation
│ │ ├── daily_brief.py # Automated morning report
│ │ └── screener.py # Node/zone ranking
│ ├── alerts/ # Alert engine (Slack + email)
│ └── api/ # FastAPI route handlers
frontend/
├── src/
│ ├── api/client.ts # Typed API client
│ ├── components/ # Reusable UI (charts, cards, panels)
│ └── pages/ # Dashboard, Spike Explainer, Brief, Screener, Alerts
Key API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/api/market/prices | GET | Fetch LMP/SPP prices |
/api/market/load | GET | Fetch system load data |
/api/market/fuel-mix | GET | Fetch generation fuel mix |
/api/explain/spike | POST | Generate spike explanation |
/api/briefs/today | GET | Get today's daily brief |
/api/screener/top | GET | Get ranked locations |
/api/alerts/ | CRUD | Manage alert configurations |
Data Sources (All Free / Public)
- gridstatus (open-source) — Unified Python interface to ERCOT, CAISO
- NWS API — Weather forecasts and alerts (no key required)
- OpenAI API — Narrative generation (requires API key)
Team Workflow
The codebase is divided into 3 independent work streams:
- Data Pipeline (
ingestion/+analytics/) — ISO data, weather, metrics, spike detection - AI Layer (
intelligence/+alerts/) — Context builder, LLM explainer, briefs, alerts - Frontend (
frontend/) — Dashboard, spike explainer UI, charts, alert config
Analysis
View
Metric
- 6
- 6
- 5
- 3
- 2
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- FastAPIIn code
- HTMLIn code
- JavaScriptIn code
- OpenAIIn code
- PythonIn code
- ReactIn code
- Tailwind CSSIn code
- TypeScriptIn code
- LangChainClaimed
9 of 10 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
- Claude CodeCommits
- CursorCommits
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
479 KB
Source files
85
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
adi-kulkarni1/TreeHacks2026
97 files · 640 KB · @ dbf7c4d
Structure
Interface
58 files · 60%Screens, components and styles rendered to the user.
API & routing
13 files · 13%Request entry points: routes, handlers and controllers.
Application logic
9 files · 9%Domain rules, services and shared utilities.
Data & schema
2 files · 2%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python54%
- TypeScript39%
- Markdown6%
- CSS1%
- HTML0%
- JavaScript0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
backend/requirements.txt
pypi · 24- aiosqlite
- apscheduler
- certifi
- chromadb
- elasticsearch[async]
- fastapi
- gridstatus
- httpx
- joblib
- langchain-core
- langchain-openai
- langgraph
- mcp
- numpy
- openai
- pandas
- pydantic-settings
- python-dotenv
- +6 more
frontend/package.json
npm · 20- axios
- lucide-react
- react
- react-dom
- react-router-dom
- recharts
- +14 more
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.