| [ Web Proxy ] |
| Viewing: https://adk.dev/integrations/../../live/../../../../../../../../../tutorials/../../../live/models/ | [Back] [Original] |
[logo]
Live agents require a model that can hold a bidirectional connection; a standard Gemini model will not. For the models ADK supports outside live agents, and for non-Gemini providers, see Models for agents.
Live agents run on models that take audio in and produce audio out, end to end, with no intermediate text-to-speech stage. That is what gives them human-like speech with natural prosody, and it is what a standard Gemini model cannot do over a bidirectional connection.
| Model | AI Studio | Agent Platform |
|---|---|---|
| Gemini 2.5 Flash Live | gemini-2.5-flash-native-audio-preview-12-2025 (Preview) |
gemini-live-2.5-flash-native-audio (GA) |
| Gemini 3.1 Flash Live | gemini-3.1-flash-live-preview (Preview) |
Not available |
Gemini 2.5 Flash Live is one model with a different ID on each backend; the features are the
same either way. gemini-live-2.5-flash-native-audio is ADK's LlmAgent.DEFAULT_LIVE_MODEL,
the only Live model that is publicly available, and the model used in this section's examples.
Gemini 3.1 Flash Live is the newer model and is lower latency, but it is AI Studio only and it drops features that 2.5 has see Per-model feature support before you switch.
Live models are reached through one of two backends. ADK talks to both with the same code; you switch with environment variables, so you can develop on one and deploy on the other.
| AI Studio | Agent Platform | |
|---|---|---|
| Full name | Google AI Studio | Gemini Enterprise Agent Platform |
| Best for | Prototyping, development | Production, enterprise |
| Auth | API key (GOOGLE_API_KEY) |
Cloud credentials (GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION) |
| Setup | API key only | Cloud project setup |
| Limits | Session duration and concurrency | Session duration and concurrency |
Switch with the GOOGLE_GENAI_USE_ENTERPRISE environment variable (FALSE for AI Studio,
TRUE for Agent Platform); no code changes. See the
quickstarts for setup.
Agent Platform: the global location is not supported
Live models are not available at GOOGLE_CLOUD_LOCATION=global. Use a regional
endpoint such as us-central1, us-east1, or asia-northeast1, and check it against
the endpoint-locations table in
Agent Platform locations
before deploying.
These models produce audio directly, with natural prosody, and detect the conversation language on their own. What you configure on top voices, transcription, turn detection is described in Configuration.
One property is fixed at the model level: Live models produce audio only. They do not
support the TEXT response modality, so to get text alongside speech you use
audio transcription.
A few RunConfig and tool settings depend on which model you are running:
| Feature | Gemini 2.5 Flash Live | Gemini 3.1 Flash Live |
|---|---|---|
| Proactivity and affective dialog | Opt-in via RunConfig |
Not supported |
response_scheduling on tools |
Supported | Not supported; function calling is synchronous, so the model stays silent until you return the tool response |
| Thinking control | thinking_budget |
thinking_level (minimal, low, medium, high) |
Moving from 2.5 to 3.1
Leaving RunConfig.proactivity or RunConfig.enable_affective_dialog set is the most
common upgrade failure remove them. Two more differences bite client code: a single
server event can now carry several content parts at once, so iterate over
event.content.parts instead of reading parts[0]; and turn coverage now defaults to
including all detected audio activity and video frames, which changes token costs if you
stream video continuously. See the upstream
migration notes.
Both backends cap how long a connection and a session can run and how many sessions run at once. These numbers change, so treat the upstream documentation as authoritative and verify before you rely on a limit in production.
| Limit | AI Studio | Agent Platform |
|---|---|---|
| Session duration, audio-only | 15 min | 15 min |
| Session duration, audio + video | 2 min | 2 min |
| Connection lifetime | ~10 min | ~10 min |
| Concurrent sessions | See rate limits | Up to 1,000 per project on pay-as-you-go; no limit with Provisioned Throughput |
Agent Platform additionally caps a conversation session at 10 minutes by default, separately from the audio-only limit above.
Enabling context window compression lets a session be extended past the duration limits. On Agent Platform, request concurrent-session increases from the Cloud Console Quotas page under "Bidi generate content concurrent requests". Verify the current numbers against the AI Studio, Gemini API rate limits, and Agent Platform documentation.
Read the model name from an environment variable rather than hard-coding it. The same model
has a different ID on AI Studio and Agent Platform, so an .env var is what lets one codebase
target both backends, and it insulates you from model deprecations.
Recommended Pattern:
import os
from google.adk.agents import Agent
# Use environment variable with fallback to a sensible default
agent = Agent(
name="my_agent",
model=os.getenv("DEMO_AGENT_MODEL", "gemini-live-2.5-flash-native-audio"),
tools=[...],
instruction="..."
)
Why use environment variables:
Configuration in .env file:
# AI Studio
DEMO_AGENT_MODEL=gemini-2.5-flash-native-audio-preview-12-2025
# AI Studio, if you do not need proactivity, affective dialog, or non-blocking tools
# DEMO_AGENT_MODEL=gemini-3.1-flash-live-preview
# Agent Platform
# DEMO_AGENT_MODEL=gemini-live-2.5-flash-native-audio
Environment Variable Loading Order
When using .env files with python-dotenv, you must call load_dotenv() before importing any modules that read environment variables. Otherwise, os.getenv() will return None and fall back to the default value, ignoring your .env configuration.
Correct order in main.py:
from dotenv import load_dotenv
from pathlib import Path
# Load .env file BEFORE importing agent
load_dotenv(Path(__file__).parent / ".env")
# Now safe to import modules that use environment variables
from google_search_agent.agent import agent
Incorrect order (will not work):
from dotenv import load_dotenv
from google_search_agent.agent import agent # Agent reads env var here
# Too late! Agent already initialized with default model
load_dotenv(Path(__file__).parent / ".env")
This is a Python import behavior: when you import a module, its top-level code executes immediately. If your agent module calls os.getenv("DEMO_AGENT_MODEL") at import time, the .env file must already be loaded.
Selecting the right model:
.env file and read it from there when constructing the agentFor the latest information on model compatibility and availability:
Always verify model availability and feature support in the official documentation before deploying to production.
| Web Proxy Viewer | New URL | Original Page |