great-oil-61627
10/09/2025, 10:36 PMtall-airline-16756
10/09/2025, 10:36 PMtall-airline-16756
10/09/2025, 10:38 PMgreat-oil-61627
10/09/2025, 10:38 PMtall-airline-16756
10/09/2025, 10:40 PMsession.interrupt() method. Here's a simple example:
// Node.js Agent
ctx.room.localParticipant?.registerRpcMethod('interrupt_agent', async () => {
await session.interrupt(); // Cancel current speech
return 'interrupted';
});
2. Frontend Implementation: On your React app side, you can use the LocalParticipant.rpc() method to call this RPC. Here's how you might set that up:
import { useLocalParticipant } from '@livekit/react-components';
function InterruptButton() {
const { localParticipant } = useLocalParticipant();
const handleInterrupt = async () => {
try {
await localParticipant.rpc('interrupt_agent');
console.log('Agent interrupted');
} catch (err) {
console.error('Failed to interrupt agent:', err);
}
};
return ;
}
This method lets you smoothly interrupt the agent's speech or processing directly from the client side by signaling your backend. If you have any questions or need a hand with this setup, please don’t hesitate to ask—I’m here to help!
Sources: livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | Agent Session & Activity Management | livekit/livekit_composite | DeepWiki | Turn detection and interruptions | LiveKit Docs | docs/index.yaml | agents/src/voice/agent_activity.tsgreat-oil-61627
10/09/2025, 10:40 PMtall-airline-16756
10/09/2025, 10:40 PM