Voice agent calls

Mint LiveKit room sessions, place outbound phone calls, and read live room transcripts and acoustic streams.

POST/v1/realtime/sessionsMint a LiveKit call session
POST/v1/realtime/callsDial an outbound phone call
DELETE/v1/realtime/calls/{session_id}End an active call

A voice agent call joins a caller and an agent in a LiveKit room. Callers join from a browser, mobile app, or telephone; ProsodyAI streams the room's audio through the listening model for speaker attribution, turn boundaries, and acoustics, and republishes committed events back to the room.

Starting a browser or app room

Call prosody.realtime.createSession() from your backend to open a LiveKit room and mint a short-lived participant token. Return server_url and participant_token to your frontend so the browser never handles your organization API key.

import { ProsodyClient } from '@prosodyai/sdk';

const prosody = new ProsodyClient();

const session = await prosody.realtime.createSession({
  participant_name: 'Jane Doe',
  // Optional: dispatch a specific LiveKit worker registered under this name
  agent_name: 'prosody-sales',
});

// Send session.server_url and session.participant_token to the browser

Join the room with livekit-client:

import { Room } from 'livekit-client';

const room = new Room();
await room.connect(session.server_url, session.participant_token);
await room.localParticipant.setMicrophoneEnabled(true);

Placing an outbound phone call

Dial an E.164 phone number and bridge the callee directly into a LiveKit room with your configured agent:

const call = await prosody.realtime.createCall({
  to_number: '+15551234567',
  participant_name: 'Jane Doe',
  agent: {
    account_id: 'acct_123',
    agent_id: 'sales',
  },
});

console.log('Call ringing:', call.session_id, call.room_name);

// Hang up later when needed
await prosody.realtime.endCall(call.session_id);

Reading the live transcript in the room

The room receives caller speech and agent speech on LiveKit's lk.transcription text stream topic. Each segment carries its identity, segment ID, final flag, and speaker label in the stream attributes:

  • lk.segment_id: stable key for this utterance; updates with the same ID replace the interim text.
  • lk.transcription_final: 'true' once the utterance has settled.
  • prosody.speaker_label: resolved speaker name or session label ("Speaker 1").
import { Room, type TextStreamReader } from 'livekit-client';

room.registerTextStreamHandler('lk.transcription', async (reader: TextStreamReader, participant) => {
  const text = await reader.readAll();
  const attrs = reader.info.attributes ?? {};

  console.log({
    segmentId: attrs['lk.segment_id'],
    speaker: attrs['prosody.speaker_label'] ?? participant.identity,
    final: attrs['lk.transcription_final'] === 'true',
    text,
  });
});

Acoustic and state streams in the room

While the call runs, the room also receives committed model events on session.event_topic: transcript_update, speaker_update, speaker_profiles, state_delta, turn_boundary, and barge_in. Pass any parsed payload straight into Conversation.apply() to reuse the same snapshot API as prosody.stream.session().

Using the LiveKit Agents plugin

If you run your own LiveKit Agents worker, install the Python plugin to wire ProsodyAI's realtime gateway directly into your room pipeline:

pip install livekit-plugins-prosodyai

See Building an agent to configure your agent's instructions, tools, knowledge, connectors, roles, and call stages.

On this page