← All transcripts

Build a real-time voice AI agent with Gemini Live API Transcript, AI Summary & Key Points

Google Cloud Tech · Aug 26, 2026 · Science & Technology · 07:13 · EN-US

Watch on YouTube

AI Summary

A real-time voice agent uses Gemini Live for audio-to-audio interaction in both directions, allowing it to listen, stream responses while forming them, and be interrupted mid-sentence. The architecture consists of a browser, a backend, and Gemini Live connected through an open WebSocket. The core loop is open the session, send microphone audio, receive model audio, and play it in the browser. Voice activity detection identifies conversational turns, barge-in enables interruption, and tools allow the agent to perform actions such as playing or skipping music.

Key Points

  • Text-to-speech accepts text and returns audio in one direction, while Gemini Live hears voice audio and responds with voice audio in both directions.
  • Gemini Live can interpret tone, pauses, energy, and how something is said.
  • The model streams audio before the full response has finished forming.
  • The architecture has three pieces: a browser, Gemini Live, and a small backend.
  • The browser and backend use a WebSocket so audio can flow continuously in both directions at the same time.
  • The backend independently sends microphone audio to Gemini and receives Gemini's voice response.
  • The core loop is open, send, receive, play.
  • Voice activity detection identifies when a speaker starts and stops talking, and VAD is built into Gemini Live.

AI in practice

Used for

Agents

  • Mira — Hold a live voice conversation and control music in response to spoken requests. 2 held 00:00

Tools & resources

2 items

GNo. 5762
AIAINotes.us AI product

Gemini Live API

g.dev/cloud/gemini-live

Gemini Live API is a Google API for building low-latency, real-time voice and vision applications with Gemini. It uses a stateful WebSocket connection to accept continuous audio, image, and text streams and return spoken audio, transcripts, and other model responses. The API supports barge-in interruption, function calling, Google Search, proactive audio, affective dialog, live transcription, and live voice-to-voice translation. Inputs can include raw 16-bit PCM audio, JPEG images, and text; audio responses are streamed as raw 16-bit PCM audio. Applications can connect server-to-server or directly from a client using WebSockets, with ephemeral tokens recommended for production client connections.

Mentioned in
3 videos
Kind
AI
LNo. 2901
AIAINotes.us AI product

live-dj

Open source · cuppibla/live-dj

live-dj is an open-source voice-agent demo in which users talk to Mira, a late-night radio DJ, ask her to play music, and interrupt her while she speaks. It uses the Gemini Live API through the raw `google-genai` SDK rather than an agent framework. The browser handles microphone capture, 16 kHz audio input, 24 kHz playback, client-side barge-in, and music ducking. The server maintains one asynchronous Live API session per browser and runs the core loop of opening a session, sending microphone audio, receiving streamed voice responses, and playing them. The full application adds Mira's persona, transcripts, music-tool dispatch, and controls for playing playlists or tracks, skipping, and pausing; the tools return immediately so the voice response does not stall. A minimal backend exposes the 39-line voice-only primitive, while the full server demonstrates the complete DJ application. The repository also documents a per-turn `session.receive()` behavior that requires an outer loop for continuing conversation, and shows that microphone audio must be sent through `send_realtime_input` rather than `send_client_content`. It runs locally with `uv`, Uvicorn, and a Gemini Developer API key. The repository includes a browser client, four dream-pop tracks, persona assets, and examples of the relevant implementation pitfalls.

Mentioned in
1 video
Kind
AI

Links mentioned

🔒 Full analysis locked

Unlock more videos and the full analysis

A credit unlocks one video's full analysis for good — the build steps, the tools and how each was used, the methods behind every use case. Pro opens the whole library instead, and raises how many videos you can analyse a day.

Unlock full analysis — free

Transcript

Searchable transcript of Build a real-time voice AI agent with Gemini Live API — Google Cloud Tech (07:13). Search for a phrase, then click its timestamp to jump straight to that moment in the video.

Captions sourced from the original video on YouTube, published by Google Cloud Tech. The video, its captions and all related intellectual property remain the property of their respective owners; AINotes claims no ownership. Provided for research, accessibility and search — see the Transcript Notice and Copyright Policy.

00:00 Hey, Mira. Can you play something dream pop? >> That sounds perfect. >> Uh, skip this one. >> Skipping it for you. >> Uh, Mira, what do you think of the music? >> It's gentle. >> Do you know how I can find more music like this? >> That is a live voice agent. It listens, it answers in real time, and I can interrupt it mid-sentence, like a phone call.

