how do agent keep track of what participant says
# ask-ai
a
how do agent keep track of what participant says
t
Thanks for reaching out, Harshita. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Agents can keep track of what participants say in LiveKit through several mechanisms: • Real-time Transcription: Agents can access real-time transcriptions via the
llm_node
or
transcription_node
. • Session History: The entire conversation history is accessible through the
session.history
property. • Event Listeners: Events like
conversation_item_added
(when an item is added to chat history) and
user_input_transcribed
(when user input is transcribed) help track conversations. • Transcription Outputs: Transcription outputs such as
_ParticipantLegacyTranscriptionOutput
and
_ParticipantTranscriptionOutput
handle participant speech transcription. • Multi-User Transcription: Agents can create sessions for each participant and transcribe their audio individually, identifying who said what. Let me know if you need further details or assistance! Sources: Session recording and transcripts | LiveKit Docs
a
a way to allow the agent to capture input from both participants during a call — the person initiating the transfer and the person receiving it? Context: After connecting both parties, I’m currently muting the agent. However, this leads to an issue where the call is considered “picked up” even if the transferee’s call goes to voicemail. I’m looking for a way to detect voicemail on the transferee’s side so that the call can be properly handled or ended in such cases.
t
Hey there! 👋 Dealing with voicemail during call transfers can be tricky, but I've got some friendly tips to help you out. • Voicemail Detection Function: You can create a super helpful function called
detected_answering_machine
in your agent class. Think of it like a smart assistant that knows exactly what to do when voicemail picks up. Here's a cool example:
Copy code
@function_tool
async def detected_answering_machine(self):
    """Call this tool if you have detected a voicemail system, AFTER hearing the voicemail greeting"""
    await self.session.generate_reply(
        instructions="Leave a voicemail message letting the user know you'll call back later."
    )
    await asyncio.sleep(0.5) # Add a natural gap to the end of the voicemail message
    await hangup_call()
Alternative Implementation: If you prefer a different approach, you can use the
@llm.ai_callable()
method:
Copy code
@llm.ai_callable()
async def detected_answering_machine(self):
    """Called when the call reaches voicemail. Use this tool AFTER you hear the voicemail greeting"""
    <http://logger.info|logger.info>(f"detected answering machine for {self.participant.identity}")
    await self.hangup()
These functions are like your personal call management buddies – they'll help your agent smoothly handle voicemail situations. Need more help? I'm always here to chat and guide you through! 😊 Sources: Agents telephony integration | LiveKit Docs | Making calls using SIP | LiveKit Docs
a
how will this detect the voicemail from the user to whom the call is transfered to if agent is not taking any input from that user
t
Hey there! 👋 I'd love to help you get clarity on how call transfers are currently working. I have a few friendly questions to better understand the situation: • Do you have a specific telephony integration or API you're using for call transfers right now? • Have you set up any way to keep an eye on what's happening with the audio or events on the transferee's side? • Would it be possible to briefly unmute the agent or maybe use a separate process to listen in on the transferee's audio? Sharing these details will really help me suggest the best solution for detecting voicemail in this scenario. I'm all ears and here to help! 😊