Run through the Getting Started section of the notebook.

Check my progress

/ 10

Run through the Supported models section of the notebook.

Check my progress

/ 10

Run through the Computer Use: agent loop section of the notebook.

Check my progress

/ 10

Run through the 1. Send a request to the model section of the notebook.

Check my progress

/ 10

Run through the 2. Receive the model response section of the notebook.

Check my progress

/ 10

Run through the 3. Execute the received actions section of the notebook.

Check my progress

/ 10

Run through the 4. Capture the new environment state section of the notebook.

Check my progress

/ 10

Clean up by closing the browser and stopping the session

Check my progress

/ 15

Run through the Build an agent loop section of the notebook.

Check my progress

/ 15

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.

GSP1365

Google Cloud self-paced labs

Overview

Automation of repetitive web-based tasks—such as data entry, price comparison, or application testing—is often a time-consuming manual process for developers and data analysts. Manually navigating complex UIs to extract or input information lacks scalability and is prone to human error.

In this lab, you solve this problem by building an autonomous web agent using the Gemini Computer Use model. You use the Agent Platform SDK for Python and Playwright to create a system that can "see" a browser screen via screenshots and "act" by simulating mouse clicks and keyboard inputs. You implement a continuous "agent loop" that allows the model to process feedback from the environment and iterate until a specific goal is achieved.

Prerequisites

Before starting this lab, you should be familiar with:

  • Basic Python programming.
  • General API concepts.
  • Running Python code in a Jupyter notebook on Agent Platform Workbench.

Objectives

In this lab, you use the model to perform the following tasks:

  • Configure the Agent Platform SDK for Python to use the Gemini Computer Use model.
  • Initialize a secure browser environment using Playwright.
  • Implement an agent loop to handle multi-turn interactions between Gemini and a web browser.
  • Execute model-generated actions such as navigation, clicking, and typing.

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 and access panel with the following:

    • The Open Google Cloud console button
    • The temporary credentials (username and password) that you must use for this lab
    • Other information, if needed, to step through this lab

    Note that the lab timer is located near the top of the page, showing the remaining time.

  2. Click Open Google Cloud console (or 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 and access panel.

  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 and access panel.

  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 the notebook in Agent Platform Workbench

In the Google Cloud console, you open an Agent Platform Workbench instance.

  1. Open the file.

  2. In the Select Kernel dialog, choose Python 3 (Local) from the list of available kernels.

  3. Run through the Getting Started section of the notebook. The Project ID and Location are pre-configured for you.

Note: If you experience a 429 response from any of the notebook cell executions, wait one minute before running the cell again to proceed.

Task 2. Set up the notebook

In this task, you open your Agent Platform Workbench instance and initialize the notebook. You configure the SDK to use global endpoints to access the model.

  1. Click the file.

  2. Run through the Get started section of the notebook.

Note: If you receive a 429 response from any of the notebook cell executions, wait a minute before running the cell again to proceed.

Install the Agent Platform SDK for Python and required libraries

Install the Agent Platform SDK for Python for Python using the pip command. This library provides the essential tools required to interact with the model and Agent Platform services throughout the notebook.

  • Run through the Install the Agent Platform SDK for Python and required libraries section of the notebook.

Set up Playwright

Install Playwright. This is a tool for browser automation.

  • Run through the Set up Playwright section of the notebook.

Import libraries

Prepares your environment to build an AI agent that can "see" and interact with the web. It combines the Google Agent Platform SDK for Python for intelligent decision-making with Playwright for browser automation, providing all the necessary tools for the AI to navigate websites, run functions, and perform complex tasks autonomously.

  • Run through the Import libraries section of the notebook to import the required libraries.

Set your project information

This code connects your project to Google Cloud's AI power. By defining your Project ID and Location, you're telling the system where to work, while the genai.Client acts as the secure bridge to access Agent Platform models.

Click Check my progress to verify the objective. Installed packages and imported libraries.

Set the model

Set the model for use in this lab.

  • Run through the Supported models section of the notebook.

Click Check my progress to verify the objective. Run through the Supported models section of the notebook.

Task 3. Explore the agent loop

In this task, you explore the iterative agent loop and set up its secure execution environment.

Explore an agent loop

Run through the Explore an agent loop section in the notebook to learn about the iterative process required for an AI model to interact with a dynamic environment like a web browser. Unlike standard LLM interactions, which are "stateless," a Computer Use agent must continuously observe, reason, and act to reach a goal.

Set up your environment

Run through the Prerequisites: Set up your environment section to launch a virtual, high-definition browser session using Playwright so your AI can navigate and interact with websites in the background.

Click Check my progress to verify the objective. Run through the Set up your environment section of the notebook.

Task 4. Walkthrough a single turn

In this section you walk through the code for a single turn of the agent loop, from sending the first request to preparing for the next one.

Send a request to the model

  • Run through the Send a request to the model section to provide the model with the information it needs to decide what to do next.

Click Check my progress to verify the objective. Run through the Send a request to the model section of the notebook.

Receive the model response

  • Run through the Receive the model response section to inspect the model's response for FunctionCalls, which define the specific UI actions it wants to execute.

Click Check my progress to verify the objective. Run through the Receive the model response section of the notebook.

Execute the received actions

  • Run through the Execute the received actions section to use Playwright to turn the model's intent into physical browser events.

Click Check my progress to verify the objective. Run through the Execute the received actions section of the notebook.

Capture the new state and respond

  • Run through the Capture the new state and respond section to execute the received actions, capture the resulting browser state, and add that information to the conversation history.

Click Check my progress to verify the objective. Run through the Capture the new state and respond section of the notebook.

Clean up by closing the browser and stopping the session

  • Run through the Clean up by closing the browser and stopping the session section in the notebook.

This shuts down the browser and terminates the active Playwright session to clean up system resources. This follows best practices and ensures resource efficiency, environment stability, and security.

Click Check my progress to verify the objective. Run through the Clean up by closing the browser and stopping the session section of the notebook.

Task 5. Build an agent loop

In this task, you build an autonomous execution loop to reason and call tools by combining the steps in the previous section.

  • Run the Build an agent loop section to enable multi-step interactions.

Click Check my progress to verify the objective. Run through the Build an agent loop section of the notebook.

Congratulations!

You've successfully built an autonomous web agent using the Gemini Computer Use model. By combining the Agent Platform SDK for Python with Playwright, you implemented an iterative agent loop capable of navigating live browser environments, executing UI actions, and processing real-time visual feedback to complete complex automation tasks.

Next steps / Learn more

Check out the following resources to learn more about Gen AI and the Gemini Enterprise Agent Platform:

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 May 18, 2026

Lab Last Tested March 31, 2026

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.

You need to sign in or sign up before continuing.

close

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.