Tracking classes

The Vertex AI SDK for Python includes classes to help with visualization,measurements, and tracking. These classes can be grouped into three types:

  • Classes that use metadata to track resources in your machine learning (ML)workflow
  • Classes that are used for Vertex AI Experiments
  • Classes that are used for a Vertex AI TensorBoard

The following topics provide an overview of the classes related to tracking andmonitoring an ML workflow in Vertex AI SDK for Python.

Metadata classes

You can use the Vertex AI SDK for Python to create Vertex ML Metadata to helpyou track and analyze the metadata in your ML workflow. For more information,seeIntroduction to Vertex ML Metadata.

Artifact

TheArtifact class represents the metadata in anartifact in Vertex AI. An artifact is a discrete entity or piece of datathat's produced by an ML workflow. Examples of an artifact are adataset, amodel, and aninput file.For more information, seeTrack executions and artifacts.

When you create anArtifact resource, you need tospecify its schema. Each type of an artifact has a unique schema. For example,thesystem.Dataset schema represents a dataset and thesystem.Metricsschema represents evaluation metrics. For more information, seeHow to use system schemas.

The following sample code shows how to create anArtifact resource that represents a model:

model_artifact=aiplatform.Artifact.create(schema_title="system.Model",display_name=PREPROCESSED_DATASET_NAME,uri=PREPROCESSED_DATASET_URI,

Execution

TheExecution class represents the metadata in anexecution in Vertex AI. An execution is a step in an ML workflow.Examples of an execution are data processing, training, and model evaluation. Anexecution can consume artifacts, such as a dataset, and produce an artifact,such as a model.

Useaiplatform.start_executionto create anExecution resource. After you create anExecution resource, use the sameaiplatform.start_executionmethod with itsresume parameter set toTrue to resume it.

The following sample code shows how to create anExecution resource:

withaiplatform.start_execution(schema_title='system.ContainerExecution',display_name='trainer')asexecution:execution.assign_input_artifacts([my_artifact])model=aiplatform.Artifact.create(uri='gs://my-uri',schema_title='system.Model')execution.assign_output_artifacts([model])

Vertex AI Experiments classes

You can use the Vertex AI SDK for Python to create and runVertex AI Experiments. Use Vertex AI Experiments totrack logged metrics and parameters to help you analyze and optimize your MLworkflow. For more information, seeIntroduction toVertex AI Experiments.

To learn more about how to use theExperiment andExperimentRun classes, try one of the followingtutorials:

Experiment

TheExperiment class represents an experiment inVertex AI. Use an experiment to analyze itsexperiment runs andpipeline runs with differentconfigurations, such as multiple input artifacts and hyperparameters.

There are two ways to create anExperiment resource:

  1. The preferred way to create anExperimentis byspecifying a name for your experiment as a parameter when you callaiplatform.init:

    # In a real world scenario it's likely you would specify more parameters# when you call aiplatform.init. This sample shows only how to use the# parameter used to create an Experiment.# Specify a name for the experimentEXPERIMENT_NAME="your-experiment-name"# Create the experimentaiplatform.init(experiment=EXPERIMENT_NAME)
  2. You can also create anExperiment by callingaiplatform.Experiment.create.aiplatform.Experiment.createcreates theExperiment resource but doesn't setit to a global environment. Because of this, you can't run the experimentwithaiplatform.start_run. Thefollowing sample code shows how to useaiplatform.Experiment.createto create an experiment and then run the experiment:

    # Specify a name for the experimentEXPERIMENT_NAME="your-experiment-name"EXPERIMENT_RUN_NAME="your-run"# Create the experimentexperiment=aiplatform.Experiment.create(experiment_name=EXPERIMENT_NAME)experiment_run=aiplatform.ExperimentRun.create(EXPERIMENT_RUN_NAME,experiment=EXPERIMENT_NAME)

ExperimentRun

TheExperimentRun class represents a run of anexperiment.

The following sample code shows how to create and start an experiment run, thenuse it to get information about your experiment. To delete the experiment run,get a reference to theExperimentRun instanceand call itsdeletemethod.

# Specify your project name, location, experiment name, and run namePROJECT_NAME="my-project"LOCATION="us-central1"EXPERIMENT_NAME="experiment-1"RUN_NAME="run-1"# Create the experiment to runaiplatform.init(experiment=EXPERIMENT_NAME,project=PROJECT_NAME,location=LOCATION)# Create and run an ExperimentRun resource. Next, you can use it to get# information about your experiment. For example, you can log parameters and# metrics with specified key-value pairs.withaiplatform.start_run(RUN_NAME):aiplatform.log_params({'learning_rate':0.1,'dropout_rate':0.2})aiplatform.log_metrics({'accuracy':0.9,'recall':0.8})# Get a reference to the ExperimentRun resource, get the parameters logged to# the run, get the summary metrics logged to the run, then delete it.withaiplatform.start_run(RUN_NAME,resume=True)asrun:run.get_params()run.get_metrics()run.delete()

Vertex AI TensorBoard classes

The Vertex AI SDK for Python includes classes to work with a managed version of theopen sourceVertex AI TensorBoard.Vertex AI TensorBoard is a tool used to monitor measurements and visualizationsduring your ML workflow. For more information, seeGet started withVertex AI TensorBoard.

To learn more about using the Vertex AI SDK for Python to work with Vertex AI TensorBoard, try one of the following notebook tutorials:

Tensorboard

TheTensorboard class represents a managedresource that stores Vertex AI TensorBoard experiments. You need to create aTensorboard instance before the experiments can bevisualized. You can create more than oneTensorboard instance in a Google Cloud project.

The following sample code shows how to create aTensorboard instance:

# Specify your project name, location, and the name of your TensorboardPROJECT_NAME="my-project"LOCATION="us-central1"TENSORBOARD_NAME="my-tensorboard"aiplatform.init(project=PROJECT_NAME,location=LOCATION)tensorboard=aiplatform.Tensorboard.create(display_name=TENSORBOARD_NAME,project=PROJECT_NAME,location=LOCATION,)

TensorboardExperiment

TheTensorboardExperiment represents agroup ofTensorboardRun objects. ATensorboardRun instance represents the resultsof a training job run in a Tensorboard.

TensorboardRun

An instance of theTensorboardRun class maps toa training job run in a Tensorboard with a specified set of hyperparameters, amodel definition, a dataset, and more.

TensorboardTimeSeries

TheTensorboardTimeSeries classrepresents a series produced in training runs.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-18 UTC.