Skip to main content
Dashboards allow you to create custom visualizations or reports (in PNG or HTML format) that can be served via the API. They are useful for creating charts, graphs, or formatted text outputs based on your data. Unlike datasets, there is currently no support for serving dashboards to AI agents through MCP tools. Dashboards are defined in the dashboards/ directory using Python.

File structure

The logic of the dashboard is written in a Python file. Optionally, the metadata (such as description and dependencies) can be specified in a YAML file with the same name.

Python dashboards

A dashboard is defined by a main function in a Python file. This function is async, receives a DashboardArgs object, and returns a Dashboard object (specifically, a PngDashboard or HtmlDashboard).

Example: PNG Dashboard

This example creates a simple plot using matplotlib. PngDashboard accepts a matplotlib.figure.Figure, io.BytesIO, or bytes.
dashboards/my_plot.py

Example: HTML Dashboard

This example creates an HTML report. HtmlDashboard accepts a string or io.StringIO containing HTML.
dashboards/my_report.py

Accessing datasets

In your Python code, you access datasets using sqrl.dataset(). As dashboards are run asynchronously, you must use the await keyword.
The dataset method returns a Polars DataFrame. You can pass fixed_parameters to filter or configure the dataset for this specific dashboard.

YAML configuration

An optional YAML file with the same name provides additional configuration for the dashboard.
dashboards/my_plot.yml

Configuration fields

string
default:"(same as filename)"
A human-readable label for the dashboard.
string
default:""
A description of the dashboard for documentation purposes.
string
default:"png"
The format of the dashboard output. Options are png or html.
string
default:"(dynamic based on auth_type)"
The access scope for the dashboard. One of:
  • public: Accessible without authentication.
  • protected: Requires authentication to access.
  • private: Only accessible by users with the admin access level.
The default value is public if auth_type is optional, and protected if it is required.
list[string]
default:"null"
List of parameter names used by this dashboard. If not specified, all parameters are available.
list[object]
default:"[]"
List of dataset dependencies. Defining these helps with documentation and lineage.