happy-mouse-590
08/12/2025, 8:03 PMtall-airline-16756
08/12/2025, 8:03 PMtall-airline-16756
08/12/2025, 8:04 PMuseVoiceAssistant
hook from LiveKit. This handy hook gives you the agent’s current state, which could be one of these: disconnected
, connecting
, initializing
, listening
, thinking
, or speaking
.
Here’s a simple example to get you started:
import { useVoiceAssistant } from '@livekit/components-react';
function MyComponent() {
const { state } = useVoiceAssistant();
return (
<div>
<p>Agent State: {state}</p>
{state === 'thinking' && (
<p>Agent is processing your request...</p>
)}
</div>
);
}
So, by checking if state === 'thinking'
, you can easily let your users know when the agent is busy processing their request, making the experience smoother and more friendly.