This demo shows functions: your own logic, which the platform runs when the agent calls it. Watch the strip above the dashboard. It lights when a function call finishes and names it, and the chart in the Insights panel is drawn from what that function returned.
Northwind Analytics is a fictional outdoor retailer's sales dashboard. You ask the copilot a question, and the answer lands on the dashboard as a chart, a table or a headline figure. The chat stays short because the page does the showing.
The agent is configuration#
The copilot is a Mindset agent called ask-your-data, and nothing about it is code. It has a model (Claude Haiku 4.5), five prompt fields, and two granted functions. The prompt fields say what it's for, how it talks, what the data holds, which tools it has, and the rules it keeps: every number comes from a function result, it says plainly that the data is fictional, and it stays on the dashboard's data. You can read all of it in demos/ask-your-data/.
Two functions, no database#
The data is 240 rows: twelve months of 2026, four regions, five categories, with orders, revenue, returns and the reason for each return. It lives as a literal inside each function, and every step after it is pure, so a call reaches nothing outside and costs no model call.
ask-your-data-query-sales filters by month range, region and category, groups by month, region, category or return reason, and totals the metric you asked for. Each group comes back with a label and a value, ready to chart. It also groups two levels at once: groupBy: "region,category" returns every region-and-category cell, worst first, with subtotals per region, so one call does the work of two.
ask-your-data-growth compares revenue in the first and last quarter, per category or region, fastest first.
They are functions rather than a connection because the data is fixed and the work is grouping and arithmetic, which is exactly what the function language does. In your product, the first step would read your warehouse through a connection and the rest would stay the same.
The page draws the agent's output#
The copilot has no widgets of its own. Every agent can call three built-in display tools: render_chart, show_table and show_ui. On the UI-less client each one arrives as a widget-payload event carrying a small widget tree. This page reads the chart's points, the table's rows or the stat's figure out of that tree and draws the latest one in the dashboard's main panel with its own charts, so an agent answer looks like part of the product. Before the first answer, that panel shows revenue by month. While a turn runs, the panel also draws each function result as soon as its tool_end event arrives, so you watch the breakdown narrow instead of waiting for the agent's own chart, which replaces it when it lands. A two-level result shows its largest few cells. The chat only notes that something landed on the dashboard.
Page tools and situational awareness#
The page registers three page tools. set_date_range takes two months, set_dashboard_filter takes a region, a category or both, and pin_insight pins the latest chart, table or figure. A pinned insight gets a chip under the main panel, so you can bring it back after the agent shows something newer. Each one checks the model's arguments before it changes anything, and answers in a sentence the agent can repeat. With every turn the page also sends situational awareness: the date range, the filters, and the three KPIs on screen. Filters show as small pills only when one is set, and removing a pill clears that filter. That's how the copilot answers "what am I looking at?" without a function call.
Under the hood#
The pane under the demo lists each step of a turn as it happens: the function calls with their arguments and results, the built-in chart and table calls, and the page tool calls with what they returned. Ask why returns spiked in March and you'll see two function calls: one for every region-and-category cell in March, which puts North jackets on top, then one for the return reasons in that cell. Each function step costs several seconds of platform time, so asking for both levels in one call is the cheapest way to narrow a question down.
Build the same thing#
- Write the functions. See Build a function.
- Create the agent, grant the functions, and open it to the embed surface. See Put an agent on your page.
- On your page, use the UI-less client, register your page tools, and handle
widget-payload events as the events reference describes.
- Pin behavior tests for the questions that matter. See Test an agent's behavior.