Back to posts
Part 6 of 6 · Fabric Data Agents in Your Apps
Oct 26, 2026•12 min read

Rethinking Embedded Analytics with Fabric Data Agents

Embedded analytics used to mean an iframe around a report. At Day of Data St. Louis we showed a different shape: live charts, a team of data agents, and actions, in one Fabric app with no secrets in it. Here is the architecture, the principles that made it work, and the code.

For most of my career, "embedded analytics" meant one thing: put a report in an iframe and hope people find the answer in it. The report shows what happened. Finding out why, and doing something about it, happens somewhere else. We spent a session arguing that the iframe is the wrong unit.

On October 24, Abby Yang and I presented Rethinking Embedded Analytics with Fabric Data Agents at Day of Data St. Louis. The demo was a single Fabric app with three jobs: show the numbers with live charts, answer questions about them with a team of data agents, and turn answers into tracked actions. This post is the written version. It closes the series that started with what's new in data agents, calling them over MCP, and Fabric app functions, and the full code, labs included, is on GitHub.

  • 3 narrow agents. Sales, operations, and planning, each scoped to its own tables, each checked against SQL before it went on stage.
  • 1 Fabric app. Charts, agents, and an action board, deployed as one item with rayfin up.
  • 0 secrets. The browser never sees a token, a secret, or an agent URL. The app calls the agents as itself.

The Shape of the App

The architecture fits on one slide. One lakehouse feeds two paths: small, purpose-built tables that the charts read through a connector, and a team of data agents that answer questions over MCP. A Fabric app hosts both, and a set of functions sits between the browser and everything else.

LakehouseOne Fabric appApp tablessmall, pre-builtConnectordelegatedChartsas the signed-in userAsk draweraskDataAgentfunction3 agentsover MCPas the appAction buttonscreateActionrules on serverApp database@role rulesas the user, within the rules
The architecture

One lakehouse

Everything starts from the same governed data. The design question is how the app reaches it, and as whom.

Charts: as the signed-in user

A notebook builds a handful of small, pre-aggregated tables. The app reads them through a lakehouse connector in delegated mode, so every chart shows only what that person's own access allows.

Questions: as the app

The Ask drawer sends a question to a function, which calls the right agent over MCP with the app's own identity. The browser never sees a token or an agent URL, and the agents are scoped to data every user may see.

Actions: as the user, within the rules

Buttons on each answer call functions that apply the business rules on the server and write to the app's database, where the table's role rules limit what each user can change.

Three paths, three identities

That is the whole architecture. Each arrow runs as a different identity, on purpose.

The interesting thing about that diagram is not the boxes. It is that each arrow runs as a different identity, on purpose:

Path Mechanism Runs as
Charts Lakehouse connector, auth: delegated The signed-in user. They see what their lakehouse access allows.
Questions Function calling the agent's MCP endpoint The app identity. Agents are scoped to data every user may see.
Actions Function writing to the app database The calling user, limited by the table's @role rules.

If you take one thing from this post, take that table. Most of the security conversations about embedded agents are really a missing version of it.

Principle 1: Verify the Numbers Before Anyone Asks

We wrote the SQL before we wrote a single instruction. Every question we intended to ask on stage had a query that produced the right answer, and every agent answer was compared with it. That ground truth did three jobs: it was the evaluation set for the agents, the source for the chart tables, and the recordings for the offline fallback. One set of verified numbers, used everywhere, meant the chart and the agent could never disagree on stage.

Top region, net sales this yearas the fresh agent answeredafter three layers of context€0€2.5bn€5bn€7.5bn€10bn€9.60bn15 currenciesadded as oneactual: €2.40bnTop regionWhat the agent was givenTablesscoped to its domainAgent instructionswhat counts, “this year”Data source instructionscurrency rule, which date to filterOne example querynet sales, converted correctlySame model. Same data.-- run steps: the SQL the agent wroteAsk a question to see the SQL-- what the fresh agent wroteSELECT r.region, SUM(i.net_invoice_value) AS net_salesFROM invoices iJOIN customers c ON c.customer_key = i.customer_keyJOIN regions r ON r.station = c.stationGROUP BY r.region ORDER BY net_sales DESC-- after the example querySELECT r.region, SUM(i.net_invoice_value / br.rate * er.rate) AS net_salesFROM invoices iJOIN budget_rate br ON br.from_currency = i.local_currencyJOIN exchange_rate er ON er.from_currency = i.local_currency AND er.rate_type = 'Monthly Rate' AND er.date = i.billing_date
The cold open

Ask a fresh agent

We gave a new agent its tables and nothing else, then asked a simple question: what were net sales by region this year? It answered in seconds, with a confident table. The top region came back at €9.6bn.

