[2025-09-02 14:58:47,633] WARNING livekit.plugins....
# ask-ai
r
[2025-09-02 145847,633] WARNING livekit.plugins.google: truncate is not supported by the Google Realtime API. 2025-09-02 145847,633 - WARNING livekit.plugins.google - truncate is not supported by the Google Realtime API. [Audio] Array (Realtek(R) Au [-79.93 dBFS] [------------------------------] this error returns gemini realtime api
t
Thanks for reaching out, Av. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! You might have seen the warning "truncate is not supported by the Google Realtime API" because, well, the Google Realtime API integration in LiveKit just doesn’t support the truncate feature. This is by design, so when you call the
truncate
method, it simply logs a warning and doesn’t actually perform any truncation. But don’t worry! Here are some options you can try out: • Switch to OpenAI’s Realtime API: If truncation is a must-have for you, OpenAI’s Realtime API has this feature and lets you have precise control over message content and audio segments. • Use Interruption Handling: The Google Realtime API does support interruption handling through the
start_user_activity()
method, which can signal the server to pause the current response and keep the conversation flowing naturally. • Manually Update Chat Context: You can also manage the chat context yourself by adding new messages or updating instructions with
update_chat_ctx()
or
update_instructions()
. • Text-Only Mode: If audio is tricky, consider running the Google Realtime API in text-only mode and pair it with a separate TTS plugin for audio synthesis. If you want a hand setting any of these up or have more questions, just give me a shout—I’m here to help! Sources: agents/src/voice/agent_activity.ts | OpenAI and LiveKit | LiveKit Docs | Gemini Live API integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti...
r
async def entrypoint(ctx: agents.JobContext): room_id = ctx.room.name # Use room name as room ID # Initialize chat history for this room if room_id not in chat_history: chat_history[room_id] = [] session = AgentSession( # # any combination of STT, LLM, TTS, or realtime API can be used # llm=openai.LLM(model="gpt-4o", temperature=0.6), # llm=openai.realtime.RealtimeModel( # model="gpt-4o-realtime-preview", # temperature=0.6, # ), # stt=deepgram.STT(model="nova-3", language="en"), # stt=grc # # llm=anthropic.LLM(model="claude-3-5-sonnet-20240620"), # # llm=openai.realtime.RealtimeModel(model="gpt-4o-realtime-preview",temperature=0.1), # # llm=groq.LLM( # # # model="llama3-8b-8192" # # model="meta-llama/llama-4-scout-17b-16e-instruct", # # temperature=0.3, # # parallel_tool_calls=False, # # ), # # llm=groq.LLM( # # # model="llama3-8b-8192" # # model="meta-llama/llama-4-scout-17b-16e-instruct", # # temperature=0.3, # # parallel_tool_calls=False, # # ), # # tts=groq.TTS( # # model="playai-tts", # # voice="Arista-PlayAI", # # ), # # tts=cartesia.TTS(), # stt=groq.STT( # model="whisper-large-v3-turbo", # language="en", # ), # stt=deepgram.STT(model="nova-3", language="en"), # llm=openai.LLM(model="gpt-4o", temperature=0.6), # # llm=openai.LLM(api_key="test",base_url="http://localhost:11434",model="qwen2.5vl:latest"), # tts=openai.TTS( # model="tts-1", # voice="alloy", # # voice="onyx", # ), llm=google.beta.realtime.RealtimeModel( model="gemini-2.0-flash-exp", voice="Puck", temperature=0.8, ), vad=ctx.proc.userdata["vad"], # # use LiveKit's turn detection model # turn_detection=EnglishModel(), # max_tool_steps=10, # Maximum consecutive function calls per LLM turn (default is 3) # Using separate components instead of RealtimeModel for better language control # llm=openai.realtime.RealtimeModel( # model="gpt-4o-realtime-preview", # temperature=0.6, # ), ) mcp_server = MCPServerSse( params={"url": "http://localhost:7777/sse"}, cache_tools_list=True, name="FestoMCP" ) # Create room context to pass to MCP tools room_context = { "room_name": ctx.room.name, "room_id": ctx.room.name, # Using room name as room ID # You can add more context here: # "participant_count": len(ctx.room.participants), # "session_start_time": datetime.now().isoformat(), } agent = await MCPToolsIntegration.create_agent_with_tools( agent_class=Assistant, mcp_servers=[mcp_server], room_context=room_context # Pass the room context ) # Handle errors @session.on("error") def on_error(event): logger.error(f"Session error: {event.error}, recoverable: {event.error.recoverable}, source: {event.source}") if not event.error.recoverable: # asyncio.create_task(session.say("Sorry, an error occurred. Please try again.")) logger.error("Unrecoverable error occurred, stopping session.") await session.start( room=ctx.room, agent=agent, room_input_options=RoomInputOptions( noise_cancellation=noise_cancellation.BVC(), ), ) await ctx.connect() await session.generate_reply( instructions=SESSION_INSTRUCTION, ) if name == "__main__": agents.cli.run_app(agents.WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm)) this is my code
t
Thanks so much for sharing your code! Could you tell me a bit more about what’s going on? Are you running into an error, or is there a specific feature or setting you’d like some help with? I’m here to help!
r
this code gives [2025-09-02 145847,633] WARNING livekit.plugins.google: truncate is not supported by the Google Realtime API. 2025-09-02 145847,633 - WARNING livekit.plugins.google - truncate is not supported by the Google Realtime API. [Audio] Array (Realtek(R) Au [-79.93 dBFS] [------------------------------] this error
t
Hey there! That warning, "truncate is not supported by the Google Realtime API," pops up because the Google Realtime API integration in LiveKit doesn’t actually support the truncate feature. It’s a built-in limitation, so when the
truncate
method is called, it just logs a warning without doing any truncation. In your code, this might happen if
truncate
is being called either directly or indirectly. Here’s a friendly checklist to help you out: • Check for Explicit Calls: Take a quick look through your code to make sure you’re not calling
truncate
directly. • Review Dependencies: Sometimes libraries or plugins might try to use
truncate
. If that’s the case, see if you can update or tweak them. • Alternative Approaches: If you really need truncation, you might want to switch over to OpenAI’s Realtime API, which supports it, or try handling interruptions using the
start_user_activity()
method in the Google Realtime API. If you’d like a hand figuring out where
truncate
is being called or need help setting up an alternative, just let me know — I’m here to help!
r
issue is sometimes agent stopped google ai agent.
t
Hey there! It looks like the Google AI agent stopping unexpectedly in LiveKit might be due to a couple of reasons: • 5-Minute Session Limit: Google’s Speech-to-Text (STT) service has a 5-minute max session length. After that, it disconnects and tries to reconnect, which can make the agent temporarily drop out of the conversation. • Connection or API Issues: Sometimes, invalid API credentials or gRPC errors like
DeadlineExceeded
or
GoogleAPICallError
can cause the connection to break. Here are some friendly tips to help fix this: • Implement Reconnection Logic: Make sure your app can handle reconnections smoothly and updates the UI when the agent disconnects. LiveKit’s
useConnectionState
hook is super handy for keeping an eye on connection changes. • Validate API Credentials: Double-check that your Google API key or app credentials are set up correctly to avoid any hiccups. • Monitor Logs: Keep an eye on your logs for errors like
DeadlineExceeded
or `GoogleAPICallError`—they can give you clues on what’s going wrong. • Use Event Callbacks: Make sure your code handles the
onerror
event properly so you can trigger a reconnection or let users know if something’s up. If you want a hand setting any of this up or troubleshooting specific errors, just give me a shout—I’m here to help! Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/__init__.py | web/src/components/chat.tsx | web/src/components/chat.tsx | Google integration guide | LiveKit Docs | agents/src/voice/agent_activity.ts