Persist and verify your Lab A evaluation artifacts

Check my progress

/ 50

Deploy the ADK agent to Agent Runtime and complete the managed evaluation run

Check my progress

/ 50

This lab may incorporate AI tools to support your learning.
This content is not yet optimized for mobile devices.
For the best experience, please visit us on a desktop computer using a link sent by email.

Lab Information

Lab Manual Last Updated Date November 27, 2026
Last Tested Date and Time November 27, 2026, 02:41:35
Completion in Last 24 Hours 75

GENAI164

Google Cloud self-paced labs

Overview

Evaluating generative AI agents before production deployment requires measuring both deterministic tool execution and open-ended conversational quality. In this lab, you evaluate agents built with the Agent Development Kit (ADK) using two complementary workflows. First, you run local build-time evaluation with ADK's built-in evaluation framework in Lab A. Then, you run cloud-managed evaluation on Gemini Enterprise Agent Platform in Lab B using synthetic user simulation, custom metrics, Agent Runtime deployment, and automatic loss analysis.

When the lab starts, Terraform pre-provisions an Agent Platform Workbench (e2-standard-4) instance and a Cloud Storage delivery bucket for your project. Specifically, the Workbench instance is named and the delivery bucket is . A startup script stages the two Jupyter notebooks (Lab_A_evaluate_adk_agents.ipynb and Lab_B_eval_geap.ipynb) and supporting agent files in your Workbench home directory and exports your lab configuration. Throughout both notebooks, Gemini inference uses on the global endpoint (with GOOGLE_CLOUD_LOCATION set to global), while regional resources—such as your Agent Runtime deployment and the evaluation SDK client in Lab B—run in .

Objectives

In this lab, you learn how to perform the following tasks:

  • Build and test a local ADK customer service agent with function tools in JupyterLab.
  • Evaluate an ADK agent locally using reference metrics, LLM-judge metrics, custom rubrics, and ADK user simulation.
  • Verify agent instruction improvements by comparing tool-trajectory regression scores across agent versions.
  • Deploy an ADK travel concierge agent to Agent Runtime in and run synthetic scenario generation, custom metric registration, loss analysis, and managed evaluation jobs on Gemini Enterprise Agent Platform.

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources are made available to you.

