How do I dynamically enable and disable functions ...
# ask-ai
f
How do I dynamically enable and disable functions available to the agent's LLM ?
t
Thanks for reaching out, Doug. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to dynamically enable or disable functions available to the agent's LLM, here are some handy ways to do that: • Update Tools Dynamically: You can use
update_tools()
to add or remove tools for the agent permanently. For instance, you might want to filter out certain tools or add new ones on the fly. • Per-Call Adjustments: By overriding the
llm_node()
method, you can tweak the toolset just for specific interactions. This is great when you need context-sensitive tools. • Control Function Behavior: The
tool_choice
parameter in
ModelSettings
lets you disable all function calls, require particular functions, or just let the LLM decide what to do. • Suppress Automatic Replies: If you want to keep things quiet after a tool runs, use the
function_tools_executed
event to cancel automatic responses. If you'd like, I can share some detailed examples or help you out with any of these methods—just let me know! Sources: livekit-agents/livekit/agents/voice/agent_activity.py