Skip to content

Google Gemini Live

Google Gemini Live brings multilingual voice conversations to your agents, with support for text and images alongside speech. Users can share context, interrupt a reply, and ask the agent to take action through tools.

Follow the quickstart to build a voice agent that listens, speaks, and calls tools.

Install the Google Gemini Live extra:

Terminal window
pip install "strands-agents[bidi-google]"

For local audio dependencies and device setup, see Audio I/O.

Create an API key in Google AI Studio and set it in your environment:

Terminal window
export GOOGLE_API_KEY="your-api-key"

GoogleGeminiLiveModel reads GOOGLE_API_KEY automatically. You can also pass the key through client_args={"api_key": "your-api-key"}. For other client options, see the Google GenAI client reference.

Configure the Gemini Live model, output voice, and input audio, then pass the model to BidiAgent:

from strands.bidi.agent import BidiAgent
from strands.bidi.models import GoogleGeminiLiveModel
model = GoogleGeminiLiveModel(
model_id="gemini-3.8-live",
voice="Kore",
audio={"input": {"sample_rate": 48000}},
)
agent = BidiAgent(model=model)

Choose a voice from Google’s voice options. Audio uses mono PCM, with 16 kHz input by default and fixed 24 kHz output. Set audio.input.sample_rate to match your input source; Gemini resamples incoming audio as needed. The adapter enables transcripts for both user speech and model responses.

See the GoogleGeminiLiveModel API reference for all constructor options.

Pass Google’s LiveConnectConfig settings through params to customize the conversation. Gemini uses automatic voice activity detection by default. This example allows 800 milliseconds of silence before detecting the end of speech:

from strands.bidi.models import GoogleGeminiLiveModel
model = GoogleGeminiLiveModel(
model_id="gemini-3.8-live",
params={
"realtime_input_config": {
"automatic_activity_detection": {"silence_duration_ms": 800},
},
},
)

Use the Google GenAI SDK’s snake_case field names inside params. Nested settings merge with the defaults, and params takes precedence over direct options such as voice.

Gemini limits each connection to about 10 minutes. By default, BidiAgent schedules a restart after nine minutes. The adapter uses session resumption to reconnect to the same server-side conversation. If resumption is unavailable or fails, it opens a new session and replays text from conversation history, including completed transcripts.

The adapter also enables context window compression by default, allowing the session to continue as its history grows. Set connection.restart_after_s to customize the restart schedule. See Connection restarts for timing and events.