The PyAI plugin is maintained by PyAI and currently supports LiveKit’s Python
Agents SDK. LiveKit also supports Node.js, but the package in this guide does
not.
What stays under your control
LiveKit keeps the room, media transport, worker lifecycle, VAD, LLM, tools, and application logic. PyAI handles streaming transcription and speech synthesis. Your existing LiveKit deployment model does not change.Prerequisites
- Python 3.10 or newer
- A LiveKit Agents worker
- A PyAI key with
hear:stream,hear:transcribe, andspeak:synthesizescopes - A voice id from
GET https://api.pyai.com/v1/voices
Install
Install the verified public release from PyPI:Replace the speech components
Keep the LLM and tools your worker already uses. Change only thestt and
tts values in AgentSession:
pyai.STT, receives
interim and final transcripts, runs your LLM and tools, then streams the
generated text through pyai.TTS back into the room.
Worker function
Drop this function into the worker that already creates your LLM and VAD:run_agent(ctx, llm, vad) from your existing entrypoint. Keep the same
WorkerOptions and process command you already use.
Configuration
Hear speech-to-text
recognize() fallback uses the synchronous transcription endpoint.
Speak text-to-speech
Run and verify
1
Start the worker
Run the same LiveKit worker command you use today.
2
Join a room
Connect a browser, phone, or synthetic participant and speak one short
sentence.
3
Check both speech directions
Confirm a final caller transcript reaches the worker and agent audio reaches
the room. Then send a second turn on the same session to verify that
finalization and interruption handling keep working.
4
Measure your complete path
Record transport region, worker region, LLM, VAD settings, voice, and PyAI
region with any latency result. The framework path is the sum of every
component.
Production notes
- Keep the LiveKit worker and PyAI speech endpoints in nearby regions.
- A live Hear socket counts against the PyAI key’s realtime concurrency.
- Hear and Speak meter against your PyAI account. LiveKit Cloud, telephony, your LLM, and worker hosting remain separate.
- Do not expose a long-lived PyAI key to a browser or room participant.
- Use Omni instead when you want PyAI to own turn-taking, reasoning, tools, caller continuity when an Agent profile has continuity enabled and a caller key is available, and optional managed telephony as one system.
Troubleshooting
Which path should I choose?
Choose LiveKit + PyAI for WebRTC rooms, video or multi-participant media, component swapping, and worker-level control. Choose Omni for a phone-first agent where one managed realtime contract is more valuable than owning each stage.LiveKit Agents documentation
Review LiveKit’s worker, room, telephony, and deployment model.
PyAI Omni overview
Compare the managed speech-to-speech path.