00:23 Hi, I'm Annie, and today you will learn how to build this app with Gemini Live API. We will explain it in three parts. Part one, why live voice is different from a normal AI voice. Part two, the architecture and the core loop. Part three, the three concepts that make the agent feel alive. Let's get started. Most AI voice systems are text-to-speech. TTS is simple.

00:49 You give it text, it gives you audio. One direction. It can speak, but it cannot hear you. It does not know you're there. Gemini Live is a different kind of thing. It is not just text-to-speech, it is audio-to-audio, both directions at the same time. It hears your voice as audio, and it speaks back as audio. Live. What makes this model special? It can hear tone, pauses, energy, and the way you say something.

01:21 And also, it streams. It can start speaking while it is still forming the answer. It does not wait for the full response to finish before audio begins. So, part one takeaway. TTS reads, Live hears, and the answer streams while you're still talking. Now, let's build it. The architecture has three pieces. First, the browser that captures your microphone, and it plays the audio response.

01:48 Second, Gemini Live. That is the live model. Third, a small backend. The backend holds an open connection to Gemini and it passes audio through. The browser and back end talk over a web socket. A normal web request ask once and closes. A web socket stays open. That is what lets the audio flow continuously in both directions at the same time. So, what does the back end actually do?

02:21 You can think of it as two jobs running at once. One job sends your microphone audio up. The other receives Gemini's voice back down. They run independently. That is what lets the agent answer why the call is still live. In code, the loop has four steps. Open the session, send the mic audio up, receive the model audio back, play it in the browser. So, part two takeaway, the loop is simple.

02:50 Open, send, receive, play. Everything else is plumbing. And at this point, you have a working voice agent. But a working loop is not the same as a conversation. To make her feel alive, you need three more ideas. First, she listens. So, how does the model know when you're done talking? That is voice activity detection, VAD. The mental model is simple.

03:19 The model is always asking, is someone speaking right now or is it silence? That is how it finds the edges of your turn. When you start, when you stop. That is also why you stream audio even when you're quiet. The model needs the steady stream to catch the moment you begin. With Gemini Live, VAD is built in. You do not have to write it yourself. Second, you can interrupt her.

03:52 That is barge in. Barge in means you can talk over the agent and it stops. A walkie-talkie cannot do this and a real conversation can. The same VAD that detects your turn also notice when you start talking over the model. When that happens, the model stops itself and it sends an interrupted signal. But there is one detail that makes it feel instant.

04:20 Your app should also stop the local audio as soon as the microphone hears you. Do not wait for the signal to cross the network. Stop playback locally. Then let the model catch up and that is what makes interruption feel natural. Third, she can do things. On its own, the model can only produce words. It cannot play a song. It cannot skip a track. It cannot click a button.

04:49 So, you give it tools. A tool is a function in your code. It has a name, it has a description and it represents one action that agent can ask for. For example, play a playlist, skip the current track, pause the music. When the model decides it needs one, it does not just talk. It says, "Call the tool with these arguments." Then your code runs the tool and your code reports back.

05:15 The model decides, your code acts. This is the one rule matters a lot for voice. While a tool is running, the model waits. So, tools need to return fast. If a tool takes too long, the conversation goes silent. That is why your music tool finds the command and returns right away. It does not make the agent pause. Part three takeaway, VAD finds your turn.

05:45 Barging lets you to cut in. Tools let her act. That is what makes the agent feel alive. So, here is what we built. First, we saw why live voice is different. TTS reads, Gemini Live hears. The voice path is audio in, audio out, and the response streams back live. Second, we saw the architecture. Browser, backend, Gemini Live, one open web socket, and the core loop.

06:17 Open, send, receive, play. Third, we saw what makes the agent feel alive. Voice activity detection, barging, and tools. That is a live voice agent on the raw Gemini Live API. That's it. Don't forget to leave your thoughts in the comments. In the next episode, we will rebuild this app with Google ADK. Today, we used JAI SDK on purpose. You saw every moving piece.

06:46 The session, the stream, the audio loop, the tools. But ADK gives us a framework that runs those pieces for us. The agent, the session, the streaming loop, and the queue that keeps a live call flowing. I will see you in the next episode. Bye.