Inspiration
Commercial rooftops are one of the largest untapped spaces for clean energy. They are flat, close to where power is used, and mostly empty. Yet commercial solar sales still start with someone scrolling satellite maps and building spreadsheets by hand. We wanted to know whether an AI agent could do that first pass, combining real building data, aerial imagery and a physics-based energy model. Houston was a natural place to test it: plenty of sun, thousands of large flat-roofed offices, and a grid (ERCOT) that still runs mostly on fossil fuels.
What it does
RoofWatt is an AI agent that ranks commercial rooftops by solar economics and writes the first letter to the owner. You ask in plain English:
"Find the 10 office buildings in Houston with the best solar payback and draft a pitch for the top one."
The agent then:
- Screens every matching building in the CoStar extract (185 Houston offices). It drops systems under 50 kW and ranks the remaining 171.
- Sizes a rooftop system for each one from its CoStar floor data.
- Estimates yearly energy with NREL's PVWatts v8 at the building's exact latitude and longitude.
- Computes savings, installed cost, the 30% federal tax credit, simple payback and CO₂ avoided.
- Pulls a Vexcel aerial image of the top roof so you can check the estimate yourself.
- Drafts a proposal letter for the owner that uses only numbers the tools produced.
The Streamlit app has five pages. Analyze shows a live trace of each tool call. Results shows KPIs, a ranked table and a 2D map colored from the best rank (green) to the lowest (red). Building shows the roof image and details. Proposal shows the letter with Copy and Download buttons. Assumptions lists every input with its source, and you can change them there and re-rank immediately.
In our demo run, the best building has a 1.17 MW system, saves about $142k a year, pays back in 10.9 years and avoids 553 t of CO₂ a year. All 171 ranked Houston offices together come to about 37 MW, 52 GWh a year and 17,400 t of CO₂ avoided each year.
How we built it
- Agent: LangChain
deepagentswith tools that do all the math (rankBuildings,getBuilding,analyzeRoof,estimateSolar,computeFinancials,getRoofImage). There is an AI engine switch: Cloud runs Gemini, Local runs any Ollama model (we usedqwen3.5:4b). If Gemini hits its quota, the app moves to the local model automatically. - Data: the CoStar hackathon extract (building type, size, floors, location) and Vexcel aerial imagery. That is two of the three CoStar data layers.
- Energy: NREL PVWatts v8 (fixed open rack, 15° tilt, facing south, 14% losses), with results cached on disk.
- Model:
$$A_{\text{roof}} = \min!\left(A_{\text{typical floor}},\ \frac{A_{\text{gross}}}{\text{stories}}\right)\times 0.0929 \times f_{\text{usable}}$$
$$P_{\text{kW}} = A_{\text{roof}} \times 0.211 \times 0.70 \qquad E_{\text{kWh}} = \text{PVWatts}(\text{lat}, \text{lon}, P_{\text{kW}})$$
$$\textit{Payback} = \dfrac{P_{kW}\cdot 1000\cdot c(P_{kW})(1-0.3)}{E_{kWh}\cdot 0.0856}$$
$$\text{CO2} = E_{kWh} \cdot \dfrac{1}{3} \dfrac{kg}{kWh}$$
Here \(c(P)\) is the installed price per watt by system size (LBNL 2026 data update). The electricity rate comes from EIA (Texas commercial), the grid emission factor from EPA eGRID 2023 (ERCOT) and the tax credit from IRC §48E. Each value is stored in one config file next to its citation.
- UI: Streamlit and pydeck, with Catppuccin light and dark themes. Deployed on Streamlit Community Cloud.
- Tests: 120 pytest tests, including Streamlit
AppTestruns with fake agents (no LLM or network needed).
Challenges we ran into
- Roof size was the hardest part. We first estimated the roof as gross area ÷ stories. Comparing against the Vexcel images showed this overstated towers by up to 2×. We switched to the smaller of typical floor size and gross ÷ stories, and we ignore typical-floor values that are clearly data errors.
- Keeping the LLM out of the arithmetic. Early runs had the model "helpfully" recalculating or rounding numbers. We moved all math into tools, made the tools rank all buildings in code, and added strict rules so the letter only copies tool numbers.
- Small local models.
qwen3.5:4bspent its whole token budget on hidden reasoning and stopped mid-answer. Turning reasoning off and giving it a fixed list of tool calls got the demo query down to about 45 seconds on a laptop. - Rate limits everywhere: PVWatts returned 429 errors when we ran it on 8 threads, Overpass (OSM) timed out, and Gemini's free tier allows 20 requests a day. Caching, sequential cache warm-up and the cloud-to-local fallback kept the demo working.
- Ties in the ranking: many buildings ended up with the same payback because their price-per-watt tier was the same. We now break ties by CO₂ avoided, so every building gets its own rank.
Accomplishments that we're proud of
- No made-up numbers. Every number on screen comes from a tool, and every assumption has a source you can read on the Assumptions page.
- The agent screens a whole city's office stock and doesn't stop at the first few results. It then writes the letter for the best one.
- It runs fully offline on a 4B model, so you don't need a cloud API key to use it.
- We checked our roof estimates against real aerial imagery instead of trusting the database.
- The app is deployed, with a live trace of every tool call so judges can see what the agent did.
What we learned
- An agent becomes trustworthy when the LLM handles planning and language and deterministic tools handle every number.
- Building databases aren't ground truth: you need to check footprint data against imagery before relying on it.
- Solar economics depend heavily on system size. Price per watt drops a lot above 1 MW, which changes which buildings rank first.
- Tax rules change quickly. The 30% ITC now requires solar projects to be in service by the end of 2027, which makes "which roofs first" a time-sensitive question.
What's next for RoofWatt
- Measure the roof from the image itself: use segmentation (e.g. Segment Anything) on Vexcel images to subtract HVAC units and odd shapes. Today, V- and X-shaped buildings can be overestimated by about 20%.
- More accurate finance: a 25-year NPV with degradation, real utility tariffs (energy vs. demand charges) and the ITC deadline stated in the letter.
- More property types and cities: warehouses and retail have even better roofs, and the pipeline works for any city in the CoStar data.
- Matterport interiors to check where electrical rooms and interconnection points are.
- Installer workflow: export leads to a CRM and track the outreach that follows each letter.
Built With
- carto
- costar
- deepagents
- gemini
- git-lfs
- langchain
- nrel-pvwatts
- ollama
- openstreetmap
- overpass-api
- pandas
- pydantic
- pydeck
- pytest
- python
- qwen
- streamlit
- uv
- vexcel
