Governed analytics over a synthetic retail bank
Thinking...
How to try this
- Pick an example, or type your own question.
- Open SQL to see the exact query that ran.
- Open How it was answered to see the route.
A certified metric is answered from the governed semantic layer, so the query comes from tested definitions rather than from a model. When no certified metric matches, the model writes SQL and a guard checks it before it runs.
What Lumen does
Ask a business question in plain language about a synthetic retail bank: spend, loans, cards, complaints, or the bank's own policies. Lumen answers it, then shows its working: the exact SQL that ran, the rows it returned, and the route it took to get there.
How a question is answered
- 1. QuestionYou type a question. It is checked against your token's daily budget.
- 2. RouterA model decides the path: a certified metric, a free-form data question, or a policy document.
- 3a. Semantic layerFor a certified metric, a deterministic compiler builds the SQL from tested definitions. No model writes this SQL.
- 3b. Text-to-SQL, guardedWhen no metric fits, a model writes the SQL and a guard parses and checks it before it runs.
- 3c. Policy documentsPolicy questions are answered from the bank's documents, with the sources cited.
- 4. WarehouseQueries run with a row cap and a time limit. Columns marked PII are masked as ***.
- 5. AnswerText, rows, the SQL and a step-by-step trace of how it was reached.
What makes it different
- Certified numbers. Common metrics come from tested definitions, so the same question gives the same figure every time.
- Every answer shows its working. Open SQL and How it was answered on any result.
- Guarded fallback. Free-form SQL is only run after the guard has checked it.
- Measured. Behaviour is checked against a golden set of 47 questions.
- Open interfaces. The same engine is available as a REST API and as an MCP server.
Built with
FastAPI, LangGraph, sqlglot, SQLAlchemy and SQLite for this demo (the warehouse layer also supports Postgres), running on Google Cloud Run.
Where to look next
The Data model tab shows the tables and how they join. The Data tab shows real rows from each one. Then go back to Ask and try a question.
Certified metrics
The business measures Lumen has tested definitions for. When a question matches one, the SQL is built from the definition shown here, not written by a model, so the same question gives the same figure every time.
Policies
The bank documents behind policy questions such as fees, KYC and card terms. When you ask one, Lumen answers from these files and cites the section it used. The documents are fictional.
Data model
The eight tables behind the demo bank and how they join. Lines run from a foreign key to the column it points at.
Core tablesActivity tablesReference tablesCrow's foot = many, double bar = one. Hover a table to highlight its links.
Data
Real rows from the demo database. Pick a table to see its first 20 rows.