when using a function tool, is the agent required ...
# ask-ai
i
when using a function tool, is the agent required to respond? im trying to figure out a way to get the agent to use a tool silently
t
Thanks for reaching out, Ed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Agents can use function tools quietly without needing to respond to the customer. This works by making sure the tool call doesn’t send back any obvious response that would prompt a reply. If you have a particular situation in mind, just let me know—I’d be happy to help with more specific advice! Sources: Tool definition and use | LiveKit Docs | livekit-agents/livekit/agents/voice/generation.py
i
Do you have to instruct the agent in a specific way, or do something else, to get it to use a function tool silently?
t
Just a quick tip: if you want an agent to use a function tool without sending a reply, the tool should return
None
. This way, the system stays quiet. Here’s a simple example:
Copy code
@function_tool()
async def turn_on_light(self):
    self.light_on = True
    # No return value = silent execution
Another way is to raise a
StopResponse
exception inside the tool to stop any reply from being sent. If you'd like, I’m happy to walk you through more examples or explain anything in detail—just let me know! Sources: Tool definition and use | LiveKit Docs | examples/voice_agents/annotated_tool_args.py