is there an event emitted when a function tool sta...
# ask-ai
s
is there an event emitted when a function tool starts? Or when the LLM outputs that a tool needs to be called?
t
Thanks for reaching out, manik. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for reaching out! I wanted to share that LiveKit doesn’t emit a specific external event exactly when a function tool starts execution. But don’t worry—there are two important moments where you can keep track of tool-related actions: • When the LLM decides to call a tool: This is captured internally as a
FunctionCallEvent
within the
RunResult
system. You can also catch this through the
conversation_item_added
event, which logs the function call as it’s added to the chat history. • When the tool finishes execution: After all requested tools have run, the
function_tools_executed
event is emitted. This event gives you details about the function calls and their results. If you’d like, I’m here to help clarify anything or assist you with implementing these events—just let me know! Sources: Events and error handling | LiveKit Docs | tests/test_evals.py | Events and error handling | LiveKit Docs
s
ConversationItemAddedEvent doesn't have FunctionCall only FunctionToolsExecutedEvent. I am looking for event when the output of the LLM is that the tool should be executed
t
Thanks for reaching out! I wanted to share that LiveKit doesn’t have a specific event that fires exactly when the LLM decides to execute a tool. The closest event we have is
function_tools_executed
, which happens right after the tools finish their work. This event gives you details about the function calls and their results. If you’re hoping to catch the exact moment the LLM chooses to call a tool, that’s actually recorded internally as a
FunctionCallEvent
within the
RunResult
system. However, it’s not available as an external event you can subscribe to just yet. Please feel free to ask if you’d like me to clarify anything or if you have more questions—I’m here to help! Sources: Events and error handling | LiveKit Docs | livekit-plugins/livekit-plugins-aws/livekit/plugins/aws/experimental/realti... | Events and error handling | LiveKit Docs