Quick Overview
This instructional video is presented by AI engineer Annie Wang from Google Cloud Tech as part of a series on building live conversational voice agents with Gemini. It introduces the architectural fundamentals and practical coding patterns required to connect real-time voice agents to external functions via tool calling.
Key Points
- 1.Language models cannot interact with external systems directly and rely on tool calling to trigger code executions during conversation.
- 2.The tool calling loop consists of four distinct phases: declare, decide, execute, and return.
- 3.Developers can implement tool calling either manually with the raw Gemini SDK or automatically using Python functions and docstrings in the Agent Development Kit (ADK).
- 4.Live voice tools must execute synchronously and return immediately to prevent unnatural conversational silences.
- 5.The before_tool_callback checkpoint allows applications to observe, block, or rewrite tool calls before execution without breaking character.
Summary
Annie Wang explains how to equip a Gemini Live voice agent with external capabilities through real-time tool calling. On its own, a multimodal language model can only produce words and cannot directly operate software controls like playing music, skipping tracks, or adjusting playback. To grant real abilities, developers provide the model with a menu of function declarations detailing each tool name, its parameters, and a natural language description explaining when it should be used.
During a live conversation, the interaction operates within a four-step loop: declare, decide, execute, and return. First, the application declares available tools during session configuration. When a user issues a voice prompt, the model decides to emit a structured tool call containing the appropriate arguments rather than generating plain speech. The application backend intercepts this call and executes the local code. Once complete, the backend returns the result to the model, which smoothly incorporates the outcome and continues speaking without breaking conversational flow.
Two methods exist for writing tools. The raw Google Gen AI SDK requires writing dictionary schemas and manually handling every dispatch, catch, execution, and return step. In contrast, the Agent Development Kit, or ADK, streamlines the implementation. Developers write standard Python functions with docstrings, and ADK automatically parses the signature schema and manages the execution loop. Adding a new ability, such as a sleep timer that automatically stops playback after a set duration, simply requires defining the function and appending it to the agent tool list.
Maintaining a natural conversational feel requires following two critical operational rules. First, because live voice models pause speech while waiting for tool responses, every tool must execute instantly. If an action requires extensive time, the tool should fire the task in the background and return an immediate success status so speech continues uninterrupted. Second, applications should use intercepting checkpoints like the before_tool_callback in ADK. This callback inspects every tool call before execution, enabling systems to observe logs, modify arguments, or block prohibited operations, such as preventing loud music during late-night quiet hours, while allowing the agent to maintain its conversational persona.
The Tool Calling Loop
On its own, a language model only generates text and cannot interact with software or hardware interfaces directly. By supplying a menu of described functions, developers enable the model to emit structured tool calls during live conversation. The process cycles through four steps: the developer declares available functions, the model decides which function to invoke, the backend code executes the action, and the result is returned to the model while speech continues smoothly.
Implementing Tools with Raw SDK versus ADK
Tool calling can be implemented in two distinct ways. Using the raw Google Gen AI SDK requires developers to manually construct dictionary schemas, catch model calls, dispatch functions, and return responses. Alternatively, the Agent Development Kit (ADK) automates the entire loop by extracting schemas directly from Python function signatures and docstrings, allowing developers to add capabilities with minimal code.
Rules for Maintaining Conversational Flow
Because voice models wait for a tool to return before continuing speech, tools must respond almost instantaneously to avoid awkward pauses. Long-running tasks should be acknowledged and triggered asynchronously in the background. Additionally, using ADK callbacks like before_tool_callback provides a checkpoint where applications can observe, block, or modify actions based on business logic, such as enforcing quiet hour rules.
The Bottom Line
This tutorial establishes the core mechanics of real-time tool calling in Gemini Live voice agents, contrasting manual SDK loops with automated ADK implementations. It demonstrates how to keep voice interactions natural using immediate synchronous returns and policy checkpoints. While fast, localized functions are fully resolved here, managing long-running tasks and browser automation is left for future exploration.
FAQ
What is tool calling and how does it give voice AI agents abilities?
Tool calling is a mechanism where an AI model emits structured function calls instead of text responses when it decides an action is needed. The host application executes the requested code and returns the result, enabling the voice agent to trigger actions like controlling media playback.
What are the four steps in the live tool calling loop described in the video?
The four steps are declare, decide, execute, and return. The developer declares the available tools, the model decides which tool to call, the application executes the code, and the output is returned to the model.
How does implementing tools in the Agent Development Kit differ from using the raw SDK?
Using the raw SDK requires manually defining dictionary schemas and writing the dispatch loop code by hand. In the Agent Development Kit (ADK), tools are written as standard Python functions where the schema and description are automatically extracted from signatures and docstrings.
Why must live voice AI agent tools execute and return almost instantly?
Voice models operate synchronously and pause speech while waiting for a tool call to return. Slow execution causes unnatural conversational silence that makes the voice agent feel unresponsive or broken.
What is the purpose of the before_tool_callback checkpoint in the Agent Development Kit?
The before_tool_callback intercepts tool calls before they run, allowing the application to observe execution logs, block forbidden operations, or rewrite argument parameters without interrupting the conversational persona of the agent.
Worth watching for
Software developers and AI engineers building real-time voice applications and multimodal conversational agents with Google Gemini and the Agent Development Kit.
- gemini-live
- tool-calling
- voice-ai
- google-cloud
- python
- ai-agents