creamy-window-79763
05/01/2026, 12:56 PMtall-airline-16756
05/01/2026, 12:57 PMtall-airline-16756
05/01/2026, 12:57 PMsession.llm = new_llm_instance or providing a different llm when constructing the agent/session). This lets the agent switch which LLM it uses mid-session without returning a new agent from a tool call or performing a handoff.
Would you like a short code example for the language/runtime you're using (Python, Node, or other)?
Sources: Agents and handoffs | LiveKit Documentation, with interactive elementscreamy-window-79763
05/01/2026, 1:08 PMtall-airline-16756
05/01/2026, 1:09 PMAgentSession.llm has no setter. You cannot reassign session.llm directly.
You can still change which LLM the agent uses between turns without a handoff by overriding the agent’s llm_node and choosing the LLM dynamically there. Example pattern (Python-like):
async def llm_node(self, chat_ctx, tools, model_settings):
if should_use_large_model(chat_ctx):
llm_instance = inference.LLM(model="openai/gpt-4.1")
else:
llm_instance = inference.LLM(model="openai/gpt-4.1-mini")
async for chunk in llm_instance.chat(chat_ctx=chat_ctx, tools=tools):
yield chunk
If you prefer replacing the whole agent instead, use session.update_agent() to swap to an agent preconfigured with a different LLM.
Which approach would you like a full example for (override llm_node or session.update_agent)? And which runtime are you using (Python or Node)?
Sources: Agents and handoffs | LiveKit Documentation | Pipeline nodes and hooks | LiveKit Documentation, with interactive elements