Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Evidentlyai Evidently Workspace Add Run

From Leeroopedia
Knowledge Sources
Domains ML_Monitoring, Infrastructure
Last Updated 2026-02-14 12:00 GMT

Overview

Concrete method for persisting evaluation snapshots to an Evidently monitoring project provided by the Evidently library.

Description

WorkspaceBase.add_run() persists a Snapshot to a project's storage. The snapshot is serialized to JSON and stored in the workspace directory under the project's snapshots folder. A unique snapshot ID is generated via uuid6.

Legacy API: project.add_snapshot(snapshot) delegates to the same underlying mechanism.

Usage

Call after Report.run() to persist the snapshot for dashboard visualization.

Code Reference

Source Location

  • Repository: evidently
  • File: src/evidently/ui/workspace.py
  • Lines: L557-600 (WorkspaceBase.add_run), L841-844 (Workspace._add_run)

Signature

class WorkspaceBase:
    def add_run(
        self,
        project_id: STR_UUID,
        run: Snapshot,
        include_data: bool = False,
        name: Optional[str] = None,
    ) -> SnapshotRef:
        """Add a snapshot to a project.
        Args:
            project_id: UUID of the target project.
            run: Snapshot to persist.
            include_data: Whether to upload input datasets.
            name: Optional snapshot name.
        Returns:
            SnapshotRef with snapshot_id and project_id.
        """

Import

from evidently.ui.workspace import Workspace
# add_run is called on a Workspace instance

I/O Contract

Inputs

Name Type Required Description
project_id STR_UUID Yes UUID of the target project
run Snapshot Yes Snapshot to persist
include_data bool No Upload input datasets (default: False)
name Optional[str] No Snapshot name

Outputs

Name Type Description
return value SnapshotRef Reference with snapshot_id and project_id

Usage Examples

from evidently.ui.workspace import Workspace
from evidently import Report
from evidently.metrics import ValueDrift
from datetime import datetime

ws = Workspace.create("monitoring")
project = ws.add_project(ProjectModel(name="Drift Monitor"))

report = Report([ValueDrift(column="age")])

# Monitoring loop
for i, batch in enumerate(weekly_batches):
    snapshot = report.run(
        current_data=batch,
        reference_data=reference,
        timestamp=datetime(2024, 1, 7 * i + 1),
    )
    ws.add_run(project.id, snapshot)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment