From f2d121353a989cd0c54fe775b5fb4333dece6e92 Mon Sep 17 00:00:00 2001 From: Jason Lernerman Date: Fri, 12 Jun 2026 11:33:49 -0400 Subject: [PATCH] Replace deprecated session options with turnHandling Migrate `turnDetection` and `voiceOptions.preemptiveGeneration` to the new `turnHandling` options object on AgentSession. --- src/main.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/main.ts b/src/main.ts index a6df755..a5dcbcd 100644 --- a/src/main.ts +++ b/src/main.ts @@ -36,14 +36,16 @@ export default defineAgent({ voice: '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc', }), - // VAD and turn detection are used to determine when the user is speaking and when the agent should respond - // See more at https://docs.livekit.io/agents/build/turns - turnDetection: new livekit.turnDetector.MultilingualModel(), - vad: ctx.proc.userData.vad, - voiceOptions: { + turnHandling: { + // VAD and turn detection are used to determine when the user is speaking and when the agent should respond + // See more at https://docs.livekit.io/agents/build/turns + turnDetection: new livekit.turnDetector.MultilingualModel(), // Allow the LLM to generate a response while waiting for the end of turn - preemptiveGeneration: true, + preemptiveGeneration: { + enabled: true, + }, }, + vad: ctx.proc.userData.vad, }); // Start the session, which initializes the voice pipeline and warms up the models