Real-Time Voice Agent: Self-Hosted Speech, Turn-Taking and Safe Tool Calls with LiveKit

Build a phone receptionist for a dental group that talks with callers in real time and runs on its own server: LiveKit carries the call, a LiveKit Agents worker listens with Silero and Whisper, decides with Qwen3 on Ollama and speaks with Kokoro, and books, moves and cancels appointments through a booking service that cannot double-book, commits only after a confirmed read-back and answers only for the verified caller. Simulated callers, latency budgets, a capacity test and privacy controls show it works.

AI Engineer. Advanced.

What you will build and explain

  • Explain each stage of a cascaded voice pipeline (transport, voice activity, endpointing, speech-to-text, LLM, text-to-speech) and measure how much of the caller's wait each one costs.
  • Run LiveKit Server and a LiveKit Agents worker with local speech, language and voice models, and call your agent from a browser over WebRTC.
  • Design LLM tools that cannot double-book, cannot commit without a confirmed read-back and cannot reach another caller's data, with holds, exclusion constraints, idempotent commits and a confirmation gate in code.
  • Tune endpointing and interruption settings for natural turn-taking, and handle barge-in, false interruptions and emergencies deterministically.
  • Test a voice agent with text-mode conversation tests and simulated callers that speak over the real media path, with noise and interruptions, and measure word error rate.
  • Measure response delay per stage and as callers hear it, find the saturating stage under load, set an admission limit, and keep personal data out of transcripts and logs.

Before you begin

  • Python with async and await, HTTP APIs, basic SQL, and what an LLM tool call is; no audio, speech or WebRTC experience is needed
  • Running commands from a terminal, Git, Docker Compose, YAML and JSON
  • A Linux (x86-64 or arm64) or macOS computer with Docker giving 8 CPUs and 12 GB of memory, 30 GB of free disk, GNU Make, curl, and a browser with a microphone (headphones recommended)

Who this is for

For AI and backend engineers who have built a text chatbot with tool calls and want a spoken one: a self-hosted phone agent on LiveKit that takes turns naturally, books appointments without double-booking or acting on a misheard yes, keeps callers' data out of its logs, and is measured for latency and capacity.

Curriculum

