View Gen AI Agent Evaluation Run Results

Source notebook

Repo path: gemini/evaluation/view_genai_agent_evaluation_run.ipynb · Open on GitHub · intro

Retrieves a Vertex AI Gen AI evaluation run and displays its embedded report.

Summary

This notebook shows how to use the Gen AI Eval SDK through Vertex AI to view an existing evaluation run. The workflow installs the evaluation package, configures project, location, and evaluation run ID, initializes a Vertex AI client with v1beta1 HTTP options, retrieves the run with evaluation items, and calls show() to display results.

Key code patterns

Initialize Vertex AI client

from vertexai import Client
from google.genai import types as genai_types
 
client = Client(
    project=PROJECT_ID,
    location=LOCATION,
    http_options=genai_types.HttpOptions(api_version="v1beta1"),
)

Sets the project, region, and API version needed to access evaluation runs.

Retrieve evaluation run

evaluation_run = client.evals.get_evaluation_run(
    name=EVAL_RUN_ID,
    include_evaluation_items=True
)

Loads an existing evaluation run and includes per-item results for detailed inspection.

Display report

evaluation_run.show()

Renders the evaluation report, including summary metrics, agent info, detailed results, and traces when available.

Models & APIs used

  • APIs / services: Vertex AI
  • SDKs / libraries: google-cloud-aiplatform[evaluation], vertexai, google-genai

When to use this

Use this pattern when you already have a Vertex AI Gen AI evaluation run ID and need to inspect its results in a notebook.

Gotchas & caveats

  • Requires an existing Google Cloud project with the Vertex AI API enabled.
  • PROJECT_ID, LOCATION, and EVAL_RUN_ID must be provided before retrieval.
  • The notebook uses api_version=“v1beta1”.
  • It retrieves existing runs only; it does not create or execute an evaluation run.
  • The runtime should be restarted after package installation to load latest packages.

Best practices

  • Install google-cloud-aiplatform[evaluation] before using evaluation features.
  • Use include_evaluation_items=True when detailed case-level results are needed.
  • Use evaluation_run.show() to visualize failed run errors or embedded evaluation reports.