🔒 5 more in the full analysis
🔒 5 more in the full analysis
Build a voice agent with bidirectional audio, streaming responses, interruption handling, and code-controlled actions such as playing, skipping, or pausing music.
Full plans for 1 idea. Inquire for details →
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.