Run through the Get Started section of the notebook.

Check my progress

/ 10

Set the Gemini model ID.

Check my progress

/ 15

Run the cell configure_session in the notebook.

Check my progress

/ 15

Run the cell send_and_receive_turn in the notebook.

Check my progress

/ 15

Run the cell run_live_session in the notebook.

Check my progress

/ 15

Run the Conversation Setup and Execution cell of the notebook.

Check my progress

/ 15

Run the Configuration and Execution cell 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.

GSP1364

Google Cloud self-paced labs

Overview

The Gemini Live API offers native audio dialog capabilities, enabling developers to build sophisticated, human-like, and responsive real-time conversational AI agents. By directly managing speech-to-speech interactions, this feature eliminates the need for separate speech-to-text and text-to-speech components.

Voice interfaces within the Generative AI domain are evolving from simple commands to fluid, engaging conversational experiences. The Gemini Live API facilitates this shift by allowing developers to create real-time, bidirectional audio streaming applications.

These applications support advanced functionalities, including seamless interruption handling, proactive "chime-in" behaviors, and affective (empathetic) responses.

This lab focuses on connecting to the Gemini Live API on Agent Platform using the Google Gen AI SDK for Python. You configure a session for native audio streams and explore two distinct use cases: a proactive assistant that selectively joins conversations when relevant and an empathetic technical advisor designed to respond to user frustration.

Objectives

In this lab, you perform the following tasks:

  • Install and configure the Google Gen AI SDK for Python in a notebook environment.
  • Establish a connection to the Gemini Live API using LiveConnectConfig.
  • Implement Proactive Audio to allow the model to interject in a conversation based on context.
  • Enable Affective Dialog to generate responses with appropriate emotional tone.

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

  1. In the Google Cloud console, on the Navigation menu (Navigation menu icon), click Agent Platform > Notebooks > Workbench.

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

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

Task 2. Set up the notebook

  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.

Click Check my progress to verify the objective. Run through the Get started section of the notebook.

Task 3. Set the Gemini model

In this lab, you use with Live API features native audio dialog capabilities.

  • Run the Set the model ID section in the notebook to set the model ID.

Click Check my progress to verify the objective. Run through the Set the model ID section of the notebook.

Task 4. Explore reusable Live API module functions

The following functions manage the session configuration, handle a single conversational turn, and execute a multi-turn session.

configure_session

This function creates a flexible LiveConnectConfig object to enable or disable features like system instruction, transcription, proactivity, and affective dialog.

  • Run the configure_session section in the notebook to create a configuration object for the Live Connect session.

Click Check my progress to verify the objective. Run the cell configure_session in the notebook.

send_and_receive_turn

This asynchronous function manages a single user turn: it sends the text, streams the audio and transcription messages back from the model, and displays the results.

  • Run the send_and_receive_turn section in the notebook to send a single text turn to the Live Connect session and process and display the streaming response.

Click Check my progress to verify the objective. Run the cell send_and_receive_turn in the notebook.

run_live_session

This function manages the full conversational context, establishing the connection and running a series of defined turns.

  • Run the run_live_session section in the notebook to establish the Live Connect session and run a series of conversational turns.

Click Check my progress to verify the objective. Run the cell run_live_session in the notebook.

Task 5. Practice using two scenarios

In Task 5, you test the model's capabilities through two practical use cases to observe its interaction triggers:

Scenario 1: Proactive Audio (chime-in behavior). You use a system instruction and enable_proactivity that directs the model to remain silent during an off-topic conversation and only interject when the topic becomes on-topic.

Scenario 2: Affective Dialog (empathy). You enable enable_affective_dialog to explore the model's ability to respond with an empathetic tone.

Scenario 1: Proactive Audio (chime-in behavior)

This example uses a System Instruction and Proactive Audio to explore the model's ability to remain silent when the topic is off-subject (French cuisine) and chime in only when the conversation shifts to the instructed topic (Italian cooking).

  • Run through the Scenario 1: Proactive Audio (chime-in behavior) section of the notebook.

Click Check my progress to verify the objective. Run through the Scenario 1: Proactive Audio (chime-in behavior) section of the notebook.

Scenario 2: Affective dialog (empathy)

This scenario enables Affective Dialog (enable_affective_dialog=True) and uses a system instruction to create a senior technical advisor persona. The user's input is phrased to convey frustration, prompting an empathetic and helpful response from the model.

  • Run through the Scenario 2: Affective Dialog (empathy) section of the notebook.

Click Check my progress to verify the objective. Run through the Scenario 2: Affective Dialog (empathy) section of the notebook.

Congratulations!

You have successfully connected to the Gemini Live API on Agent Platform. You configured a session to handle native audio and implemented advanced features like proactive chime-in and affective dialog.

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 February 26, 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.

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.