Zero Labs
Industry News / AI

Hosting LLM-Generated Dashboards: A Governed Snowflake Architecture

Source · Towards AI By Mkrishnamallik

From the publisher’s feed, collected in the ZeroLabs newsroom.

Snowflake Summit ran June 1–4, 2026, and one pairing ran through the keynote: the agentic enterprise, and the governed context that makes it safe to run. Snowflake Intelligence was renamed CoWork, Horizon Context shipped as a governed layer for AI, BI, and apps, and the idea underneath was that a governed semantic layer is the vocabulary an agent reads. This post takes the same idea from the dashboard side: how do you let an LLM build one in minutes and still give it RBAC, a semantic layer, a refresh contract, and an audit trail? Open-source code you can fork for your own warehouse, not just commentary.Imagine a revenue-ops VP shows you an AI-built HTML dashboard, one they can already share by link, and asks why you aren’t shipping it. The answer isn’t no.Lumen AI is a fictional company. Everything in the demo is synthetic data generated by scripts/setup_demo.sql on a Snowflake trial.The conversation that started thisPicture a revenue-ops VP: semi-technical, comfortable with Salesforce reports, occasionally writes formulas in Looker. They’ve been working in an AI chat tool with a live connector to a source system like Salesforce (an MCP server) turned on, and in five minutes they’ve generated a clean HTML pipeline-health dashboard. Eight KPIs at the top. A forecast vs closed-won bar chart. A pushed-deals table. The numbers match what they expect. The visual quality is genuinely good, better than two of the three Looker boards their team currently uses. And the tool now hands them a share link.“Why am I waiting six weeks for the BI team to build this when I can get it in five minutes here? I already have the link, can we just send it to the leadership team?”This pattern is showing up across data teams. The worst possible answer is “no, that’s not how we do BI.” The right answer separates the question into four orthogonal concerns:Where does the data come from? The LLM wrote its own SQL against a live connector, with no semantic layer and no validated metric definitions. Today’s number matches gut-check; tomorrow’s won’t match the BI dashboard because the definitions are different.Who’s allowed to see it? “Share the link” is not access control. Point a source-system MCP at the warehouse through one shared read-only role (the common setup) and the link works for anyone holding it, with no way to fence out a single user or mask a column for some viewers but not others, because the policies can’t tell two holders of the same role apart.What happens when the data changes? A static HTML file with a hard-coded JSON blob is a snapshot, not a dashboard. Even a live artifact gives you no contract for when, or whether, it refreshes. And if every viewer re-queries the source, a rate limit can make the refresh fail.What happens when the dashboard changes? Edit it, lose the prior version. No diff, no PR, no review, no way to tell a stakeholder which version they saw.“Then connect through Snowflake’s own MCP, behind a semantic view,” you might answer, and that closes the first two. The metrics get defined once and line up with the BI dashboard. And since the managed MCP server went GA in November 2025, each person authenticates with their own identity and runs under their own role, so row-access and masking policies finally tell users apart. Two concerns down.The other two don’t move. Every free-form question is a fresh ad-hoc view: no record of which answer a stakeholder actually saw, no version history, no review gate deciding which reports are blessed to circulate. And a chat reply or an exported extract is still a snapshot: it goes stale while the tiles around it refresh. Three ways to put a number in front of a stakeholder, and only one holds up on all four:approachesThese aren’t arguments against LLM-generated HTML. The visualization is good. They’re arguments for separating authoring (which the LLM does well) from hosting (which the LLM doesn’t do at all). That separation is the design driver for everything that follows.The pitch in 90 secondsThree observations:LLMs are good at one-shot HTML dashboards, often better in five minutes than most of us could build by hand.Artifacts produced outside a BI tool have no governance hooks: no RBAC, no version history, no audit log, no scheduled refresh, no chat sidebar. They are files.You can wrap them in a thin Streamlit-in-Snowflake shell (a small render core, with a Cortex Analyst chat sidebar on top) and inherit your warehouse’s governance for free.The shell discovers each dashboard from a folder containing three files:apps/ pipeline_health/ manifest.yml # title, columns, allowed_roles, chip_count query.sql # the data the page renders page.html # self-contained HTML/CSS/JS, with a __DATA__ token semantic_view.sql # optional: backs the chat sidebarAuthoring is replaceable. Today the artifact comes from Claude. Tomorrow it could come from v0, Snowflake’s own CoCo coding agent, a notebook export, a hand-written page. The hosting shell does not care. The contract is the three files.diagram_authoring_vs_hostingThe runner reads the manifest, runs the SQL, substitutes the JSON result into __DATA__, and renders the HTML inside an iframe. Stakeholders see a dashboard that runs against live data, respects their role, logs every chat turn, and changes via PR.What a data architect would push back onDirect connector → LLM → HTML pipelines have predictable failure modes:Metric definitions drift from the source of truth. The LLM picks fields by name match. Amount vs net_new_arr_usd: same table, different precision, different business meaning.No SCD awareness. A live connector pulls current state. Forecast slippage, pipeline-as-of, win-rate-by-cohort all need point-in-time history that operational connectors don’t expose.Cardinality and freshness are silent. The LLM will happily aggregate a million-row table into an in-browser chart.The connector sets the security boundary, not the warehouse. A source-system MCP runs against the system it points at, often an operational system of record, under whatever role you give it. You set the policy at the connector. Many such systems don’t log reads or enforce least-privilege the way a warehouse does. Scope it read-only: a write-capable role lets an agent touch the system of record. Snowflake puts the controls in the data layer instead, where they hold for every caller: row-access policies, masking, and a full QUERY_HISTORY to audit. Its managed MCP also runs each person under their own role.The mart underneath has to be trustworthy. This one applies once you move to a semantic view, the fix for the bullets above. A semantic view is only as good as the table it sits on. The extract and transform steps feeding the mart need their own freshness checks and tests (not-null, unique, accepted-values, source-schema drift), so a silent upstream change doesn’t surface as a confidently wrong chart. (This POC stops at a synthetic mart. That upstream discipline is the real-world prerequisite, not something this demo ships.)The right response is not “no.” It is “yes, and here’s how we make it durable.” Keep the LLM doing the part it’s best at: let it author the page and reshape it into the three-file contract (docs/AUTHORING_PROMPT.md's Prompt B does most of that, run from Claude Code). Then put the data behind a modeled mart, the mart behind a semantic view with verified metric definitions, and host the HTML on a role-gated shell with a chat sidebar that runs SQL only against that view. The artifact still gets built by AI in minutes; what you add is the governance around it. Stakeholders self-serve, the metrics are correct, the dashboard survives audit.Mart vs. semantic view, in one line each. A mart is a modeled, point-in-time-correct table you query directly. A semantic view is a Snowflake DDL object layered on a mart that adds synonyms, dimension / fact / metric definitions, and verified queries, making the same data legible to an LLM.The three-file contractThe folder tree above is the whole interface. The runner does five things with it, in order:Read manifest.yml. Decide whether the active role is allowed to see the page. If not, hide it from the nav.Run query.sql via Snowpark. Cache the result for 10 minutes keyed on (app_name, columns, sql_fingerprint).Convert the rows to a 2D array, ordered exactly as manifest.columns.JSON-encode the array with ensure_ascii=True and substitute it into the page's __DATA__ token.Hand the resulting HTML string to streamlit.components.v1.html, which puts it in an iframe.That’s it. There is no per-page Python.The manifest is the contract. The column list is the contract between SQL and HTML. The author commits to a column order; the runner enforces it. The HTML never sees a column it didn’t ask for; the SQL never returns one without an owner. CI rejects SELECT * for exactly this reason: it makes column identity ambiguous and tempts the LLM author to guess column names from display-layer aliases.Authoring loop in five stepsThis is what shipping a new page actually looks like, end-to-end:make scaffold name=my_page creates apps/my_page/{manifest.yml, page.html, query.sql} from templates.Bring the artifact into the three-file shape. An HTML page built in a chat tool rarely lands ready: it usually pulls a chart library from a CDN, has sample data baked in, hides its columns behind a SELECT *, and has no __DATA__ token. Reshaping it (strip the CDN tags, point the JS at RAW, spell out the columns, add the placeholder) is mechanical, and docs/AUTHORING_PROMPT.md has a prompt (Prompt B) that does most of it. The spec is the instruction set; the local checks below are the safety net.make sample name=my_page runs the SQL via Snow CLI, writes fixtures/my_page.json.make preview name=my_page opens the page in a browser with the fixture injected. Iterate until it renders right.Open a PR. CI lints, validates the file contract, dry-runs the SQL, and deploys to a per-PR Streamlit object whose URL gets posted on the PR. Reviewers click, don’t imagine.Tip from experience: make the agent enforce the contract, not just follow it. Step 2 is the same reshape every time, so encode it once: put the column-list and __DATA__ rules in a CLAUDE.md the agent reads each session, and add a PostToolUse hook that runs validate_apps.py on every file write so a broken page is caught the second it's saved, not in CI. The cheap version of "AI does the work" is pasting a prompt; the durable version is wiring the guardrails so the agent can't drift.The same loop, drawn:diagram_authoring_loopWhere it runsThe shell runs on Streamlit-in-Snowflake, the managed Streamlit runtime, not Snowpark Container Services. No custom JS server here: every chart renders client-side in the iframe, so the managed runtime is enough. (Reach for SPCS only for server-side rendering or a package Anaconda doesn’t carry, and even that gap narrowed once SiS got a container runtime in March 2026.) The render is streamlit.components.v1.html with a __DATA__ token:html = (app_dir / "page.html").read_text()html = html.replace("__DATA__", json.dumps(rows, ensure_ascii=True, default=str))components.html(html, height=manifest.height, scrolling=False)ensure_ascii=True is load-bearing. Without it, a single unlucky string column containing breaks out of the embedded HTML. With it, the / is escaped as , same JSON value, but no escape from the iframe sandbox. The kind of one-line invariant worth a comment.RBAC done right (twice)There are two access controls in this architecture, and they do different jobs.The first is the UX gate. manifest.yml declares allowed_roles: [LUMEN_SALES_LEADER, LUMEN_ANALYST]. At render time, home.py calls session.get_current_role() and only shows pages whose list includes the active role. This personalizes the nav.The second is the security boundary. It lives in GRANT SELECT ON LUMEN_DEMO.ANALYTICS_HUB.PIPELINE_HEALTH_MART TO ROLE LUMEN_SALES_LEADER. That GRANT is what actually keeps unauthorized users out of the data.RBAC at the data layer, not the app layer. People will tell you “we use the manifest for security” and they will be wrong. Fail closed at the data layer.The two-step checklistAdding a page that needs role gating? Two things, both required, easy to get wrong:GRANT SELECT ON TO ROLE in scripts/setup_demo.sql (or wherever your mart provisioning lives). This is the actual access control.allowed_roles: [, …] in manifest.yml. This is the nav gate.Forget the GRANT and the page silently renders empty when a permitted role tries to view it. Forget allowed_roles and the page is visible but the query fails. Both ugly; only the first leaks data.The Cortex Analyst chat sidebarCortex Analyst turns natural-language questions into SQL against a semantic view, a Snowflake DDL object that declares tables, dimensions, metrics, synonyms, and a block of verified queries.What’s ai_verified_queries? A Snowflake DDL block that pins approved SQL to named suggestion chips, so the query the stakeholder sees is the query you reviewed. Each entry can be flagged as an onboarding question to surface as a chip in the chat sidebar.ai_verified_queries ( win_rate_l90 as ( question 'What is the trailing-90-day win rate by segment?' verified_at 1779840000 verified_by 'data-team' onboarding_question true sql 'SELECT customer_segment, COUNT_IF(outcome_bucket = ''Closed Won'') AS won, ROUND(...) AS rate FROM LUMEN_DEMO.ANALYTICS_HUB.PIPELINE_HEALTH_MART GROUP BY 1 ORDER BY rate DESC' ))diagram_trust_boundaryFree-form questions still work, and for a non-technical exec they’re the point: asking “why did EMEA slip last quarter?” in plain language is real exploration a chip list can’t anticipate. A chip is a verified question: Cortex Analyst matches it to the reviewed SQL in ai_verified_queries and runs that, so the answer is the query a reviewer approved, not one the model improvised on the spot.Those verified queries live in the semantic view itself, so they travel: point Claude Cowork at the same view over Snowflake’s MCP and it gets the same reviewed SQL. What this app adds is the hosting: a fixed, role-gated dashboard at a stable URL. New analytical questions become PRs: one new entry in ai_verified_queries, one reviewer, one merge.The verified-query trust boundary. Free-form Cortex Analyst is a useful tool; the chips are the policy decision about which questions are officially answerable.Tip from experience: an undocumented collision. Don’t let a metric name in the semantic view match a column alias inside a verified query: reuse it as SELECT … AS net_new_arr and Cortex Analyst rewrites that alias with a table prefix, producing invalid SQL. Renaming the alias fixes it. It's nowhere in the docs. Cost me an evening.Adding your first verified queryThe minimum viable shape, end-to-end:Author a CREATE OR REPLACE SEMANTIC VIEW block (skeleton in apps/rep_performance/semantic_view.sql). Declare one table, two dimensions, one metric.Add a single ai_verified_queries entry with onboarding_question true and your reviewed SQL string.Set chip_count: 1 in manifest.yml.make semantic ENV=dev deploys the DDL.Reload the SiS app. The chip appears. Click it; the answer is the exact result of your SQL.That’s the round trip. Three lines of YAML, one DDL block, one SQL string, and a stakeholder gets a verified answer to a known question.CI: per-PR isolation, manual prod gatediagram_ci_sequenceThree things make this work:The deploy job names the Streamlit object using the PR number. Stable across the PR lifecycle, unique across PRs.cleanup.yml on pull_request: types: [closed] drops the per-PR object. Unmerged work doesn't accumulate.deploy_prod is gated on environment: production with required reviewers. There's no automatic path to prod.Audit by defaultThe chat sidebar writes one row per turn into CHAT_AUDIT_LOG:audit_log_schemaLogging failures are caught and swallowed, so the chat path never blocks on audit. The table has DATA_RETENTION_TIME_IN_DAYS = 7 so accidental deletes are recoverable on a trial.“We can audit this if we need to” is not the same as “this is audited.” Every chat turn lands in the table; new audit reports are SQL queries.Tip from experience: the prompt column is your verified-query backlog. The free-form questions people actually type are the best signal for which verified query to write next. When the same question shows up five different ways and none of them is a chip, that’s the next PR into ai_verified_queries.A tour of the two dashboardsThe repo ships two pages under apps/.Pipeline Health is the hero: a four-tab B2B SaaS pipeline-and-revenue board with cross-filtering, a forecast-vs-closed composite, a stage-by-segment heat-matrix, and a side-panel record drill that opens inside the iframe: click any at-risk row and the account’s header, open opportunities, and a derived activity timeline render in place, no navigation. It’s the page that proves LLM-authored visualization quality is real.pipeline_health_executive_summaryRep Performance is the RBAC demo, hidden from LUMEN_SALES_LEADER, visible to analysts and engineers. It's a rep scorecard with a YTD / monthly / quarterly toggle that re-computes every tile, and each headline reads year-over-year so seasonality doesn't masquerade as a trend. The point underneath the charts: it's built on a tidy (rep × month) mart, so the same numbers roll up correctly at any grain: the modeling discipline the rest of this post argues for, made visible.rep_performance_leaderboardBoth carry a Glossary modal in the brand row, the user-facing surface of the same semantic vocabulary the chat sidebar uses.Where this fits next to BIModern AI-native BI suites (Looker with Gemini, Tableau Pulse and Agent, Power BI Copilot, ThoughtSpot Sage, Hex Magic) are converging on chat-with-your-data, and this sits alongside them rather than against them. Even a team living in one of those suites still reaches outside it for the quick, ad-hoc, short-lived but visually rich dashboard, the one authored in an LLM or a notebook on a deadline, not modeled into the BI tool. That’s the case this serves: you still want governance, you just don’t want to rebuild the artifact in the BI tool to get it. And on a traditional stack without an AI agent layer, the chat sidebar is something you didn’t have before, with no migration.There’s a quieter time-to-build argument too. Pipeline Health ships things deliberately awkward in traditional BI (a heat-matrix where every cell is a cross-filter, callouts that fire only on threshold crossings, a record drill inside the iframe) that mean custom Liquid in Looker, calc-field gymnastics in Tableau, or days of hand-written HTML. The LLM produces it in a sitting, and the thin shell hands that artifact RBAC, a cached refresh against a modeled mart, an audit log, and a per-PR preview before prod. Either way, this is complementary to a BI tool, not a replacement.“Didn’t Snowflake just ship this?” CoWork now generates Artifacts: governed dashboards it builds from a conversation, reading the same semantic views this shell does. The data-trust story is identical; the difference is authoring. CoWork generates the chart from its own palette; this hosts one you authored as bespoke HTML (the cross-filtering heat-matrix, the in-iframe record drill a generator won’t produce) and puts it behind a PR, a review gate, and a versioned history. Snowflake shipping CoWork is the strongest signal yet that governed AI dashboards matter; this is the escape hatch for the ones that don’t fit a template. Check where the line sits the week you read this.There’s an org-shape reason it lands well, too. Data teams ship correct numbers but often by hand: a notebook, a one-off export, no PR, no rerun. Software teams have the CI reflexes and over-build, wrapping a dashboard in a service mesh. This shell sits on the seam. Stakeholders design the report however they like with no vendor queue, while analysts, AE, and DE ship the marts, metrics, and semantic views as data products: accurate, current, and scalable. Design freedom on one side of the three-file contract; engineering discipline on the other.A word on shelf-life. This shell is built to be partly outgrown. What no connector setting adds is the rest of “governed”: a review gate that decides which reports are blessed to share, and a versioned history of them. A semantic layer makes answers more correct; it doesn’t keep an unverified one off the C-suite’s desk. As of June 2026, if a stakeholder is building HTML apps in a tool like Claude Cowork or Claude Code and they need to be governed and reviewable, wrapping them in a thin warehouse shell is still the more dependable path. For long-term, public-facing, sensitive, or auditable reporting, reach for an actual BI tool. That’s not the gap this fills.Tip from experience: least-privilege on the MCP is still moving. Per-user identity is solved; least-privilege role selection isn’t quite. MCP OAuth sessions activate only the user’s DEFAULT_ROLE (secondary roles aren't supported), and Claude's own connector currently requests session:role:all rather than letting you pin a scoped role (claude-ai-mcp#193, open, already fixed in Claude Code but not yet in Desktop/web). If you're in a regulated shop, check that issue before you trust the default. This is the kind of thing that's true the week you read it and stale a month later: verify, don't take my word for it.The semantic layer, rediscoveredThe semantic layer is not a new idea. Business Objects had universes in the early 1990s; Looker built the modern stack on LookML around 2012; dbt metrics, Cube, and AtScale each had their version of “define the metric once, reference it everywhere.” For most of that history the layer was an internal concern of the BI tool, invisible to the people consuming reports.What’s new is the warehouse shipping one as a first-class object. Snowflake’s CREATE SEMANTIC VIEW DDL reached GA in June 2025, and as of March 2026 you can query it with standard SQL, not just through the Cortex Analyst API. The decades-old concept became a queryable database object aimed at LLM consumers, which is why it feels like a sudden arrival rather than the slow rediscovery it is. The landscape is even converging on a shared format: Open Semantic Interchange, backed by Snowflake, dbt Labs, and dozens of others, aims to make a metric definition portable across vendors instead of locked to one tool.Why now? The consumer of the metric definition changed. When a stakeholder asks a chat prompt instead of clicking a saved Looker view, the semantic layer stops being a BI implementation detail and becomes the trust contract between the LLM and the warehouse.Tip from experience: test the semantic layer like code now that you can. Standard-SQL querying (GA March 2026) means a semantic view is no longer a black box you poke only through chat: a CI step can SELECT against it and assert a known metric returns a known number, so a bad edit fails the build instead of surfacing as a confidently wrong chart weeks later.Two consequences worth surfacing:Verified queries are reviewable policy. They live in DDL, in version control, with PR review. “Which questions are we willing to answer correctly today?” is a list an analytics engineer can audit, not folklore in someone’s head. Every synonym, every comment, every dimension is the difference between “what’s our pipeline by region?” landing on the right column or hallucinating a fake one.Modeled marts are now load-bearing in a way they weren’t. When a dashboard was the only consumer, you could fix a metric in the measure and move on. With a chat agent also reading from it, every comment and grain decision shows up in the answer the stakeholder reads, and a rich vocabulary over an untested mart just answers confidently from bad numbers. The freshness and not-null/unique/drift discipline underneath (out of scope for this synthetic repo) is the part you cannot skip in a real deployment.If you’re a data architect on a traditional warehouse + BI stack, the question is no longer “do we have a semantic layer?” It’s “is it ready to be the contract surface for AI agents?” That’s a different bar: richer synonyms, deliberate verified-query coverage, point-in-time correctness in the marts underneath, and a deploy story that lets per-team semantics evolve in parallel. (A follow-up on that enterprise-scale layout is in progress.)Try it yourselfThe repo, github.com/mothiki/analytics-hub, is open source (MIT). The offline path takes 60 seconds:git clone https://github.com/mothiki/analytics-hubcd analytics-hubconda env create -f environment.yml && conda activate analytics_hubmake localA browser opens with two pages running against pre-generated synthetic fixtures. Switch roles via LOCAL_DEV_ROLE to see the nav change.The full Snowflake stack on a free 30-day Enterprise trial (AWS us-west-2 or us-east-1):# 1. Seed the demo data + warehouse + rolessnow sql -f scripts/setup_demo.sql -c LUMEN# 2. Bootstrap the audit log table (required for the chat sidebar)snow sql -f scripts/setup_audit_log.sql -c LUMEN# 3. Deploy semantic views + the SiS appmake deploy ENV=devmake url ENV=devTotal elapsed: about five minutes.Where BI is headingPull back, and three decades of BI rhyme. Each era moved the authoring surface closer to the person with the question, and shortened the time from question to dashboard.diagram_bi_timelineTwo forces ran in opposite directions the whole time, and that gap is the story:bi_two_forcesThe generative era is no different, except the artifacts are now disposable and about to arrive in far greater volume. (The price story is messier than the timeline: the cloud-first tools (Sigma, Hex, Omni) are premium SaaS, not an open-source price point. The shift was capability, not cost.) This repo is one answer to where the governance goes when the dashboard itself is throwaway.A question to sit with. When a dashboard takes five minutes to make and is gone tomorrow, the chart stops being the asset. So what’s the durable unit of trust: a reviewed metric definition, a verified-query list, a semantic layer the warehouse owns? Whatever it is, it almost certainly isn’t the dashboard. That’s the thing worth building to last.Hosting LLM-Generated Dashboards: A Governed Snowflake Architecture was originally published in Towards AI on Medium, where people are continuing the conversation by highlighting and responding to this story.