LiveKit: Realtime infrastructure for voice, video, and AI agents
LiveKit is an open source platform for building voice, video, and physical AI agents.
This repository is the LiveKit server: a scalable, distributed WebRTC SFU that moves realtime audio, video, and
data between people, devices, and AI models. The SDKs, agents frameworks, and companion services are linked in
the table at the bottom of this page.
LiveKit's server is written in Go, using the awesome Pion WebRTC implementation.
[!IMPORTANT]
If you're building Voice AI, LiveKit Agents is the SDK for code-first realtime voice agents. STT, LLM, TTS, turn detection, expressive speech, keyterm accuracy, tool usage, and telephony all come bundled in the framework. It's available in both Python and Node.js.
# agent.py
from livekit import agents
from livekit.agents import Agent, AgentServer, AgentSession, STTContextOptions, TurnHandlingOptions, inference
server = AgentServer()
@server.rtc_session(agent_name="my-agent")
async def my_agent(ctx: agents.JobContext):
session = AgentSession(
stt=inference.STT(model="deepgram/nova-3", language="multi"),
llm=inference.LLM(model="google/gemma-4-31b-it"),
tts=inference.TTS(model="inworld/inworld-tts-2", voice="Ashley"),
turn_handling=TurnHandlingOptions(turn_detection=inference.TurnDetector()),
stt_context_options=STTContextOptions(keyterms=["LiveKit", "Acme Corp"]),
expressive=True,
)
await session.start(room=ctx.room, agent=Agent(instructions="You are a helpful voice AI assistant."))
await session.generate_reply(instructions="Greet the user and offer your assistance.")
if __name__ == "__main__":
agents.cli.run_app(server)
LiveKit carries billions of calls a year for companies including Salesforce, Nvidia, Oracle, SAP,
Deutsche Telekom, Spotify, Tinder, Coursera, Headspace, Skydio, Retell, Decagon, Cresta, and HeyGen. Read how
Assort Health, Playback, and
Polymath Robotics use it, or see more customers.
[!TIP]
We recommend installing LiveKit CLI along with the server. It lets you access
server APIs, create tokens, generate test traffic, and scaffold and deploy agents.
The following will install LiveKit's media server:
Start LiveKit in development mode by running livekit-server --dev. It'll use a placeholder API key/secret pair.
API Key: devkey
API Secret: secret
To customize your setup for production, refer to our deployment docs
Creating access token
A user connecting to a LiveKit room requires an access token. Access
tokens (JWT) encode the user's identity and the room permissions they've been granted. You can generate a token with our
CLI:
This command publishes a looped demo video to a room. Due to how the video clip was encoded (keyframes every 3s),
there's a slight delay before the browser has sufficient data to begin rendering frames. This is an artifact of the
simulation.
Adding an agent
Agents join rooms as participants, the same way a browser or a phone does. Follow the
Voice AI quickstart to build one. An agent connects to a self-hosted
server the same way it connects to LiveKit Cloud; when running without Cloud, use
model plugins in place of LiveKit Inference.
Deployment
Use LiveKit Cloud
LiveKit Cloud is the fastest and most reliable way to run LiveKit. It runs in 19+ regions with 99.99% uptime and adds
agent hosting, model inference, telephony, and observability on top of the server. The Build plan is free, with no
credit card required.