Do LiveKit workflows require more memory per call ...
# ask-ai
d
Do LiveKit workflows require more memory per call than a single agent, and by roughly how much?
t
Thanks for reaching out, akshat. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help you in the best way possible, could you please share a bit more about your use case? 1. Are you thinking about using workflows with multiple agents running at the same time, or will it be more of a step-by-step handoff between agents? 2. What specific components are included in your agent(s) (like STT, LLM, TTS models, noise cancellation, turn detection)? 3. Are you looking for information on self-hosted deployment, or are you considering using LiveKit Cloud? Sources: Building voice agents | LiveKit Docs | Deploying to custom environments | LiveKit Docs
d
1. Step by step handoff 2. STT, LLM, TTS, Turn Detector - same setup as for a single agent 3. Self hosted, but memory usage pattern would be similar irrespective?
t
For a self-hosted LiveKit setup using step-by-step handoff with STT, LLM, TTS, and Turn Detector, here are some important memory considerations to keep in mind: • Turn Detector: This typically requires around ~200MB for the English model or ~400MB for the multilingual model. It’s the main part that uses local memory. • VAD Model: While the exact memory needs aren’t specified, it’s good to know that this model is preloaded during initialization and reused to save resources. • External Components: STT, LLM, and TTS are usually accessed through external APIs, so they don’t add much to your local server’s memory load—unless you’re hosting them yourself. • Agent Runtime Overhead: The agent process itself will need some extra memory, though the exact amount can vary depending on how it’s implemented. As you think about workflows, remember that memory usage grows with the number of agents involved in the handoff. Each agent brings its own memory needs, especially for the turn detector and any other components running locally. If you’re considering hosting STT, LLM, or TTS locally, their memory requirements will depend on the specific models you choose. Since this info isn’t detailed in the documentation, it might be helpful to check the model docs directly or try some testing to get a clearer picture. Sources: examples/voice_agents/realtime_turn_detector.py | LiveKit turn detector plugin | LiveKit docs | agent-examples/agent_examples/pipeline_agent.py | agent.py | main.py
d
Wouldn't each agent in the workflow use the same agent session? Why would it take up extra memory compared to a single agent?
t
In a LiveKit workflow, all agents involved in a single session share the same AgentSession instance. It’s important to know that only one agent is active at a time, and control is smoothly handed off between agents as needed. The session thoughtfully manages shared resources like audio pipelines, room connections, and context state, which helps reduce redundant memory allocation. When a handoff happens, the previous agent’s state is gently cleaned up using its on_exit hook, and the new agent sets up its state with the on_enter hook. This process ensures memory is used efficiently within the session. While the session itself continues and reuses resources, each agent might have its own configuration (such as LLM, TTS, tools) that could use some extra memory when activated. But don’t worry—since agents don’t run at the same time within the same session, the memory impact is limited to just the active agent at any moment. If you have any questions or need further clarification, I’m here to help! Sources: Pipeline nodes and hooks | LiveKit docs | Job lifecycle | LiveKit Docs | Worker lifecycle | LiveKit Docs | Example Applications & Templates | livekit/livekit_composite | DeepWiki | livekit-agents/livekit/agents/voice/agent_session.py