I am having an issue after I updated to the latest...
# ask-ai
a
I am having an issue after I updated to the latest version of livekit, where gemini uses the tool: hang_up just after connecting. This is my session code for gemini:
Copy code
"llm": google.beta.realtime.RealtimeModel(
                    model=llm_model,
                    voice=voice,
                    thinking_config=types.ThinkingConfig(include_thoughts=False),
                    temperature=metadata.get("temperature", 0.8),
                    input_audio_transcription=InputAudioTranscription(
                        model="gpt-4o-transcribe",
                        language=language,
                        prompt="Forvent danske ord og sætninger. Kontekst er et telefonopkald.",
                    ),
                    enable_affective_dialog=True,
                    proactivity=False,
                ),
and this is my logs:
Copy code
2025-11-07 14:58:05,564 - INFO livekit.agents - received job request {"job_id": "AJ_qTBpgHRvmgka", "dispatch_id": "", "room_name": "call-_+4526288111_3Em5RJDYJfo8", "agent_name": "", "resuming": false}
2025-11-07 14:58:05,700 - INFO livekit.agents - initializing process {"pid": 76388}
2025-11-07 14:58:06,845 - INFO livekit.agents - process initialized {"pid": 76388, "elapsed_time": 1.14}
2025-11-07 14:58:09,052 - INFO agent - Started recording with EgressID: EG_MyUvgJU2NVbF {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,131 - INFO agent - Successfully updated chat 54821e1d-56f5-4daa-9249-6c6b12f7a99f with recording info {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,211 - DEBUG livekit.agents - input stream attached {"participant": null, "source": "SOURCE_UNKNOWN", "accepted_sources": ["SOURCE_MICROPHONE"], "pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,312 - DEBUG livekit.plugins.google - connecting to Gemini Realtime API... {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,313 - WARNING livekit.agents - the RealtimeModel uses a server-side turn detection, allow_interruptions cannot be False when using VoiceAgent.generate_reply(), disable turn_detection in the RealtimeModel and use VAD on the AgentTask/VoiceAgent instead {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,313 - DEBUG livekit.agents - start reading stream {"participant": "sip_+4526288111", "source": "SOURCE_MICROPHONE", "pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,314 - DEBUG livekit.agents - using audio io: `RoomIO` -> `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,314 - DEBUG livekit.agents - using transcript io: `AgentSession` -> `TranscriptSynchronizer` -> `RoomIO` {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,961 - DEBUG livekit.agents - executing tool {"function": "hang_up", "arguments": "{\"is_successful\": true}", "speech_id": "speech_f02272336a69", "pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
2025-11-07 14:58:09,962 - INFO agent - Generating goodbye message {"pid": 76388, "job_id": "AJ_qTBpgHRvmgka"}
Any idea why this suddently happens?
t
Thanks for reaching out, Malte. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like the
hang_up
tool running immediately after connecting might be related to the agent's application logic rather than the Gemini RealtimeModel itself. Let’s explore a few possibilities together: • Tool Triggering: It could be helpful to take a closer look at the agent's code to see which tool functions are being called right after the
AgentSession
starts. Sometimes tools like
detected_answering_machine
or
end_call
might be causing the hang-up. • Initial Silence: If there’s silence detected at the beginning of the call, it might be mistaken as a reason to end the call. Checking the Voice Activity Detection (VAD) and turn detection settings might shed some light here. • RealtimeModel Configuration: Double-checking the
RealtimeModel
setup—especially
tool_behavior
and `tool_response_scheduling`—is a good idea. Just keep in mind these settings influence how tools are processed, but not exactly when they get triggered. To move forward, focusing on the agent’s logic and the conditions that trigger the
hang_up
tool would be a great next step. If you’d like, I’m here to help you debug specific parts of the code or configuration—just let me know! Sources: Understanding "silence detected on local audio track" warning | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki | agent.py | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...
a
It has worked fine before but started happening after i upgraded livekit-plugins from 1.2.14 to 1.2.18 Any changes in the Realtime class api that I need to account for relating to tools?
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!