cool-salesmen-60705
08/10/2025, 9:04 PMtall-airline-16756
08/10/2025, 9:04 PMtall-airline-16756
08/10/2025, 9:04 PMcool-salesmen-60705
08/10/2025, 9:05 PMtall-airline-16756
08/10/2025, 9:05 PMroom.connectionState
property to see if your agent is Connected, Connecting, or Disconnected. It’s a great way to stay in the loop!
• Track Agent Presence and State: Watch for ParticipantConnected
events to know when an agent joins the room. You can also peek at participant attributes like initializing, listening, thinking, or speaking to get a feel for what they’re up to.
• Use Built-in Components: Try using hooks like useVoiceAssistant
to easily access the agent’s current state and tracks — it makes things super convenient!
• Implement UI Indicators: Adding some visual cues for connection states or notifications when things change can really help keep everyone informed.
Here’s a simple example to show you how you might monitor and display the agent’s connection state:
import { useVoiceAssistant } from "@livekit/components-react";
import { useState, useEffect } from "react";
function AgentStatusMonitor() {
const { state } = useVoiceAssistant();
const [connectionState, setConnectionState] = useState(ConnectionState.Disconnected);
useEffect(() => {
const handleConnectionStateChanged = (newState) => {
setConnectionState(newState);
};
room.on("connectionStateChanged", handleConnectionStateChanged);
return () => {
room.off("connectionStateChanged", handleConnectionStateChanged);
};
}, []);
return (
Agent State: {state || "Not connected"}
);
}
export default AgentStatusMonitor;
If you have any questions or want a hand with specific details, just let me know — I’m here to help!
Sources: Web and mobile frontends | LiveKit Docs | AI voice agents | LiveKit Docs | packages/react/src/hooks/useVoiceAssistant.ts | README.mdcool-salesmen-60705
08/10/2025, 9:07 PMtall-airline-16756
08/10/2025, 9:08 PMtall-airline-16756
08/11/2025, 2:58 PMsee tracing information at <http://localhost:8081/debug>
Prometheus support can be enabled by adding prometheus_port
to your worker_options
.
If that's not what you were talking about, let me know.cool-salesmen-60705
08/12/2025, 8:12 AM