red-dentist-96118
04/21/2026, 5:37 PMtall-airline-16756
04/21/2026, 5:37 PMtall-airline-16756
04/21/2026, 5:37 PMgenerate_reply(), update_instructions(), update_chat_ctx() and some tool-calling features are restricted), but normal voice I/O and TTS with Cartesia work.
If you want, I can:
1. Show a minimal AgentSession example that wires Gemini 3.1 to Cartesia TTS.
2. Help troubleshoot a specific config or error you’re seeing. Which would you prefer? Sources: Google Gemini LLM | LiveKit Documentation | Large language models (LLM) overview | LiveKit Documentation | LiveKit Inference | LiveKit Documentation | Cartesia TTS | LiveKit Documentation | Build Your First AI Voice Agent in Python: Complete Tutorial | LiveKit, with interactive elementsred-dentist-96118
04/21/2026, 5:39 PMtall-airline-16756
04/21/2026, 5:39 PMcartesia/sonic-3) for TTS.
• Limitation to note: the Gemini 3.1 Flash Live Preview has restrictions on mid-session control functions (for example, generate_reply(), update_instructions(), update_chat_ctx() and some tool-calling features). Voice I/O and Cartesia TTS operate normally.
Would you like a minimal AgentSession code example wired to the Gemini 3.1 live model and Cartesia TTS or help applying this to your project?
, with interactive elementsred-dentist-96118
04/21/2026, 5:40 PMtall-airline-16756
04/21/2026, 5:40 PMSadachbia voice.
Use the same ctx, *args, **kwargs signature but pass the Gemini 3.1 realtime model in llm and avoid removed/unsupported fields. Example patterns:
Python
def handle_turn(ctx, *args, **kwargs):
session = AgentSession(
llm=google.beta.realtime.RealtimeModel(
model="gemini-3.1-flash-live-preview",
voice="Sadachbia",
temperature=0.7,
thinking_config=types.ThinkingConfig(thinking_level="minimal"),
),
# other session config (tts, stt, vad, etc.)
)
# use ctx, args, kwargs as needed for history/seeding
TypeScript
function handleTurn(ctx: any, ...args: any[]) {
const session = new AgentSession({
llm: new google.beta.realtime.RealtimeModel({
model: "gemini-3.1-flash-live-preview",
voice: "Sadachbia",
temperature: 0.7,
thinkingConfig: { thinkingLevel: "minimal" },
}),
// other session config (tts, stt, vad, etc.)
});
// use ctx and args for seeding history or input
}
Key notes:
• Remove unsupported params like enable_affective_dialog and proactivity.
• Replace thinkingBudget with thinkingLevel via thinking_config / thinkingConfig.
• generate_reply(), update_instructions(), and update_chat_ctx() are not compatible mid-session.
• send_client_content is only allowed for initial history seeding; subsequent uses will be rejected.
If you want, tell me which language (Python/TS) and where you currently pass ctx, args, and kwargs and I’ll adapt the snippet to your exact function.
Sources: Gemini Live API plugin | LiveKit Documentation, with interactive elementsred-dentist-96118
04/21/2026, 5:41 PMtall-airline-16756
04/21/2026, 5:41 PMctx, *args, **kwargs and wire Gemini 3.1 to Cartesia voices. Pick Python or TypeScript and I can tailor it to your code.
Python example
def handle_turn(ctx, *args, **kwargs):
session = AgentSession(
llm=google.beta.realtime.RealtimeModel(
model="gemini-3.1-flash-live-preview",
# Gemini voice setting can be omitted since Cartesia will handle TTS
temperature=0.7,
thinking_config=types.ThinkingConfig(thinking_level="minimal"),
),
tts="cartesia/sonic-3", # Cartesia TTS provider
# other agent config (stt, vad, turn detection...)
)
# seed initial history using ctx/args/kwargs if needed (only allowed at session start)
session.seed_history(ctx)
# handle turn input from args/kwargs and run session
return session.run_turn(*args, **kwargs)
TypeScript example
function handleTurn(ctx: any, ...args: any[]) {
const session = new AgentSession({
llm: new google.beta.realtime.RealtimeModel({
model: "gemini-3.1-flash-live-preview",
temperature: 0.7,
thinkingConfig: { thinkingLevel: "minimal" },
}),
tts: "cartesia/sonic-3",
// other session config
});
// seed initial history with ctx (allowed only at session start)
session.seedHistory(ctx);
return session.runTurn(...args);
}
Key points
• Use tts set to the Cartesia model (e.g., cartesia/sonic-3 or a specific voice ID) in the AgentSession.
• Don’t include unsupported Gemini 3.1 fields (enable_affective_dialog, proactivity). Use `thinking_config`/`thinkingConfig` instead of thinkingBudget.
• send_client_content is allowed only for initial history seeding; generate_reply(), update_instructions(), and update_chat_ctx() are not compatible mid-session.
• Cartesia handles TTS output; Gemini 3.1 handles the LLM responses.
Want me to:
• Insert a specific Cartesia voice ID (tell me the voice ID), or
• Adapt the snippet to your existing function (share the function signature)?, with interactive elementsred-dentist-96118
04/21/2026, 5:43 PMtall-airline-16756
04/21/2026, 5:44 PM1fc31370-81b1-4588-9c1a-f93793c6e01d for TTS while keeping your function signature ctx, *args, **kwargs.
Python
from livekit.plugins import google, cartesia, types
def handle_turn(ctx, *args, **kwargs):
session = AgentSession(
llm=google.beta.realtime.RealtimeModel(
model="gemini-3.1-flash-live-preview",
temperature=0.7,
thinking_config=types.ThinkingConfig(thinking_level="minimal"),
),
tts="cartesia/sonic-3", # Cartesia model
tts_voice_id="1fc31370-81b1-4588-9c1a-f93793c6e01d", # specific voice ID
# other config: stt, vad, turn detection...
)
# seed initial history with ctx (only allowed at session start)
session.seed_history(ctx)
return session.run_turn(*args, **kwargs)
TypeScript
import * as google from '@livekit/agents-plugin-google';
function handleTurn(ctx: any, ...args: any[]) {
const session = new AgentSession({
llm: new google.beta.realtime.RealtimeModel({
model: "gemini-3.1-flash-live-preview",
temperature: 0.7,
thinkingConfig: { thinkingLevel: "minimal" },
}),
tts: "cartesia/sonic-3", // Cartesia model
ttsVoiceId: "1fc31370-81b1-4588-9c1a-f93793c6e01d", // specific voice ID
// other config: stt, vad, turn detection...
});
session.seedHistory(ctx); // allowed only at session start
return session.runTurn(...args);
}
Notes
• Omit unsupported Gemini 3.1 params (enable_affective_dialog, proactivity). Use `thinking_config`/`thinkingConfig` instead of thinkingBudget.
• generate_reply(), update_instructions(), and update_chat_ctx() are not compatible mid-session.
• send_client_content may only be used for initial history seeding.
• If your SDK uses different field names for specifying a Cartesia voice, swap tts_voice_id / ttsVoiceId for the correct property (I used those names as common patterns).
Want me to adapt this to your exact function body or your SDK’s field names?
, with interactive elements