livekit agent transitions not support realtime? to...
# ask-ai
c
livekit agent transitions not support realtime? tools are not automatically updates in the realtime session
t
Thanks for reaching out, Santiago. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're right to expect tools and agent transitions to update in realtime — LiveKit supports runtime tool updates via `AgentSession`/`Agent.update_tools()` and tools can be loaded from MCP or shared across agents. To help diagnose why your tools aren't appearing to update, could you answer a few quick questions? 1. Are you running an STT‑LLM‑TTS pipeline or a
RealtimeModel
? 2. How are you updating tools (calling
update_tools()
, via MCP, or another method)? If
update_tools()
, are you awaiting the call? 3. Is the behavior silent (no errors) or do you see exceptions / logs when you attempt the update? 4. Are multiple agents/sessions involved, and do you expect tool changes to propagate between them? With those details I can suggest concrete checks and fixes (awaiting the async call, session/state sync points, or RealtimeModel configuration). Would you like step-by-step troubleshooting after you share the answers? Sources: Tool definition and use | LiveKit docs
c
when im using RealtimeModel, and i transionate fron an agent to an othert by returning it as tool response i expect that tool are auctomatically updated to the new agent ones but that is not happening... so?
t
Thanks — I understand you're using a
RealtimeModel
and switching agents by returning the new agent in a tool response, and you expect the toolset to switch automatically but it isn't. Here's what to check and how to fix it. 1) Confirm you update the active agent's tools explicitly • Returning an agent object as a tool response does not automatically replace the running agent's toolset in the Realtime session. • Call
update_tools()
on the active
AgentSession
(or the agent instance managing the session) with the new agent's tools and await it. This replaces all tools at runtime. 2) Ensure you await async operations •
update_tools()
is asynchronous. If you don't await it, the session may continue using the old tools. 3) Synchronize session/agent state • Make sure the
AgentSession
that runs the Realtime pipeline receives the update. If you create a new agent instance but the session keeps referencing the old agent object, tools won’t change. • If multiple sessions or agents are involved, propagate the new tools to each session that should see the change. 4) Check RealtimeModel configuration • Verify your RealtimeModel is configured to accept runtime tool updates (dynamic behavior). Some Realtime setups require explicit handlers to apply tool changes during an active connection. 5) Look for silent failures • Watch logs/console for exceptions when calling
update_tools()
(permission, network, or serialization errors). A silent failure will leave tools unchanged. If you want, share the minimal code snippet that: • shows how you return the new agent in the tool response, • how you call
update_tools()
(or if you’re not), and • how the RealtimeModel/AgentSession is wired —I’ll point out exactly where to add the awaited update and any session sync needed.
c
how do i get the tool from inside an aagent class
t
You're asking how to access tools from inside an Agent class — you can use the agent's
self.tools
property. It returns the list of
FunctionTool
instances registered with that agent (decorated tools and those added at init or via
update_tools()
). Example:
Copy code
class MyAgent(Agent):
    @function_tool()
    async def example_tool(self, context: RunContext):
        # get all tools on this agent
        available_tools = self.tools  # list of FunctionTool objects
        for tool in available_tools:
            print(tool.name, tool.description)
        # optionally find a specific tool by name
        my_tool = next((t for t in available_tools if t.name == "tool_name"), None)
        if my_tool:
            # invoke or inspect as needed
            ...
        return "done"
If you plan to replace tools at runtime, call and await
update_tools()
on the AgentSession (or agent instance managing the session) so
self.tools
reflects the new set. Sources: Tool definition and use | LiveKit docs | Agents and handoffs | LiveKit docs