I would like to handle a tool call that evaluates ...
# ask-ai
e
I would like to handle a tool call that evaluates the conversation but does not interrupt only works in the background
t
Thanks for reaching out, Brian. 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 implement a tool in LiveKit that evaluates conversations quietly in the background without causing any interruptions. Here’s a friendly guide to get you started: 1. Define the Tool: Use the
@function_tool
decorator to make your method asynchronous, which means it won’t block other processes. 2. Control Interruptions: Add
run_ctx: RunContext
in your tool’s signature. This helps manage interruptions smoothly and keeps the execution silent. 3. Silent Execution: Simply return
None
from your tool so the agent won’t respond out loud. 4. Handle Errors: Make sure to log any errors internally to keep the agent running without crashes. 5. Example: Feel free to check out the long_running_function.py and silent_function_call.py examples—they’re great resources to see this in action. If you’d like, I’m here to walk you through the setup or answer any questions you might have! Sources: livekit-agents/livekit/agents/voice/run_result.py | Tool definition and use | LiveKit docs | agents/src/voice/generation.ts