future-dream-79030
11/13/2025, 8:30 PMtall-airline-16756
11/13/2025, 8:30 PMtall-airline-16756
11/13/2025, 8:31 PMupdate_tools() method. Just keep in mind that this method replaces all currently available tools, so when adding new ones, be sure to include any existing tools you'd like to keep.
Adding or Updating Tools:
• If you want to add a tool on the fly, start by getting the current tools with agent.tools, then add your new tool like this:
await agent.update_tools(agent.tools + [tool_a])
• If you'd rather replace all tools (including those originally defined in the agent class), simply pass a new list:
await agent.update_tools([tool_a, tool_b])
Removing Tools:
• To remove a specific tool, you can filter it out from the current tools like this:
await agent.update_tools(agent.tools - [tool_a])
Creating Tools Programmatically:
• You also have the flexibility to create tools on-the-fly using the function_tool function (note: not as a decorator). You'll need to provide a name, description, and a callable function:
def _set_profile_field_func_for(self, field: str):
async def set_value(context: RunContext, value: str):
return f"field {field} was set to {value}"
return set_value
# Create tool dynamically
tool = function_tool(
name=f"set_{field}_profile",
description=f"Set the {field} field in user profile",
func=set_value_func
)
await agent.update_tools(agent.tools + [tool])
Please feel free to reach out if you'd like me to walk you through any part of this or if you have any other questions. I'm here to help!
Sources: Tool definition and use | LiveKit docs | Agent Session Management & Turn Detection | livekit/livekit_composite | Dee... | livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | plugins/openai/src/realtime/realtime_model.tsfuture-dream-79030
11/13/2025, 8:47 PMtall-airline-16756
11/13/2025, 8:48 PMupdate_tools() method to load the tools that match the detected intent. For example:
# Python example
if user_intent == "send_email":
await agent.update_tools([send_email_tool])
1. If you want to keep the current tools while adding new ones, you can combine them like this:
await agent.update_tools(agent.tools + [new_tool])
1. And if some tools are no longer relevant, you can remove them to keep things focused:
await agent.update_tools([tool for tool in agent.tools if tool.name != "irrelevant_tool"])
Some best practices to keep in mind:
• Always double-check your tools before updating to make sure they work well with your backend.
• Try to minimize session restarts by comparing the current and new toolsets before you update.
• If your agent’s behavior needs to change with the new intent, update the instructions along with the tools.
If you’d like, I’m here to help with more details or examples on how to implement this smoothly—just let me know!
Sources: Agent Session Management & Turn Detection | livekit/livekit_composite | Dee... | README.md | Tool definition and use | LiveKit docs | plugins/openai/src/realtime/realtime_model.ts | Tool definition and use | LiveKit docs