← Back

AI Dashboard Assistant

The AI Dashboard Assistant is a feature in the Schoolytics web app. End users ask in natural language (e.g. "third-grade math growth over the last year, grouped by school") and the assistant generates a live Cube-backed dashboard, streaming text and chart renders as it iterates.

Agent architecture

It's a multi-turn agent loop, not a single-shot prompt-to-SQL. The assistant has a schema-aware toolset covering query generation (producing Cube query specs the client renders directly), on-demand schema retrieval, scoped data lookups for profile views, and Markdown report generation for longer-form outputs.

Tool calls and results stream over SSE as structured JSON events. The client validates the tool shape before rendering, and the dashboard updates live as the agent iterates.

Access scoped to the user

All tool calls execute under the requesting user's session scope, the agent cannot query data the user cannot. Access controls live at the data layer, not in the prompt, so prompt injection can't expand what the agent sees.

Two-phase schema injection

Putting the full schema in every turn burns tokens fast. The pattern here is:

Trades a larger upfront context cost for cheap long conversations. An analyst can refine a dashboard over many turns without the token bill exploding.

Production-grade polish

Stack