How can I debug and log events of data exchange be...
# ask-ai
f
How can I debug and log events of data exchange between the STT, LLM, TTS, VAD, turn_detector during the AgentSession?
t
Thanks for reaching out, Taras. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! If you want to debug and keep track of the data exchange between STT, LLM, TTS, VAD, and turn_detector during an AgentSession, here are some friendly tips you can try out: • Event Listeners: Set up event listeners to catch changes in user and agent states, transcription updates, and how the conversation flows. For instance, you can listen for events like
user_state_changed
,
agent_state_changed
, and
user_input_transcribed
. • Metrics Collection: Gather detailed metrics for each part, like how long STT takes, LLM response times, TTS audio lengths, and VAD inference durations. • VAD Event Monitoring: Tune into VAD-specific events to help debug voice activity detection, including idle times and inference durations. • Turn Detection Debugging: Try adding a custom wrapper that shows internal probabilities for predicting when a turn ends. • Audio Playback Monitoring: Keep an eye on audio playback events for TTS, such as where playback is at and if anything interrupts it. • Function Tool Execution: Watch LLM function tool calls to see how execution details unfold. • Usage Tracking: Use the built-in usage collector to log and summarize your session’s metrics easily. If you’d like, I can share some detailed code examples for any of these methods—just let me know! Sources: livekit-agents/livekit/agents/voice/agent_session.py | metrics/metrics_vad.py