bulky-car-15738
12/18/2025, 10:46 AMtall-airline-16756
12/18/2025, 10:46 AMtall-airline-16756
12/18/2025, 10:46 AMfunction_tools_executed event on AgentSession. It gives function_calls and function_call_outputs, and zipped() pairs each call with its output.
• Python example:
@session.on("function_tools_executed")
def on_tool_executed(event: FunctionToolsExecutedEvent):
for call, output in event.zipped():
print(f"Tool called: {call.name}, Args: {call.arguments}")
print(f"Output: {output.output}, Error: {output.is_error}")
• Node.js example:
session.on(voice.AgentSessionEventTypes.FunctionToolsExecuted, (event) => {
for (const [call, output] of event.zipped()) {
console.log(`Tool called: ${call.name}, Args: ${JSON.stringify(call.arguments)}`);
console.log(`Output: ${output.output}, Error: ${output.isError}`);
}
});
Session traces / Observability (post-hoc, visual analysis)
• Enable Agent Observability in LiveKit Cloud to capture traces. Each tool call appears as a trace/span with timestamps, duration, and full request/response metadata, synchronized with audio/transcripts for troubleshooting.
In-tool logging (debugging, persistent logs)
• Add logging inside your tool implementations to capture input, outputs, and errors:
@function_tool()
async def lookup_weather(location: str):
<http://logger.info|logger.info>(f"Executing lookup_weather for {location}")
return {"weather": "sunny"}
External systems / audit logs
• If your tool calls external services (MCP, APIs, DBs), enable audit/logging there as well to get end-to-end visibility.
Would you like help implementing the event listener in your codebase (Python or Node), or enabling/troubleshooting Agent Observability for your project? If so, tell me which environment you’re using and any sample code or errors.
Sources: Events and error handling | LiveKit docs | https://blog.livekit.io/streamline-troubleshooting-with-agent-observability/#/portal/signup| | Tool definition and use | LiveKit docs