Google Gemini Live
The Gemini Live API lets developers create natural conversations by enabling a two-way WebSocket connection with the Gemini models. The Live API processes data streams in real time. Users can barge in with new input while the model is responding, similar to a real conversation. Key features include:
- Multimodal Streaming: The API supports streaming of text, audio, and video data.
- Bidirectional Interaction: The user and the model can provide input and output at the same time.
- Barge-in: Users can speak during the model’s response, and the model adjusts its response.
- Tool Use and Function Calling: The API can use external tools to perform actions and get context while maintaining a real-time connection.
- Provider Sessions: Maintains conversation context within a Gemini Live session. For SDK session persistence, see Session Management.
- Secure Authentication: Uses tokens for secure client-side authentication.
Installation
Section titled “Installation”The Google Gemini Live provider is configured as an optional dependency in Strands Agents.
To install it, run:
pip install 'strands-agents[bidi-google,bidi-io,bidi-pyaudio]'Or to install all bidirectional streaming providers at once:
pip install 'strands-agents[bidi-all,bidi-pyaudio]'After installing the Gemini Live and local audio extras, create a voice agent:
import asyncio
from strands.bidi.agent import BidiAgentfrom strands.bidi.io import AudioIOfrom strands.bidi.models import GoogleGeminiLiveModelfrom strands.vended_tools import notebook
async def main() -> None: model = GoogleGeminiLiveModel( model_id="gemini-3.8-live", voice="Kore", client_args={"api_key": "<GOOGLE_API_KEY>"}, ) agent = BidiAgent(model=model, tools=[notebook])
audio_io = AudioIO() await agent.run(inputs=[audio_io.input()], outputs=[audio_io.output()])
if __name__ == "__main__": asyncio.run(main())Configuration
Section titled “Configuration”Client Options
Section titled “Client Options”Pass Google GenAI client options through client_args. For the supported fields, see
the Google GenAI client reference.
Model Config
Section titled “Model Config”| Parameter | Description | Example | Options |
|---|---|---|---|
model_id | Gemini Live model identifier. | "gemini-3.8-live" | Gemini models |
audio | Input audio options. | {"input": {"sample_rate": 48000}} | reference |
voice | Prebuilt output voice name. Uses the provider default when omitted. | "Kore" | Voices and languages |
params | Gemini Live session parameters. | {"temperature": 0.7} | LiveConnectConfig |
connection | Restart timing overrides. | {"auto_reconnect": False} | reference |
Additional Provider Options
Section titled “Additional Provider Options”Use direct options such as voice for common settings. For additional Google GenAI
options, pass params using snake_case field names.
from strands.bidi.models import GoogleGeminiLiveModel
model = GoogleGeminiLiveModel( model_id="gemini-3.8-live", client_args={"api_key": "<GOOGLE_API_KEY>"}, voice="Kore", params={"temperature": 0.7, "speech_config": {"language_code": "en-US"}},)Nested dictionaries in params merge with the existing configuration, preserving
unspecified fields. If a setting overlaps with a default or direct option, params
takes precedence.
Calling update_config(params=...) replaces the entire params dictionary. The new
values take effect on the next start() or restart().
Session Resumption
Section titled “Session Resumption”For connection restarts, the provider resumes the same server-side session through Gemini’s session resumption handle, carrying context across the restart without replaying history. Resumed sessions persist up to 24 hours; after that, create a new GoogleGeminiLiveModel instance to continue the conversation.
Troubleshooting
Section titled “Troubleshooting”Module Not Found
Section titled “Module Not Found”If you encounter the error ModuleNotFoundError: No module named 'google.genai', this means the google-genai dependency hasn’t been properly installed in your environment. To fix this, run pip install 'strands-agents[bidi-google]'.
API Key Issues
Section titled “API Key Issues”Set your Google AI API key through client_args or the GOOGLE_API_KEY
environment variable. You can obtain an API key from
Google AI Studio.