Builds voice and chat AI agents with LiveKit Agents and LiveKit Cloud. Use when the user asks to "build a voice agent", "create a LiveKit agent", "add voice AI to my app", "implement handoffs", "structure an agent workflow", "my agent is slow / too chatty", "it says it booked but nothing was saved", "make it confirm before committing", "it keeps re-asking things the caller already said", or is writing code against the LiveKit Agents SDK. Covers architecture: designing for latency, keeping context small, splitting a monolithic agent into handoffs and tasks, and designing for voice. Also covers keeping the model in charge of meaning while code owns state, approvals, and effects. For API specifics use reading-livekit-docs. To check behavior use debugging-livekit-agents and testing-livekit-agents.
76
96%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
This skill covers how to structure a voice agent. It has no API specifics, because those change;
get them from reading-livekit-docs.
It assumes LiveKit Cloud, the recommended path: managed infrastructure, plus LiveKit Inference for models so you don't manage per-provider API keys.
Where the agent runs and which LiveKit the project uses are separate questions. An agent the user self-hosts (on their own servers instead of LiveKit Cloud's agent hosting) still connects to LiveKit Cloud and can still use LiveKit Inference. Inference is a LiveKit Cloud feature, so it's only off the table when the project runs on LiveKit OSS. The architecture advice applies either way; on LiveKit OSS, models come from each provider's own plugin and API keys.
reading-livekit-docs and look up the APIs you're about to use. Don't write LiveKit
code from memory.LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET, usually in .env. The CLI can set these
up.debugging-livekit-agents (drive a
real conversation), testing-livekit-agents (assert on turns), or both, because it affects how
you factor the code.A voice agent is more than a chat agent with a speaker attached. These constraints drive most design decisions:
Latency. Users expect a reply within a few hundred milliseconds. Context size, tool count, whether a tool call sits on the critical path, and whether responses stream all add to or save from that budget. Plan for network stalls and provider timeouts too; they happen routinely.
Context size. A 10,000-token system prompt with 50 tool definitions feels sluggish on any model, because the model re-reads all of it every turn. Give each phase only the tools it can reach and the instructions it needs.
Listening. Users can't skim or scroll back, and they'll talk over the agent. Long replies are a bug, silence sounds broken, and interruptions are normal.
The usual failure is one agent that does everything. It collects every tool, instruction, and piece of state until it's slow and unreliable, and by that point splitting it is a rewrite.
Handoffs transfer control from one agent to another. Put them at natural conversation boundaries, like greeting → intake → resolution, or general support → billing specialist. Each agent then carries only its own tools and instructions. Choose a boundary where the context can be summarized for the next agent. If the next agent needs everything the previous one had, the boundary is in the wrong place.
Tasks are tightly scoped prompts aimed at one outcome. Use them for discrete operations that don't need a full agent, or where a focused prompt works better than a general one.
If you can't say in one sentence what an agent is responsible for, split it.
The model reads the conversation and proposes actions. Application code owns the records, the permission checks, the state transitions, and every external effect. Most agents that "work in the demo and fail in production" have that line blurred somewhere.
The costliest agent bugs are mutations that did more or less than the caller meant: "no note for him" clearing the whole list, a correction that also reset a confirmed field, a re-stated value that invalidated an approval. Before writing a mutating tool, state its target, what changes, and what must stay the same — then pair it with the nearest request that must do something different.
The rules in short: omission preserves; missing, empty, unknown, and cleared are four different
things; collections get application-issued ids; validate before applying; a scoped negative never
clears a collection; unchanged values are no-ops. When a task requires review before an effect,
approval is a later real user message for that version, delivery is tracked at the speech
boundary, and success is published only after the write commits. The full treatment — including
closing, output ownership, and how text and audio input take different hook paths — is in
references/state-and-effects.md. Read it before building anything that books, edits, confirms, or
ends calls.
Before expanding the tool surface or polishing the persona, pick one ordinary user goal and drive it through the real agent to its required effect — the booking exists, the record changed, the call ended. Write the expected result from the user's request, not from the application's own export. Then pair it with the first guard that must refuse, because a test that rejects everything proves nothing about the guard. Keep that pair green while you add everything else.
Prompt changes break agent behavior as easily as code changes do, and trying it once by hand doesn't count as verification.
debugging-livekit-agents. It runs your agent
locally in text mode, lets you send turns, and shows the tool calls behind each reply.testing-livekit-agents. At minimum, cover the core
behavior the user asked for, tool invocation with correct arguments if there are tools, and one
failure path.writing-livekit-scenarios
and running-livekit-simulations.If the user asks for no tests, build without them, mention once that you'd recommend them before production, and move on.
reading-livekit-docs.reading-livekit-docsdebugging-livekit-agentstesting-livekit-agentswriting-livekit-scenarios, running-livekit-simulationsreferences/state-and-effects.mdoperating-livekit-agents5d7488b
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.