Read the SQL

The run steps showed why. Invoice amounts are stored in fifteen local currencies, and the agent wrote SUM(net_invoice_value), adding them together as if they were one. Converted properly, the real figure was €2.40bn. Nothing crashed. The number just looked plausible.

Write down what counts

First layer: agent instructions. What “net sales” means (real invoices only, in one currency) and what “this year” means when the data stops before today.

Write down how to query it

Second layer: data source instructions. The currency conversion rule, which rate to use, and which date column to filter on.

Show one example, and ask again

Third layer: a single example query that converts every amount through two rate tables. Same question, same model, same data: €2.40bn.

The agent cannot guess your business rules. The fix is writing them down, then proving it with a test.

When an answer is wrong, open the run steps, read the SQL, and fix exactly one layer:

Symptom in the generated SQL Layer to fix
Sums an amount column across currencies or units Data source instructions, plus an example query showing the conversion
YEAR(GETDATE()), or the wrong date column for "this year" Data source instructions: dates
Counts returns or credit notes as sales Agent instructions: key terminology
Joins a table that has nothing to do with the question Tables: take it out of the agent
Joins a monthly budget to transactions row by row Data source instructions: aggregate before joining

The evaluation loop itself is covered in depth in my automated testing post. For a live demo we added one rule: each question was asked three times, and only questions that passed all three went on stage as suggestion chips.

Principle 2: A Team, Routed in the Open

Three agents, each with only the tables its domain needs. The sales agent cannot see orders; the operations agent cannot see the budget. Each declines out-of-scope questions politely and names the agent that can answer.

When a user asks without picking an agent, the app routes the question. We deliberately kept the router simple: a few keyword rules, evaluated in the browser, with the reason shown on the answer ("routed to Operations: orders and delivery"). An LLM router reading each agent's tool description would be smarter. It would also be slower, cost a call, and be invisible. For a business user, a routing decision they can see and correct beats a clever one they cannot.

// route.ts: simple, instant, and visible to the user
const RULES = [
{ agent: "operations", why: "orders and delivery", re: /\b(backlog|overdue|orders?|deliver\w*|on[- ]time|penalt\w*|cancel\w*)\b/i },
{ agent: "planning", why: "forecast and plan", re: /\b(forecast|outlook|territor\w*|brands?|full[- ]year|plan\w*)\b/i },
];
export function routeQuestion(q: string) {
for (const r of RULES) if (r.re.test(q)) return { agent: r.agent, why: r.why };
return { agent: "sales", why: "sales and budget" };
}

Answers also carry hand-offs: a sales answer about an account that is behind budget offers "ask Operations about its overdue orders" and "ask Planning whether the forecast already assumes the gap". The team behaves like a team because the app connects them, not because the agents know about each other.

Principle 3: An Answer Format Is an Interface

Over MCP, an agent answers in text and markdown tables. If you want to draw a chart from that, the answer needs a predictable shape. So every agent's instructions end with the same template:

## How to answer (agent instructions)
1. Answer: one sentence with the headline number, the period and the unit.
2. Key points: two to four bullets. Key figures in bold.
3. Table: label column first, then values with the unit in each header,
e.g. "Net sales (USD)", "Gap (%)". Sorted the way the question asks.
At most 15 rows; say how many you left out. Total row when meaningful.
4. Chart: one line naming the best chart for the table.
5. Notes: one line with the period, filters and definitions applied.

A small parser on the client splits the answer into headline, key points, tables, and notes, then picks a chart for each table: a line when the labels are months, diverging bars when a gap or variance column has negatives, ranked bars otherwise. The tips that made it reliable:

  • Units in the headers are what let code tell a currency column from a percentage.
  • Ask for the sort order the question implies. Then the table is already the chart.
  • Ask for a Total row, then drop it before charting. People want the total; a chart with the total in it flattens everything else.
  • Treat the agent's chart suggestion as a hint, not a command. The table's shape decides.
  • Test the format like the numbers. After every instruction change, read a few answers by eye. A correct number in the wrong shape still breaks the app.

Principle 4: Charts That Say Something

If an agent is going to answer in one sentence, the charts around it should too. We wrote down eight rules and held every chart in the app to them, including the ones drawn from agent answers:

1. The title states the finding

"5 of 13 key accounts are behind budget", not "Sales by account". Build the title from the same numbers the chart draws, so it cannot drift.

2. A budget is a marker

Actuals are columns; the budget is a short tick across each one. Never a second bar, a line over the columns, or a second axis.

3. No smoothing

Months are discrete. Curves invent peaks and dips that are not in the data. Straight segments only.