This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents conflicts between your personal account and the student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab—remember, once you start, you cannot pause a lab.
Note: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the right is the Lab setup pane with the following:

    • The Open Google Cloud console button
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. In the Lab Setup section, right-click Open Google Cloud console and select Open link in new window (or alternatively right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Setup pane.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Setup pane.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To access Google Cloud products and services, click the Navigation menu or type the service or product name in the Search field. Navigation menu icon and Search field

Task 1. Open JupyterLab on Agent Platform Workbench and verify lab files

In this task, you open the pre-provisioned Agent Platform Workbench environment and confirm that the two lab notebooks and supporting data files are present in your JupyterLab home directory. Running evaluations inside Workbench gives your code automatic authentication through the instance service account without storing local key files.

Open JupyterLab

  1. In the Google Cloud Console, on the Navigation menu (Navigation menu), click Agent Platform > Notebooks > Workbench. Alternatively, you can type "Agent Platform Workbench" in the top search bar and click the first result.

  2. Find the instance and click on the Open JupyterLab button.

    The JupyterLab interface for your Workbench instance will open in a new browser tab.

Verify the starter notebook files

  1. In the JupyterLab File Browser, confirm that the following files and folders appear in your home directory:

    • Lab_A_evaluate_adk_agents.ipynb
    • Lab_B_eval_geap.ipynb
    • travel_data.py
    • customer_service_agent/
    • customer_service_agent_v1/

    Lab notebook and agent files in the JupyterLab File Browser

  2. If all listed files are present, proceed to Task 2.

  3. Only if any starter files are missing, open a terminal in JupyterLab by clicking File > New > Terminal and copy the staged files from the lab Cloud Storage bucket into your home directory:

    gcloud storage cp -r "gs://{{{project_0.startup_script.lab_bucket | PROJECT_ID-bucket}}}/*" ~/
  4. Refresh the File Browser to confirm that both notebooks, travel_data.py, and both agent directories now appear in your home directory.

Expected Output: The JupyterLab File Browser displays Lab_A_evaluate_adk_agents.ipynb, Lab_B_eval_geap.ipynb, travel_data.py, customer_service_agent/, and customer_service_agent_v1/.

Under the Hood: During instance provisioning, the Workbench post-startup script configured /etc/profile.d/lab_env.sh and copied the pre-configured notebooks using gcloud storage. Specifically, the script set GOOGLE_CLOUD_REGION to . It also set GEMINI_FLASH_MODEL_ID to and pulled the starter files from gs://.

Task 2. Evaluate an ADK agent locally in Lab A

Before deploying an agent to a managed runtime, developers run a fast inner-loop evaluation locally to catch tool-calling regressions and response-quality issues early. In this task, you work through Lab_A_evaluate_adk_agents.ipynb to build a Cymbal Home & Garden customer service agent, grade it with deterministic reference metrics and LLM-judge rubrics, test multi-turn user simulation, and verify an instruction fix across agent versions.

Note: Run each notebook cell sequentially from top to bottom and wait for each cell to finish before starting the next. Several evaluation cells invoke {{{project_0.startup_script.gemini_flash_model_id | gemini_flash_model_id}}} as a judge or simulator model on the global endpoint, and some runs are intentionally configured to fail so you can inspect how metrics diagnose agent behavior.

Configure the environment and build the ADK agent

  1. In the JupyterLab File Browser, double-click Lab_A_evaluate_adk_agents.ipynb to open it. If prompted to select a kernel, choose Python 3.
  2. In Part 0: Set up your environment, run the package installation cell (google-adk[eval], google-cloud-aiplatform[evaluation], rouge-score, and tabulate).
  3. Run the kernel restart cell so the newly installed packages load cleanly. When the restart confirmation dialog appears, click Ok.
  4. Run the project configuration cell and the PATH configuration cell. Verify that the output prints your Project ID () and model location: global.
  5. In Part 1: Build a simple ADK agent, run all cells in order to create the customer_service_agent package, import the agent, and send a sample purchase-history prompt through InMemoryRunner. The generated customer_service_agent/agent.py file uses model .

Expected Output: The local test prints a [tool call] event for get_purchase_history with customer_id: CUST001, followed by a [tool result] event and the agent's response listing orders ORD-101 and ORD-102.

Run reference, LLM-judge, rubric, and user-simulation evaluations

  1. In Part 2: Evaluate the agent locally with ADK, run the cells to write eval_config.reference.json, eval_config.judge.json, and eval_config.rubric.json, executing adk eval after each configuration:
    • The reference run grades exact tool trajectories (tool_trajectory_avg_score) and ROUGE-1 word overlap (response_match_score).
    • The LLM-judge run grades semantic equivalence (final_response_match_v2) using with 5 judge samples.
    • The rubric run (rubric_based_final_response_quality_v1) intentionally fails completeness on the first refund turn because the agent asks for a refund reason before disclosing order details, demonstrating how strictly rubrics grade written criteria.
  2. In Part 3: Evaluate with ADK user simulation, run the cells to create session_input.json, eval_config_without_metrics.json, eval_config_with_metrics.json, and conversation_scenarios.json.
  3. Run the adk eval_set create and adk eval_set add_eval_case cells to generate customer_service_agent/cs_user_sim.evalset.json, inspect the scenario, and run both the dry-run simulation and the scored simulation (hallucinations_v1 and safety_v1).
  4. In Part 4: Optimize and verify, run the cells to write the earlier customer_service_agent_v1 package (which lacks the instruction to ask for a refund reason first), create eval_config.trajectory.json, and run adk eval on both customer_service_agent_v1 and customer_service_agent.

Expected Output: In Part 4, customer_service_agent_v1 fails tool_trajectory_avg_score because it calls issue_refund prematurely on the first turn, whereas customer_service_agent asks for the reason first and passes the trajectory check.

Persist and verify your Lab A evaluation artifacts

Storing your generated agent packages, evaluation configurations, simulated eval set, and evaluation history in Cloud Storage preserves build-time regression artifacts outside the ephemeral Workbench disk.

  1. In JupyterLab, open a terminal by clicking File > New > Terminal.

  2. Upload your generated customer_service_agent and customer_service_agent_v1 directories to the lab Cloud Storage bucket:

    gcloud storage cp -r ~/customer_service_agent ~/customer_service_agent_v1 \ "gs://{{{project_0.startup_script.lab_bucket | PROJECT_ID-bucket}}}/lab_a_results/"
  3. List the uploaded files in Cloud Storage to confirm all Lab A artifacts were persisted:

    gcloud storage ls \ "gs://{{{project_0.startup_script.lab_bucket | PROJECT_ID-bucket}}}/lab_a_results/customer_service_agent/"

Expected Output: The gcloud storage ls output displays agent.py, cs_user_sim.evalset.json, eval_config.reference.json, eval_config.judge.json, eval_config.rubric.json, eval_config.trajectory.json, and the .adk/ evaluation history directory under gs:///lab_a_results/customer_service_agent/.

Under the Hood: ADK's adk eval CLI executes agent sessions in-process on the Workbench VM while routing model inference and LLM-judge scoring through GOOGLE_GENAI_USE_VERTEXAI=1 and GOOGLE_CLOUD_LOCATION=global. Specifically, all agent and judge calls for target the global endpoint, and each adk eval run writes structured trace history under .adk/eval_history/ for regression auditing.

Click Check my progress to verify the objective. Persist and verify your Lab A evaluation artifacts

Task 3. Run managed evaluations on Gemini Enterprise Agent Platform in Lab B

While local ADK evaluation accelerates inner-loop development, production agents deployed to Agent Runtime require server-side scenario generation, scalable user simulation, custom metric registration, and failure clustering. In this task, you run Lab_B_eval_geap.ipynb to evaluate an ADK travel concierge agent (travel_agent orchestrating flight_agent and hotel_agent) using the Vertex AI Gen AI Evaluation SDK (client.evals).

Dual-Location Routing in Lab B: This notebook separates regional platform control from global Gemini model inference:
  • Regional control plane ({{{project_0.default_region | Region}}}): The evaluation SDK Client, the Agent Runtime deployment (deploy_adk_agent), and the runtime staging bucket (gs://{{{project_0.project_id | PROJECT_ID}}}-agent-engine) run in {{{project_0.default_region | Region}}}.
  • Global inference and loss clustering (global): Both the local agent and the deployed Agent Runtime container set GOOGLE_CLOUD_LOCATION=global to call {{{project_0.startup_script.gemini_flash_model_id | gemini_flash_model_id}}}. Managed evaluation calls pass allow_cross_region_model=True to authorize cross-region judge routing, and generate_loss_clusters uses a dedicated global_client initialized in location="global".

Configure Lab B, build the agent, and deploy to Agent Runtime

  1. In the JupyterLab File Browser, double-click Lab_B_eval_geap.ipynb to open it. If prompted to select a kernel, choose Python 3.
  2. Under Getting started, run both package installation cells (google-cloud-aiplatform[adk,agent_engines,evaluation] and google-adk).
  3. Run the kernel restart cell and click Ok on the restart confirmation dialog.
  4. Run the cells under Set your Google Cloud project and Helper functions. Confirm the printed Project ID matches , the evaluation client location is , and the model location is global.
  5. Under Build the agent, run the cell that imports travel_data.py and defines flight_agent, hotel_agent, and the parent travel_agent.
  6. Under Deploy the agent to Agent Runtime (needed for Part 2), run the deployment cell (deploy_adk_agent(travel_agent, LOCATION)). This deployment takes approximately 5 to 10 minutes.

Expected Output: The deployment cell finishes by printing Deployed: projects/.../locations//reasoningEngines/....

Evaluate the local agent with user simulation, custom metrics, and loss analysis

  1. In Part 1, Step 1: Generate test scenarios, run the cell calling client.evals.generate_conversation_scenarios to generate 7 adversarial multi-turn travel scenarios. The call uses model with allow_cross_region_model=True.
  2. In Part 1, Step 2: Simulate the conversations, run client.evals.run_inference with user_simulator_config (max_turn: 4) to simulate multi-turn conversations and print a readable transcript.
  3. In Part 1, Step 3: Score the conversations, run the cells in 3.1 and 3.2 to:
    • Author and register the Python computation metric (multi_turn_efficiency).
    • Author and register the custom LLM-judge metric (tone_check / tone-check).
    • Run client.evals.evaluate with both custom metrics plus MULTI_TURN_TOOL_USE_QUALITY and MULTI_TURN_TASK_SUCCESS at evaluation_service_qps=2, then inspect the summary and per-case DataFrames.
  4. In Part 1, Step 4: Find failure clusters with loss analysis, run the cell calling global_client.evals.generate_loss_clusters against MULTI_TURN_TOOL_USE_QUALITY to group failing traces into L1/L2 taxonomy categories.

Expected Output: The evaluation tables display summary and per-case scores across all 7 scenarios, and loss analysis prints the failure taxonomy clusters with item counts and descriptions.

Run the managed evaluation job on the deployed agent

  1. In Part 2, Step 1: Generate synthetic user scenarios, run the cell to generate a fresh evaluation dataset for the deployed agent.
  2. In Part 2, Step 2: Run the managed evaluation, run the cell calling client.evals.create_evaluation_run against agent_engine.api_resource.name with dest=EVAL_RUN_GCS_BUCKET, then run the poll_evaluation_run(eval_run, client) cell.
  3. Wait approximately 7 minutes for the polling loop to finish and render the final evaluation report.

Expected Output: The polling cell clears intermediate status updates and prints Evaluation job completed in ... seconds. followed by the managed evaluation summary report.

Verify the deployed Agent Runtime resource and evaluation outputs

  1. In your JupyterLab terminal, verify that the SDK staging artifacts and managed evaluation outputs exist in your Agent Engine Cloud Storage bucket:

    gcloud storage ls "gs://{{{project_0.project_id | PROJECT_ID}}}-agent-engine/"
  2. In the Google Cloud console, navigate to Navigation menu > Agent Platform > Agents > Deployments and verify that your region is set to .

  3. Confirm that your deployed travel_agent Agent Runtime instance appears in the deployments list.

Expected Output: The gcloud storage ls command lists the Agent Runtime staging files and evaluation run output objects in gs://-agent-engine/, and the Deployments console page displays your active Agent Runtime instance in .

Under the Hood: During a managed evaluation run, the Eval Management Service delegates execution to the Vertex AI Service Agent (roles/aiplatform.serviceAgent and roles/storage.admin). The service invokes your regional Agent Runtime endpoint in (which internally routes requests to the global endpoint), executes simulated user turns, computes predefined and custom registered metrics, clusters failure modes, and writes structured results to Cloud Storage.

Click Check my progress to verify the objective. Deploy the ADK agent to Agent Runtime and complete the managed evaluation run

Congratulations!

In this lab, you evaluated ADK agents across the full lifecycle: locally with ADK's built-in evaluation framework in Lab A, and remotely with Gemini Enterprise Agent Platform managed evaluation tools in Lab B. You scored agent behavior with reference, LLM-judge, rubric, and custom registered metrics, simulated adversarial multi-turn users, deployed an agent to Agent Runtime, and diagnosed failure patterns with automatic loss analysis.

Next steps / Learn more

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated: November 19, 2026

Lab Last Tested: November 19, 2026

End your lab

When you have completed your lab, click End Lab. Qwiklabs removes the resources you’ve used and cleans the account for you.

You will be given an opportunity to rate the lab experience. Select the applicable number of stars, type a comment, and then click Submit.

The number of stars indicates the following:

  • 1 star = Very dissatisfied
  • 2 stars = Dissatisfied
  • 3 stars = Neutral
  • 4 stars = Satisfied
  • 5 stars = Very satisfied

You can close the dialog box if you don't want to provide feedback.

For feedback, suggestions, or corrections, please use the Support tab.

Copyright 2026 Google LLC. All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

This content is not currently available

We can notify you via email when it becomes available

Great!

We can contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

Using an Incognito or private browser window is the best way to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.