Learning topics (20)
  1. Check your starting skills and prepare your computer

    This project builds a phone assistant that listens, thinks and speaks in real time, entirely on your own computer. Before the first command, check two things: that you have the skills the lessons build on, and that your computer can run the lab.

  2. A phone line answered by a self-hosted voice agent

    Quillmere Dental Group's phone line is answered by a voice agent that runs entirely on the group's own server. A caller speaks; the agent answers in a natural voice, checks the calendar, reads a proposed appointment back and books it once the caller says "yes". On the lab's CPU-only server a reply takes about seven seconds, longer when it reads out appointment times; the latency and capacity lessons measure where that time goes and what would shorten it. This lesson explains

  3. How a voice agent hears, decides and speaks, and what each stage costs

    A text chatbot waits for a complete message, thinks, and answers; nobody minds a second or two. A voice agent is in a conversation, and conversations have rhythm. Studies of everyday talk in ten languages (Stivers and colleagues, 2009) found that the most common gap before a reply is around 200 milliseconds. A caller tolerates more from a machine, but a silence of several seconds feels broken, and talking over the caller feels rude. This lesson follows the stages a voice agen

  4. Sample rates, frames, codecs and noise for voice agents

    Every bug in a voice system eventually becomes a question about audio: why the recogniser hears nothing, why the reply sounds like a chipmunk, why a noisy caller is transcribed as gibberish. This lesson gives you the vocabulary and the numbers to answer those questions, using the audio this project actually moves around.

  5. Rooms, tokens, signalling and media ports with LiveKit

    A phone call needs audio to arrive within a fraction of a second, in both directions, across networks that drop packets and block ports. HTTP is the wrong tool: it waits for whole requests, retransmits everything it loses and travels over TCP. This lesson explains the protocol the browser uses instead (WebRTC), the server that carries the lab's calls (LiveKit), and the four ports that make it work on your computer.

  6. The program that takes the call: agent server, session and model clients

    LiveKit carries audio between participants; it does not listen or think. The agent is a separate Python program, built on LiveKit Agents, that joins each call as a participant, turns the caller's audio into turns of a conversation, asks a language model what to say, and speaks the reply. This lesson explains how that program is organised: who starts it, how one call becomes one job, and how the pieces from the earlier lessons are wired into a session.

  7. Voice activity, endpointing and interruptions

    People take turns in conversation remarkably fast; gaps between turns are typically a fraction of a second. A voice agent has to make the same judgement with nothing but audio: has the caller finished, or just paused to think? Decide too early and it cuts people off mid-sentence; too late and every reply feels sluggish. It must also notice when the caller starts talking over it, and tell that apart from a cough. This lesson explains the three mechanisms that make those decisi

  8. Whisper on CPU, and measuring how well it hears

    Everything the agent understands passes through one step: turning the caller's audio into text. If the recogniser hears "Fenwick Quay" as "fen wick key", the model looks up a practice that does not exist; if it hears "oh seven seven double oh" as "07 700", verification fails. This lesson explains how Whisper works, why the project runs it through faster-whisper behind a small HTTP service, which settings matter for a phone agent, and how to measure how well it hears.

  9. Natural speech, quickly, sentence by sentence with Kokoro

    The caller judges the agent by its voice before anything else: whether it sounds natural, says "10:30" as a time and not "ten colon thirty", and starts talking promptly. This lesson explains how speech synthesis works, why the project uses Kokoro, how the agent turns a streaming reply into speech sentence by sentence, and the one setting that matters for safety.

  10. A local model on Ollama that calls tools reliably

    The language model decides what the agent says and which action it takes. Here it runs on the same CPU as everything else, so every token costs time the caller waits for, and it is small, so it makes the mistakes small models make. This lesson explains how the model is served, why this model was chosen, what makes the first token slow on a CPU, and how the tools are designed so a 4-billion-parameter model uses them correctly.

  11. Instructions and replies designed for the ear

    A chatbot's reply can be a bulleted list with a table; the reader scans it and scrolls back. A caller hears each word once, in order, and cannot scroll. Most of what makes a voice agent feel competent is not the model but the shape of the conversation: what it says first, how many choices it offers, how it confirms, how it recovers when it misheard. This lesson walks through the decisions behind this agent's conversation, using the instructions and tools it actually has.

  12. A booking API a model can call without double-booking

    The agent's tools end in HTTP requests to one service: the clinic's calendar. That service is where a model's mistake would become a real double booking, a lost appointment or a stranger's data read aloud. This lesson explains how the booking service is built so that it stays correct whatever the model asks: holds that expire, a database constraint that makes double booking impossible, commits that are safe to retry, and calls that are counted against capacity.

  13. Identity, confirmation and safety enforced in code, and what is kept

    The instructions tell the model to verify callers, read changes back and never give clinical advice. Instructions are requests. A misheard word, a confused model or a caller who says "ignore your previous instructions" can get past any request. This lesson shows the controls that do not depend on the model's cooperation: identity bound to the call in the booking service, a confirmation gate in the agent, an emergency rule that runs before the model, and the privacy measures t

  14. Where the caller's wait goes, measured inside and out

    A voice agent is judged on silence. Callers forgive a wrong guess faster than a long pause, and a pause of several seconds makes them say "hello?", which starts a new turn and confuses the conversation. This lesson shows how the project measures the wait, from inside the agent and from the caller's side, how to read where it goes, and what this lab learned about the largest cost on a CPU host.

  15. Text conversations, simulated callers and what tests cannot tell you

    A voice agent fails in ways a unit test never sees: it cuts a caller off mid-number, talks over an interruption, books a slot nobody confirmed, or is fine alone and slow with four callers. And its core is a language model whose wording changes from run to run. This lesson explains how the project tests it at five levels, from pure functions to simulated callers speaking over the real media path, and what each level can and cannot prove.

  16. Deploy without dropping calls, and act on every alert

    A phone line is judged at the worst moment: the call that arrives during a restart, the morning the model server is slow, the day every line is busy. This lesson covers running the agent as a service: starting it warm, changing it without dropping calls, the signals that say something is wrong, and what to do when each alert fires.

  17. How many calls one server carries, and a polite busy message beyond it

    Every call in this lab shares the same CPU cores: speech recognition, the language model and speech synthesis all compete for them. Add calls and, at some point, every caller waits longer than the budget. This lesson shows how the project finds that point, why it refuses calls beyond it rather than serving everyone badly, and how the design would grow past one computer.

  18. Build the lab and test the voice agent

    This is the single ordered procedure for the lab: check the computer, run the local checks, start the lab, load the models, make a first call, then the conversation tests, the simulated callers, the browser test, word error rate, capacity, and a restart without dropping calls. The Step-by-Step Guide shows these sections inline. Removing everything is in Cleanup, which you can run at any point, including after a failed step.

  19. Explain and defend the voice agent under questioning

    You have built a voice agent that runs on its own hardware, books real appointments safely and measures what callers hear. Interviews for AI engineering roles test whether you can explain such a system, defend its trade-offs and debug it under questioning. This lesson explains how to use the two practice sets that come with the project.

  20. Remove the lab and check for leftovers

    Everything the lab creates lives on your computer: the Compose project's containers, its network and its volumes (the database, the downloaded models), the images it built, and the .lab/ and evidence/ folders. Nothing runs in a cloud account. You can run these steps at any point, including after a failed or interrupted step; each is safe to repeat.

