adorable-bear-14321
05/17/2026, 7:09 PMtall-airline-16756
05/17/2026, 7:09 PMtall-airline-16756
05/17/2026, 7:10 PMsession.is_running() (a way to check if a session is active) so you can safely call session.interrupt() only when appropriate.
There isn't a direct session.is_running() API. Instead, track the session lifecycle / agent state and only call session.interrupt() when the session is in a running phase (i.e., not initializing or closing) — specifically when the agent state indicates it's active (for example speaking, thinking, or listening). Use the agent_state_changed event to monitor those state transitions and maintain a local flag (e.g., isRunning) that you check before calling session.interrupt().
If you want, tell me which SDK/language you're using and I can show a short code example that listens for the agent_state_changed event and guards session.interrupt().
Sources: https://docs.livekit.io/agents/logic/sessions.md| | Agent session | LiveKit Documentation, with interactive elementsadorable-bear-14321
05/17/2026, 7:19 PMtall-airline-16756
05/17/2026, 7:20 PMgenerate_reply() when you get the error that it's not compatible with gemini-3.1-flash-live-preview.
Short answer:
• generate_reply() is not supported with gemini-3.1-flash-live-preview. Use one of these alternatives depending on your needs:
Options
• Switch to a compatible model that supports generate_reply() (for realtime audio): use a Gemini 2.5 realtime model such as gemini-2.5-flash-native-audio-preview-12-2025.
• Use LiveKit Inference (the STT → LLM → TTS pipeline) with a Gemini LLM (e.g., google/gemini-3-flash-preview) — inference.LLM supports generate_reply() and dynamic context updates.
• Keep gemini-3.1-flash-live-preview for realtime audio but avoid `generate_reply()`; rely on built-in realtime behaviors (e.g., on_enter lifecycle hooks) or normal conversational flow and tool calls supported by that realtime plugin.
If you tell me which SDK/language and whether you need realtime audio or manual reply control, I can give a short code example or exact model name to switch to.
Sources: Gemini Live API plugin | LiveKit Documentation | Bring your LangChain Agents to LiveKit | LiveKit | Agent speech and audio | LiveKit Documentation | Google Gemini LLM | LiveKit Documentation | Amazon Nova Sonic integration guide | LiveKit Documentation, with interactive elementsadorable-bear-14321
05/17/2026, 7:30 PMsession.chat_ctx.messages.append(
llm.ChatMessage(
role=llm.ChatRole.USER, # or "user"
text="Hello? Are you there?" # Note: Use 'text' (or 'content' depending on your package version)
)
)
correct way to append messagetall-airline-16756
05/17/2026, 7:30 PM# add a user message to the session chat context
session.chat_ctx.add_message(role="user", content="Hello? Are you there?")
# then persist the update if needed
await agent.update_chat_ctx(session.chat_ctx)
Node.js:
session.chatCtx.addMessage({ role: "user", content: "Hello? Are you there?" });
await agent.updateChatCtx(session.chatCtx);
This ensures the message is correctly formatted and integrated with the agent's history. If you tell me which SDK/version you're using, I can give a tailored snippet.
Sources: Chat context | LiveKit Documentation, with interactive elements