early-restaurant-74591
09/25/2025, 12:14 AMtall-airline-16756
09/25/2025, 12:14 AMtall-airline-16756
09/25/2025, 12:15 AMearly-restaurant-74591
09/25/2025, 12:15 AMtall-airline-16756
09/25/2025, 12:16 AMroom.localParticipant.rpc.on('received', async (request) => {
if (request.method === 'client.eou_update') {
const payload = JSON.parse(request.payload);
const eouPercentage = payload.percentage;
// Update UI dynamically
document.getElementById('status-circle').textContent = `${eouPercentage.toFixed(1)}%`;
updateCircleState(eouPercentage); // Custom function to handle animations
}
});
1. UI Updates: Using the EOU percentage you receive, you can update the circle's text and animations dynamically. Here's a helpful example:
function updateCircleState(eouPercentage) {
const circle = document.getElementById('status-circle');
if (eouPercentage > 80) {
circle.textContent = 'Thinking';
circle.classList.add('pulse');
} else {
circle.textContent = 'Listening';
circle.classList.remove('pulse');
}
}
This method will help your frontend reflect the conversation state in real-time smoothly. If you have any questions or would like me to walk you through any part in more detail, please don’t hesitate to ask. I’m here to help!
Sources: Building the all-in-one platform for voice AI agents | Building the all-in-one platform for voice AI agents | livekit-plugins/livekit-plugins-turn-detector/README.md | Turn detection and interruptions | LiveKit Docs | complex-agents/turn-taking/agent.pyearly-restaurant-74591
09/25/2025, 5:54 AMtall-airline-16756
09/25/2025, 5:54 AMearly-restaurant-74591
09/25/2025, 5:59 AMtall-airline-16756
09/25/2025, 6:00 AMon_start_of_speech and on_end_of_speech internally for agent decisions, these aren’t automatically sent to the frontend unless you forward them explicitly through RPC or data channels.
If you’d like, I’m here to help guide you through setting up this custom EOU percentage system, just like in the LiveKit examples. Feel free to ask anytime!
Sources: Improving voice AI's turn detection with transformers | livekit-agents/livekit/agents/voice/agent_activity.py | complex-agents/turn-taking/agent.pyearly-restaurant-74591
09/25/2025, 7:00 AMpython
async def send_eou_update(eou_percentage):
try:
payload = json.dumps({"type": "eou_update", "percentage": eou_percentage})
await ctx.room.local_participant.rpc("client.eou_update", payload)
print(f":bar_chart: Sent EOU update: {eou_percentage:.1f}%", flush=True)
except Exception as e:
print(f":x: Failed to send EOU RPC: {e}", flush=True)
Frontend Side (JavaScript):
javascript
function setupRPCHandler() {
if (livekitInterviewer && livekitInterviewer.room) {
livekitInterviewer.room.localParticipant.rpc.on('received', async (request) => {
if (request.method === 'client.eou_update') {
const payload = JSON.parse(request.payload);
const eouPercentage = payload.percentage;
updateButtonFromEOU(eouPercentage);
}
});
}
}
Error I'm getting:
:x: Failed to send EOU RPC: 'LocalParticipant' object has no attribute 'rpc'
Questions:
1. What's the correct way to send RPC messages from the agent to the frontend?
2. What's the correct way to set up the RPC handler on the frontend?
3. Are there any specific LiveKit SDK versions or configurations needed for RPC to work?
My setup:
- LiveKit Agent SDK (Python)
- LiveKit Client SDK (JavaScript)
- Local development environment
Thanks for your help!tall-airline-16756
09/25/2025, 7:00 AM