Practical build steps (10)
  1. Check the computer and run the local checks

    You start with your own copy of the source and finish with the computer checked and every test that needs no running lab passed: linting, each image's unit tests, the alert rules and the booking service's rules against a real PostgreSQL.

  2. Build and start the lab, and load the models

    You start with the local checks passed and finish with all ten services running and healthy, the models downloaded and loaded, and make verify printing ok on every line.

  3. Make a first call

    You start with a verified lab and finish having talked to the agent from your browser and watched a simulated caller book an appointment, with the delay before each reply printed.

  4. Test the agent's decisions in text

    You start with a running lab and finish with the conversation tests passed: the real model, with the real booking service, choosing the right tools, and the confirmation gate holding.

  5. Run the simulated callers

    You start with the conversation tests passed and finish with every scripted call made over LiveKit: bookings, identity, safety, interruptions, the busy message, records, metrics and the delay callers heard.

  6. Call through the real page

    You start with the simulated callers passed and finish with the call page tested end to end in a real browser: the token, the published ports, the microphone, the greeting and an answer.

  7. Measure how well the agent hears

    You start with a running lab and finish with word error rate measured for the default Whisper model and a larger one, clean and in noise, with the time each takes.

  8. Find the capacity and set the admission limit

    You start with a running lab and finish with the delay measured at several numbers of simultaneous callers, the stage that saturates identified, and the admission limit set from the result.

  9. Restart without dropping calls, and watch the dashboard

    You start with a running lab and finish having restarted the agent while a call was in progress, without cutting it off, and having read the dashboard and alert rules for the calls you made.

  10. Remove the lab and check for leftovers

    You start with the lab in any state, including half-built after a failed step, and finish with its containers, network, volumes and generated secrets gone, confirmed by make leftovers. Optionally the images go too.

Access

Learning Access: INR 199 plus 18% GST. Source Pack: INR 399 plus 18% GST. 90 days of online access. No auto-renewal.

Cloud costs and boundaries

No cloud account, phone number or paid API is needed: every model runs on your own computer, and the lab publishes ports only on 127.0.0.1. The first start downloads about 10 GB of images and models. GitHub Actions is optional; it is free on public repositories and uses your account's included minutes on private ones. The clinic, its staff and its patients are invented. This is a learning project, not a certified medical or telephony service.

Licence and completion

Vectametric Project Source Licence (2026-09-27): lawfully obtained source may be copied, modified and deployed for personal learning and interview preparation, including personal portfolio demonstrations with attribution. These permissions continue after online access expires. Do not resell or redistribute the Source Pack or its original source files, unchanged or modified. Commercial or client production use requires separate written permission. Third-party components and models, such as LiveKit, LiveKit Agents, faster-whisper, Kokoro, Ollama, Qwen3, PostgreSQL, Prometheus and Grafana, retain their own licences. See LICENSE.txt and the Project Source Licence section of the site Terms for the full rules.

Questions about projects

Do I need a cloud account?

You can read the project material without deploying it. Running a cloud build requires the accounts, permissions and tools listed in that project's prerequisites. Deployment runs in your environment, not in a hosted Vectametric lab.

Can I read the code with Learning Access?

Yes. Learning Access includes the online source-file browser and explanations. The Source Pack adds the downloadable reference repository where available. The project's licence governs use of the source.

Are cloud charges included?

No. Cloud and CI usage are separate. Read the project's cost notice, set a budget and stop deadline, and follow its destruction and leftover-resource checks.

Does the project include troubleshooting and interview preparation?

The project curriculum lists the available scenarios and interview topics. These focus on understanding the architecture and explaining decisions; they are not a promise of particular interview questions or a job.

How long can I use the project?

The project page and checkout show the online access period for your selected plan. Access does not auto-renew. Downloaded source remains subject to its licence; future releases are not automatically included.

Review the Terms and No-Refund Policy before confirming access. All sales are final; Vectametric does not offer refunds.

This website is operated by VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED, operating as Vectametric.

Corporate Identity Number (CIN): U85499KA2026OPC229822. GSTIN: 29AAMCV8281D1ZS. Registered office: RS NO/38/2A/1 BASTAND, ROAD MAHANTESH NAGAR, Ramdurg, Ramdurg, Belgaum- 591123, Karnataka.

Queries and grievances: Prajval Honnungar, Grievance Officer and Data Protection Contact.

Telephone: +91 94800 09310. Support: support@vectametric.com. Grievances: support@vectametric.com.

Copyright 2026 VECTAMETRIC EDTECH (OPC) PRIVATE LIMITED. All rights reserved.

Vectametric home · Roadmaps · Vecta IT Exams · Vecta Government Exams · Vecta Banking & Finance Exams · Vecta Entrance Exams · About us · Contact · Privacy Policy · Terms and Conditions · No-Refund Policy