numerous-receptionist-14192
11/28/2025, 10:24 AMtall-airline-16756
11/28/2025, 10:24 AMtall-airline-16756
11/28/2025, 10:24 AMagent_suggestions.
◦ Send to the specialist’s SID only (destination_sids) or broadcast and filter on the client.
• Specialist frontend listens for dataReceived events and displays suggestions in the UI.
Minimal code examples
Listener: connect subscribe-only (pseudo-code)
// connect without publishing
await room.connect(wsUrl, token, { publishOnly: false });
room.localParticipant.unpublishAll(); // ensure no audio published
// auto-subscribe to audio tracks (client + specialist)
Listen for audio → STT → final transcript handling (pseudo)
on_audio_chunk(track_audio):
vad_result = vad.detect(track_audio)
if vad_result.speech:
stt_stream.send(track_audio)
on_stt_final(transcript, speaker_id):
if speaker_id == client_id:
suggestion = generate_suggestion(transcript, context)
send_suggestion_to_specialist(suggestion, specialist_sid)
Send suggestion via data message (pseudo)
// on the listener/server-side
room.localParticipant.publishData(
new TextEncoder().encode(suggestionText),
{ topic: 'agent_suggestions', destinationSids: [specialistSid] }
);
// on specialist frontend
room.on('dataReceived', (data, participant, topic) => {
if (topic === 'agent_suggestions') {
const suggestion = new TextDecoder().decode(data);
showSuggestionInUI(suggestion);
}
});
Design considerations and tips
• Use speaker IDs and turn-detection so suggestions are only made for the client’s speech.
• Prefer final transcripts (or high-confidence partials) to avoid premature suggestions.
• Add context (customer profile, previous messages) to LLM prompts for better replies.
• Keep suggestions short and mark them as “suggested” — let the human edit/approve.
• Log conversation items for compliance and later fine-tuning of prompts.
• Apply access controls: send data messages only to the specialist, and avoid broadcasting sensitive suggestions to others.
If you’d like, I can:
• provide a specific prompt template for the LLM,
• show a fuller example using a particular STT provider (Deepgram/AssemblyAI),
• or give a sample frontend snippet tailored to Web SDK event handling.
Which of those would you like next?
Sources: Events and error handling | LiveKit docs | Agent session | LiveKit docs | Agents v0.x migration guide - Python | LiveKit docs | Web and mobile frontends | LiveKit docs | Turn detection and interruptions | LiveKit Docs