hello, what is the best way to play an audio file ...
# agents
f
hello, what is the best way to play an audio file like "Please wait a minute" whenever the time it take too long for the agent to answer the user question. When the LLM and TTS return the result while the audio is playing , it waits for the audio to finish (Ex: Please wait a minute , here are your ...). Do i need to customize both llm and tts to check timeout with livekit format
l
To provide user feedback, I would recommend implementing a thinking sound as described at https://docs.livekit.io/agents/build/external-data/#-thinking-sounds, otherwise you would have to handle all the timing and interrupt logic yourself to track responses. For longer running tool queries, the section above that is also relevant, to provide more custom feedback.
f
@lively-winter-88668 thank you, thinking sound might be the better solution at this time. May i ask if i still tries to handle timing and interrupt logic like you said , what would be the approach. Like wraping the agent as a whole or write the interruption logic in the LLM and TTS class itself?
l
Hmmm I'm not sure to be honest, I assume it would involve a timer, the
user_state_change
event and the
agent_state_change
but the more I think about it, the more I suspect there are many edge cases I'm not considering. I can't see any examples that show this approach
f
Yeah i think that i would need to use timer for begining of agent state thinking and speaking. So if i do this i would need to modifies the agent_activity and agent_session right? https://github.com/livekit/agents/blob/main/livekit-agents/livekit/agents/voice/agent_activity.py