clean-doctor-99713
12/10/2025, 1:47 PMtall-airline-16756
12/10/2025, 1:47 PMtall-airline-16756
12/10/2025, 1:47 PMRealtimeModel?
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 docsclean-doctor-99713
12/10/2025, 1:49 PMtall-airline-16756
12/10/2025, 1:49 PMRealtimeModel 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.clean-doctor-99713
12/10/2025, 1:50 PMtall-airline-16756
12/10/2025, 1:50 PMself.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:
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