brief-dress-9950
05/20/2026, 8:53 AMtall-airline-16756
05/20/2026, 8:53 AMtall-airline-16756
05/20/2026, 8:53 AMsession.say() calls inside function tools can trigger the e2e_latency metric the same way normal assistant turns do.
Short answer: e2e_latency is recorded on assistant ChatMessage items (per-turn metrics). session.say() does create speech and emits speech events (it returns a SpeechHandle and fires speech_created), but it does not automatically attach the same e2e_latency metric that appears on assistant turns. In other words, e2e_latency is not recorded for session.say() in the same way as a normal assistant turn.
If you want latency for speech generated inside a function/tool, you can:
• Measure timings around the function call yourself (record start time before invoking the tool and end time when the SpeechHandle reports audio ready or on the speech_created event).
• Use the SpeechHandle lifecycle events to capture TTS timing (time to first byte / ready) and combine with your own measure of upstream LLM time if needed.
Would you like a short code example for measuring those timings with SpeechHandle or guidance on where to hook the speech_created event?
Sources: Understand and Improve Agent Latency | LiveKit | Agent speech and audio | LiveKit Documentation | Build Your First AI Voice Agent in Python: Complete Tutorial | LiveKit | Audio customization | LiveKit Documentation | The ReAct Pattern for Voice Agents and How AI Agents Think, Act, and Respon..., with interactive elements