How to make agent LLM stop processing once it ente...
# ask-ai
f
How to make agent LLM stop processing once it enters function tool. I want it to just say a message inside
t
Thanks for reaching out, Vivek. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you with making the agent LLM stop processing once it enters a function tool and simply display a message. Here are a couple of friendly approaches you can try: • Return No String: If your function tool doesn’t return a string (or returns
None
), the LLM won’t generate a follow-up response. For example:
Copy code
@function_tool
async def example_tool(self):
    self.session.say("Processing your request.")
    # No return value prevents further LLM response
Use `ev.cancel_tool_reply()`: When multiple tools run in parallel, you can listen for the
function_tools_executed
event and call
ev.cancel_tool_reply()
to stop any LLM-generated reply. If you’d like, I’m here to walk you through these methods or provide more details—just let me know! Sources: agent.py | tool_calling/update_tools.py | Agent speech and audio | LiveKit Docs | examples/voice_agents/session_close_callback.py