Implementation:Truera Trulens Run Dashboard
| Knowledge Sources | |
|---|---|
| Domains | Observability, Visualization |
| Last Updated | 2026-02-14 08:00 GMT |
Overview
Concrete tool for launching a Streamlit-based interactive dashboard to explore evaluation results, provided by the trulens-dashboard package.
Description
The run_dashboard function launches a Streamlit dashboard as a subprocess. The dashboard reads from the database configured in the TruSession and provides interactive exploration of application traces, feedback scores, and app version comparisons. It supports multiple deployment modes:
- Local: Standard Streamlit server on localhost
- SiS (Streamlit-in-Snowflake): Compatibility mode for Snowflake-hosted Streamlit
- SPCS (Snowpark Container Services): Container-based deployment in Snowflake
Usage
Call this function after recording traces and running feedback evaluations. The dashboard provides a visual interface for exploring results that complements programmatic analysis via retrieve_feedback_results.
Code Reference
Source Location
- Repository: trulens
- File: src/dashboard/trulens/dashboard/run.py
- Lines: L41-310
Signature
def run_dashboard(
session: Optional[TruSession] = None,
port: Optional[int] = None,
address: Optional[str] = None,
force: bool = False,
sis_compatibility_mode: bool = False,
spcs_mode: bool = False,
_dev: Optional[Path] = None,
_watch_changes: bool = False,
) -> Process:
"""Run a streamlit dashboard to view logged results and apps.
Args:
session: TruSession to display. Defaults to current session.
port: Port number for the Streamlit server.
address: Address to bind to. Cannot be set in Colab.
force: Kill existing dashboards first. Defaults to False.
sis_compatibility_mode: Enable Streamlit-in-Snowflake compatibility.
spcs_mode: Enable Snowpark Container Services mode.
Returns:
The Process executing the Streamlit dashboard.
Raises:
RuntimeError: If dashboard is already running (unless force=True).
"""
Import
from trulens.dashboard import run_dashboard
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| session | TruSession | No | Session to display (defaults to current singleton) |
| port | int | No | Streamlit server port (auto-selects if not given) |
| address | str | No | Server bind address |
| force | bool | No | Kill existing dashboards first (default: False) |
| sis_compatibility_mode | bool | No | Streamlit-in-Snowflake mode (default: False) |
| spcs_mode | bool | No | Snowpark Container Services mode (default: False) |
Outputs
| Name | Type | Description |
|---|---|---|
| return | multiprocessing.Process | The subprocess running the Streamlit dashboard |
Usage Examples
Basic Dashboard Launch
from trulens.core.session import TruSession
from trulens.dashboard import run_dashboard
session = TruSession()
# ... record traces and run feedbacks ...
# Launch dashboard
run_dashboard(session)
# Dashboard opens at http://localhost:<port>
Force Restart on Specific Port
from trulens.dashboard import run_dashboard
run_dashboard(session, port=8501, force=True)
Snowflake-Hosted Dashboard
from trulens.dashboard import run_dashboard
# For Streamlit-in-Snowflake deployment
run_dashboard(session, sis_compatibility_mode=True)
# For SPCS deployment
run_dashboard(session, spcs_mode=True)
Related Pages
Implements Principle
Requires Environment
- Environment:Truera_Trulens_Python_Core_Environment
- Environment:Truera_Trulens_Streamlit_Dashboard_Environment