Start a browser-audio session to talk to an agent in real time (for testing and demos).
Mic sessions let you talk to an agent directly from a web browser using
your microphone — no phone number required. ThunderPhone creates a
LiveKit room and returns a join token; your front-end uses the
LiveKit Web SDK to publish audio. This endpoint is typically used for
agent iteration and demos.
Use the LiveKit Web SDK to join the room with the returned token. The
agent joins the room from Core’s side and you publish your microphone
as the local participant.
import { Room, RoomEvent } from "livekit-client";const room = new Room();await room.connect(session.server_url, session.token);await room.localParticipant.setMicrophoneEnabled(true);room.on(RoomEvent.TrackSubscribed, (track) => { if (track.kind === "audio") track.attach(document.body);});