eager-window-33590
09/07/2025, 12:31 AMtall-airline-16756
09/07/2025, 12:31 AMtall-airline-16756
09/07/2025, 12:32 AMRealtimeModel instance, just pass the instructions parameter to set your base system instructions. For example:
from livekit.plugins import google
session = AgentSession(
llm=google.beta.realtime.RealtimeModel(
model="gemini-2.0-flash-exp",
voice="Puck",
temperature=0.8,
instructions="You are a helpful assistant",
),
)
• If you want to update the instructions on the fly for an existing session, just use the update_instructions method. Keep in mind, this will restart the session to apply the new instructions:
await session.update_instructions("You are a helpful assistant who speaks like a pirate")
Just a heads-up: updating instructions will restart the session, so it’s a good idea to:
• Keep an eye on the session state to catch restarts.
• Handle any pending tasks smoothly by re-queuing them after the restart.
• Use session resumption handles to pick up where you left off, if that’s supported.
If you have any questions or need a hand with this, feel free to ask—I’m here to help!
Sources: Gemini Live API integration guide | LiveKit Docs | examples/voice_agents/gemini_video_agent.py | plugins/openai/src/realtime/realtime_model.ts