whats the difference between livekit.agents (using...
# ask-ai
p
whats the difference between livekit.agents (using agent session start etc) and livekit.agents.pipeline (using voice pipeline agent)
t
Thanks for reaching out, Vaneeza. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks for your question! Let me help clarify the difference for you: • livekit.agents: This is the complete framework designed to build real-time, programmable agent participants who can join audio, video, and data sessions. It supports different types of agents, including voice and multimodal ones, and offers tools to integrate AI processing pipelines like speech-to-text (STT), large language models (LLM), and text-to-speech (TTS). • livekit.agents.pipeline: This refers to the pipeline-based processing model (STT → LLM → TTS) within that framework. It’s not a separate module but more of a conceptual approach to creating voice agents. In earlier versions, this was handled by the
VoicePipelineAgent
class, but starting from version 1.0, it’s all unified under the
AgentSession
class, which supports both pipeline-based and real-time agents. So, in a nutshell,
livekit.agents.pipeline
is a functional model inside the broader
livekit.agents
framework, focusing on the STT-LLM-TTS flow specifically for voice agents. I hope this helps clear things up! If you have any more questions, feel free to ask. Sources: docs/index.yaml | agents/CHANGELOG.md | Voice AI quickstart | LiveKit Docs | Pipeline nodes and hooks | LiveKit Docs | Agents v0.x migration guide - Python | LiveKit Docs
p
difference between pipeline based agents and realtime agents. and whats the syntax for both?
t
Let's explore the key differences between pipeline-based agents and real-time agents in LiveKit together: • Pipeline-Based Agents: These operate with a modular, step-by-step approach, featuring separate components for speech-to-text (STT), language model (LLM), and text-to-speech (TTS). Because of this sequential processing, you might notice a bit more latency (around 500–1000ms+). The great thing is, you can customize each stage using nodes like
stt_node
,
llm_node
, and
tts_node
, giving you lots of flexibility. • Real-Time Agents: These bring STT, LLM, TTS, and turn detection together into one model, allowing everything to happen in parallel. This means ultra-low latency (about 200–400ms), making interactions feel super smooth. They use real-time models such as OpenAI's
gpt-4o-realtime-preview
or Google's
gemini-2.0-flash-live-001
. Here’s how you can set them up: Pipeline-Based Agent:
Copy code
session = AgentSession(
    vad=silero.VAD.load(),
    stt=deepgram.STT(model="nova-3"),
    llm=openai.LLM(model="gpt-4o-mini"),
    tts=elevenlabs.TTS(),
)
Real-Time Agent:
Copy code
session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        voice="coral"
    )
)
To sum it up, pipeline-based agents shine when you want that extra customization and control, while real-time agents are fantastic if you’re aiming for quick, low-latency interactions. If you have any questions or want to dive deeper into either option, I’m here to help! Sources: livekit-agents/README.md | .cursor/rules/agent-core.mdc | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki | Pipeline nodes and hooks | LiveKit Docs