Architecture gallery
AIArchitectureDataproduction

FinOps Hub — Hybrid SQL Engine

The staged pipeline behind FinOps Hub: route, plan, generate SQL (template or LLM), validate, execute, and summarize, with guardrails and a deterministic cache.

AGENT FLOW · request lifecycle
Question → governed SQL → answer
decision LLM step deterministic SQL
general / greetinganalyticsnoyesnoyeserrorUser questionRoute?LLM reply withFinOps personaCached?Plan: decomposeinto intentsRun intentsin parallelTemplate routeexists?LLM-generatedSQLDeterministictemplate SQLValidate: read-only,guards, LIMITExecute on warehouse+ cache rowsLLM auto-correct& retry onceSynthesizeexecutive summaryAnswer + KPIs + charts+ reasoning trace
Data foundation · Databricks medallion
Bronze

raw cost & usage, ingested as-is

Silver

conformed, deduped, typed

Gold

marts: agg_ / fact_ / dim_ · USD

The agent only ever queries the gold marts — that's what keeps answers consistent and costs standardized to USD.

01 · Route02 · Plan03 · SQL · template/LLM04 · Validate05 · Execute06 · Summarize
Tech stack
Next.jsFastAPIAzure OpenAI · gpt-5-miniDatabricks SQLJWT · SSELangSmith

What it does

It turns a plain-English cost question into governed SQL. Every stage is observable, and the engine runs free deterministic SQL wherever a metadata route exists, using the LLM only where one doesn't.

Flow

Route the question (analytics or chat), plan it into parallel intents, pick template SQL or fall back to LLM SQL per intent, validate with read-only guards and a row limit, execute with a result cache and one auto-correcting retry, then summarize. A full-response cache keyed on the question keeps answers identical.

Guardrails

No DML or DDL, no SELECT *, no multi-statements, no raw bronze or silver scans, and always a row limit. Every answer exposes the SQL and the steps it ran.