When using the Gemini live API - I can no longer u...
# agents
f
When using the Gemini live API - I can no longer use the hook "on_user_turn_completed". Why is that? I was running a few tasks in this but they are no longer being run.
Copy code
# Configure AgentSession with Gemini native audio
    session = AgentSession(
        llm=google.realtime.RealtimeModel(
            model="gemini-2.5-flash-native-audio-preview-12-2025",
            voice="Puck",
            temperature=0.8,
            _gemini_tools=[types.GoogleSearch()],
        ),
        allow_interruptions=True,
    )
l
Did you see the blue note under here: https://docs.livekit.io/agents/logic-structure/nodes/#on_user_turn_completed.
on_user_turn_completed
requires turn detection to happen at the agent level, rather than use the realtime model's built-in turn detection, that's why it is not firing.
f
Another question for realtime models - I usually inject a lot of external information to the model via sandwiching "system messages" in the chat_ctx on conversation hooks like "on_user_turn_completed" etc. With live models - is it still possible to inject system messages to the chat_ctx and if so what hooks or events should i use given that "on_user_turn_completed" is not available.
l
Yes, it's possible through `update_chat_ctx`: https://docs.livekit.io/reference/python/v1/livekit/agents/voice/index.html#livekit.agents.voice.Agent.update_chat_ctx. For hooks, I'm not sure - maybe you could call it before or after specific tool calls. If it's integral to your application, you could still use the agent's turn detection and continue to use
on_user_turn_completed
.