late-businessperson-58140
12/17/2025, 6:37 AMtall-airline-16756
12/17/2025, 6:37 AMtall-airline-16756
12/17/2025, 6:37 AMlate-businessperson-58140
12/17/2025, 6:38 AMtall-airline-16756
12/17/2025, 6:38 AMsession.tts.update_options(
voice=hume.VoiceByName(name="Colton Rivers", provider=hume.VoiceProvider.hume),
description="Calm, serene voice",
speed=2,
)
This updates the TTS settings and they'll take effect for subsequent speech. If you tell me which TTS provider or SDK/language you're using, I can give the exact code snippet for that environment.
Sources: Hume TTS plugin guide | LiveKit Docs | ElevenLabs TTS plugin guide | LiveKit Docslate-businessperson-58140
12/17/2025, 6:39 AMtall-airline-16756
12/17/2025, 6:39 AMupdate_options call; instead you override the agent's tts_node so a new sarvam.TTS instance is created per utterance using current settings.
If this fits, try this pattern:
1. Store TTS parameters (e.g., speaker, target_language_code, pace) as instance variables on your Agent.
2. Provide a tool/method to update those variables at runtime.
3. Override tts_node to instantiate sarvam.TTS(...) with the current variables and delegate to Agent.default.tts_node.
Example (Python):
from livekit import agents
from livekit.plugins import sarvam
from typing import AsyncIterable
class MyAgent(agents.Agent):
def __init__(self):
super().__init__(instructions="You are a helpful assistant.")
self.speaker = "anushka"
self.target_language_code = "hi-IN"
@agents.function_tool()
async def change_voice(self, speaker: str, language: str):
self.speaker = speaker
self.target_language_code = language
return f"Voice changed to {speaker} ({language})."
async def tts_node(self, text: AsyncIterable[str], model_settings: agents.ModelSettings) -> AsyncIterable:
dynamic_tts = sarvam.TTS(
target_language_code=self.target_language_code,
speaker=self.speaker,
# add other dynamic params like pace, pitch if needed
)
return agents.Agent.default.tts_node(self, text, model_settings, tts=dynamic_tts)
Would you like a version of this for a specific SDK/language or help adding parameters like pace or pitch?
Sources: Agent speech and audio | LiveKit docslate-businessperson-58140
12/17/2025, 6:42 AMtall-airline-16756
12/17/2025, 6:42 AMget_tts(...), call update_options on the existing Sarvam TTS instance so the change applies to the next utterance.
Example pattern:
config = language_configs.get(language_code)
# If `session.tts` is your Sarvam TTS instance:
session.tts.update_options(
target_language_code=config["tts_language"],
speaker=config["tts_voice"],
# optional: pace=config.get("pace"), pitch=config.get("pitch"), loudness=...
)
If you need help wiring this into your agent/session:
• Tell me where the current TTS instance lives (e.g., session.tts, agent.tts, or created in tts_node).
• Or share get_tts(...) implementation and I’ll show exactly where to call update_options. Sources: Sarvam TTS plugin guide | LiveKit Docslate-businessperson-58140
12/17/2025, 6:45 AMtall-airline-16756
12/17/2025, 6:45 AMget_tts factory. You can use it, but the simplest, supported approach is to update the existing Sarvam TTS instance with update_options so changes apply on the next utterance rather than replacing the object mid-stream.
Two concise options:
1) Update the existing TTS instance (recommended)
• Keep one Sarvam TTS instance on the session/agent (e.g., session.tts).
• When you need new language/voice, call:
config = language_configs.get(language_code)
session.tts.update_options(
target_language_code=config["tts_language"],
speaker=config["tts_voice"],
# optional: pace=config.get("pace"), pitch=config.get("pitch"), loudness=...
)
This applies on the next utterance. If speech is currently playing, wait for playout or let it finish before speaking again.
2) Replace the TTS instance (if you prefer factory use)
• Create a new instance with get_tts(...) and assign it to the session/agent:
config = language_configs.get(language_code)
new_tts = get_tts(assistant, language=config["tts_language"], voice=config["tts_voice"])
session.tts = new_tts
This also takes effect for future utterances. Use this only if you must reconstruct the object (e.g., different API key or model settings).
Which do you want help wiring into your agent: calling update_options on session.tts, or replacing session.tts using get_tts(...)?late-businessperson-58140
12/17/2025, 7:03 AMtall-airline-16756
12/17/2025, 7:03 AMAgentSession.tts is a read-only property — you can't assign a new TTS instance to session.tts.
What to do instead (recommended)
• Call update_options on the existing Sarvam TTS instance so changes apply on the next utterance.
Example:
config = language_configs.get(language_code)
# update existing tts instance
session.tts.update_options(
target_language_code=config["tts_language"],
speaker=config["tts_voice"],
pace=config.get("pace"),
pitch=config.get("pitch"),
)
If you need to let current speech finish first, await the playout before updating:
await ctx.wait_for_playout()
session.tts.update_options(...)
await ctx.agent.say("Now speaking in the new voice.")
If you prefer replacing the instance (not recommended because session.tts is read-only), override tts_node on your Agent to construct a new sarvam.TTS per utterance (example I shared earlier). Tell me which approach you want and where your current TTS instance is created (in session init or tts_node) and I’ll give the exact code to plug in.