m
hi
t
Thanks for reaching out, aigentzi. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi — how can I help you today? What are you trying to do with LiveKit (e.g., start a room, connect a client, fix an error, billing question)? If you have an error message, room ID, SDK/SDK version, or relevant code snippet, please share it and I’ll help.
m
please help share this code : I’m building an end-to-end voice English-teacher prototype using LiveKit Cloud + LiveKit Inference for all STT/LLM/TTS. Tech + infra • Frontend: plain HTML + JS (no framework) • Backend: FastAPI (Python 3.11) • Agent: name cloud-english-teacher, ID CA_e7hLTus66nKZ • LiveKit: Cloud for everything, all STT/LLM/TTS via Inference, creds via env vars, URL
wss://turbo-ms4yz8cm.livekit.cloud
• Rooms: new room per lesson • Docker: simple Dockerfile + docker-compose, runs on Windows Docker Desktop • CLIs: LiveKit CLI, Vercel CLI, GitHub CLI Personas (scenarios) • English Teacher (General, “Alex” – friendly teacher, adjusts level, natural chat + short feedback) • Taxi Driver • Hotel Receptionist • Waiter • Check-in Agent • Border Officer • Nurse • Ticket Clerk • Information Agent • Museum Front Desk • Bartender (Three personas will be hard-coded to different TTS models via LiveKit Inference; you choose mapping + exact voices.) Runtime models (current notebook hints) • STT:
deepgram/nova-3
• LLM:
openai/gpt-4.1-mini
• TTS:
cartesia/sonic-2
(variants optional) HTML test page UX (AI English Teacher) • Left column: ◦ Voice Provider dropdown (e.g., “LiveKit Inference (All services via LiveKit)”) ◦ Voice dropdown (e.g., “Default (Cartesia Sonic-2)”) ◦ Scenario dropdown (all personas above) • Right column: ◦ Connection Check: “Play test chime”, “Advanced Debug”, live event log ◦ Transcript Monitor: live conversation transcripts, who’s speaking • Top links: “View agent prompts & scenario details”, “Hard refresh app” What I want from you • FastAPI backend with: ◦
POST /create-room
◦
POST /start-lesson
(creates AgentSession, connects agent to room) ◦
GET /health
• Agent worker that loads persona config, uses LiveKit Inference for STT/LLM/TTS. • HTML/JS frontend to: ◦ Select persona ◦ Create room ◦ Start lesson ◦ Connect via WebRTC ◦ Show transcripts + play agent audio • Dockerfile + docker-compose for local dev • agent name and ID : cloud-english-teacher CA_e7hLTus66nKZ
t
Thanks — this is a great, detailed brief. I can generate the full example code (FastAPI backend, agent worker, HTML/JS frontend, and Docker + docker-compose) that matches your setup. Before I produce the code, a couple quick clarifying questions so I generate exactly what you need: 1. Do you want the agent (cloud-english-teacher, ID
CA_e7hLTus66nKZ
) to join rooms as a WebRTC participant using a server-side SDK connection, or should the agent connect via a headless browser / WebRTC client from the worker? (Two different connection patterns — which do you prefer?) 2. For persona-to-TTS mapping, confirm which three personas you want hard-coded to specific voices and whether you want exact voice names or just model variants (e.g.,
cartesia/sonic-2
default; variants like
sonic-2/bright
): which three personas? 3. Do you already have LiveKit API key/secret and inference API enabled in your LiveKit Cloud account, and do you want the sample to read those from ENV names
LIVEKIT_API_KEY
,
LIVEKIT_API_SECRET
, and
LIVEKIT_URL
? (I’ll use the URL you provided unless you prefer a different env var.) 4. STT/LLM/TTS models — confirm these exact identifiers are final: STT
deepgram/nova-3
, LLM
openai/gpt-4.1-mini
, TTS
cartesia/sonic-2
. Any desired TTS variant names? 5. For auth in the frontend: do you want the backend to mint short-lived LiveKit tokens for clients and the agent (recommended)? I can include token creation endpoints in
/create-room
. Reply with your answers to these five points (short replies are fine) and I’ll produce the complete code and Docker files tailored to your choices.
m
• Connect the agent via the LiveKit server-side SDK (i.e., a worker session/AgentSession), not a headless browser. We want the cloud-english-teacher worker to join as a native server-side participant. • Hard-code persona→voice mappings for these three personas (using explicit voice names, not just variants): 1. english_teacher_general → cartesia/sonic-2:alloy 2. taxi_driver → cartesia/sonic-2:bright 3. hotel_receptionist → cartesia/sonic-2:warm (Feel free to adjust suffix syntax as needed for Cartesia; the main goal is each persona gets a fixed named voice.) • Yes, we already have LiveKit API key/secret and inference API enabled. Please read them from LIVEKIT_API_KEY, LIVEKIT_API_SECRET, and LIVEKIT_URL. • Model lineup is final for now: STT deepgram/nova-3, LLM openai/gpt-4.1-mini, TTS base cartesia/sonic-2 with the persona-specific variants above. • For the frontend, we do want the backend to mint short-lived LiveKit tokens (for both client and agent dispatch). Including a /create-room (or /api/token) endpoint that issues those tokens is perfect
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!