RoofGenius: AI Solar Planning on Real 3D Buildings

About this project
RoofGenius helps small German solar installers turn an address into a credible, explainable solar quote in minutes instead of hours.
What it does
An installer types an address in Berlin or Strausberg (Brandenburg). RoofGenius loads the official 3D model of the real building, simulates sun and shadows hour by hour over ten real weather years, and finds which neighbouring buildings and trees shade the roof. It then places panels, compares 2–3 system variants with yield, self-consumption, autarky and payback (shown as ranges, not single numbers), cites the current German rules, and drafts a customer proposal. The installer reviews and edits the layout in 2D/3D and approves before anything is sent.
How the AI works
- A LangGraph agent orchestrates the planning: it reads the installer's notes, chooses strategies, calls tools and writes the proposal.
- Deterministic engineering code computes every number (sun, shading, panel layout, yield, economics). The model is never allowed to invent a figure; validators check every number in the text against tool outputs.
- Hybrid RAG (BM25 + ChromaDB vectors + rank fusion) over a sourced corpus of German solar regulations, exposed to the agent as a tool, with citations in every proposal.
- Schema-enforced structured output, a runtime LLM judge, human-in-the-loop approval, prompt-injection defences, cost budgets per plan and full observability (cost ledger, agent traces, Langfuse).
How I know the numbers are right
- 7 evaluation suites plus DeepEval: 34/34 live agent cases, hybrid retrieval recall@5 of 1.00, 0 of 16 prompt-injection attacks successful, about $0.12 per plan.
- Physics and economics validated against independent references (NREL SPA, PVGIS, official solar registers and HTW Berlin's self-consumption calculators). This validation revealed that my first model overstated paybacks by 1.5–2 years; I rebuilt it with real weather data and measured households, and all reference cases now pass.
Tech stack
Python, FastAPI, LangGraph, LangChain, OpenRouter (Claude), ChromaDB, SQLite FTS5, pvlib, React, TypeScript, React Three Fiber, MapLibre, Docker. Over 1,900 automated tests, including 115 browser tests.
What I learnt
Offline evals can be all green while a real model fails: my first live run passed only 19 of 34 cases. Independent validation, live evaluation and honest limits (the runtime judge is weaker on real drafts than on synthetic ones, so human approval stays mandatory) mattered more than any single feature.