4. Grey for context, one colour for focus

The period being discussed gets the colour. Everything else is grey, so the eye lands where the title points.

5. Show the variance, red below plan

Draw the gap, do not make readers subtract bar heights. Red below plan, blue above: distinguishable for colour-blind readers, unlike red and green.

6. Label directly

Put values on the marks that matter. Hairline gridlines. A legend only when there are two or more series.

7. Every number has a source

Each chart names the table it reads, the same tables the agents use, so an answer can be checked against the chart beside it.

8. Fit the frame

One tab, one screen. Charts size themselves to their card and never make the page scroll.

Principle 5: Put the Agent Where the Question Starts

A chat box in a corner is the least useful place for an agent. Questions start when someone looks at a chart and something looks wrong. So in the app, clicking a bar, a heatmap cell, or a month asks the right agent about that exact thing, pre-filled with the context the user was looking at. A "Brief me" button on the overview and on each account asks for a short summary of what is on screen. And Ctrl K opens an Ask drawer from anywhere.

Every answer then offers actions: create a follow-up, escalate, or build a recovery plan that works out the monthly run-rate needed to land the full-year budget. Those buttons call functions, which apply the business rules and write to the action board. Agents answer, functions act, as I argued in the functions post. The loop from "this looks wrong" to "someone owns fixing it" happens in one screen.

Principle 6: One Seam, and a Plan B

Everything in the UI reaches the agents through one function, askAgent(). Behind that seam, an environment variable picks between the live path (the Rayfin function, MCP, the agents) and an offline path that replays the SQL-verified answers, clearly labelled as recordings. Conference Wi-Fi is the obvious reason. The less obvious one is development: the whole UI can be built and tested against known answers without a capacity running, and switched to live with a redeploy.

// The seam: the UI never knows which path answered
export async function askAgent(agent: AgentKey, question: string) {
if (import.meta.env.VITE_AGENT_MODE === "offline") {
return { answer: await offlineAnswer(agent, question), identity: "recorded" };
}
return client.functions.askDataAgent.invoke({ agent, question }, { timeoutMs: 240_000 });
}

Lessons from the Build

  • Build small tables for charts. The charts read a handful of tiny, pre-aggregated tables, rebuilt by a notebook, rather than querying raw facts. They load instantly, and their numbers match the verified SQL by construction.
  • Tables, not views, for connectors. The lakehouse connector reads through Fabric's GraphQL layer, which needs table metadata and rejected our SQL views.
  • Set the page size explicitly. A grouped connector query returned a single 100-row page by default. Fetch rows with an explicit page size and aggregate where you control it.
  • Write the principles down as files. Rayfin ships skill files for AI coding assistants, and the repo adds our chart principles as a document every chart names. Whether a person or a coding agent writes the next chart, the rules are in the repo, not in someone's head.
  • Keep a whole demo in one workspace folder. Agents, lakehouse, notebooks, and the app in one place make it easy to find, share, and clean up.

What FabCon Europe Changed

Several announcements from FabCon Europe, a few weeks before the talk, land directly on this architecture:

MCP tasks are GA

Long questions can return a task id and be polled instead of holding a connection open. A good fit for the 240-second function limit: start the task in one call, poll in the next.

Agent visuals are GA

The portal now draws charts in answers. Outside the portal you still get text, but the chart specification appears in the run steps, so a client can rebuild it. Our parser approach still holds for MCP.

Up to 1,000 rows (preview)

On the preview runtime, agents can return up to 1,000 rows instead of 25. Useful for analysis, but for an app the instruction to cap tables at 15 rows still serves the reader better.

Topics (preview)

Large, subject-organized instructions for SQL sources, where the agent pulls in only the relevant sections. A better home for long business rule books than one giant instruction block.

Get the Code

Everything from the session is in dayofdata-stl-2026-fabric-agents on GitHub, as four labs you can run in your own tenant:

Lab You build Time
00 Prerequisites Capacity, tenant settings, tools, sample data 15 min
01 Data agents Three scoped agents with instructions and example queries, checked against SQL and evaluated with the SDK 45 min
02 MCP A Python MCP client against all three agents 15 min
03 Fabric app The full app: live charts, the agent team, and action buttons backed by functions 45 min

The repo also has standalone examples: a chart gallery for agent answers that opens offline, six ways to call an agent with the identity each one uses, and the answer template with its parser. Nothing is tied to our tenant; every script takes your workspace and item IDs.

Thank you to everyone who came to the session, to the Day of Data St. Louis organizers, and to Abby Yang for building and presenting it with me.

The Series

Tags

Microsoft FabricData AgentsFabric AppsEmbedded AnalyticsMCPData Visualization