fierce-jordan-44682
10/24/2025, 3:37 AMtall-airline-16756
10/24/2025, 3:37 AMtall-airline-16756
10/24/2025, 3:38 AMAgentSession! To help you get started smoothly, you can use the LiveKit LangChain plugin, which nicely wraps LangGraph workflows for you. Here's a simple overview to guide you:
1. First, install the LiveKit LangChain plugin by running pip install livekit-plugins-langchain.
2. Next, create your LangGraph workflow and wrap it using the langchain.LLMAdapter. This adapter helps connect LiveKit's chat context with LangGraph's message format seamlessly.
3. Then, set up an Agent by using the LangGraph workflow wrapped in the adapter.
4. Finally, configure and start an AgentSession with components like VAD (Voice Activity Detection), STT (Speech-to-Text), TTS (Text-to-Speech), and turn detection. This session will manage the voice pipeline and bring your LangGraph workflow to life.
If you'd like, I’d be more than happy to provide detailed code examples or walk you through any part of the process. Just let me know—I’m here to help!
Sources: livekit-plugins/livekit-plugins-langchain/livekit/plugins/langchain/__init_... | Building voice agents | LiveKit Docsfierce-jordan-44682
10/24/2025, 3:39 AMtall-airline-16756
10/24/2025, 3:39 AMWorkerOptions and pass an agent can be a bit different depending on the language and setup, so I want to make sure I guide you correctly.
Sources: agents/src/worker.ts | Node.js Agents Architecture | livekit/livekit_composite | DeepWiki | examples/avatar_agents/simli/agent_worker.py | LangChain integration guide | LiveKit Docsfierce-jordan-44682
10/24/2025, 3:39 AMtall-airline-16756
10/24/2025, 3:40 AMWorkerOptions, it’s important to know that you don’t pass an agent directly. Instead, you’ll want to create an entrypoint_fnc function where the agent is set up and configured. Here’s a friendly guide on how to do it:
1. Inside the entrypoint_fnc, create your agent using langchain.LLMAdapter along with your LangGraph workflow.
2. Then, pass this entrypoint_fnc to WorkerOptions when you start the worker with cli.run_app().
Here’s a simple example to illustrate:
def entrypoint(ctx: JobContext):
graph = create_graph()
agent = Agent(instructions="", llm=langchain.LLMAdapter(graph))
session = AgentSession(
vad=ctx.proc.userdata["vad"],
stt=deepgram.STT(model="nova-3", language="multi"),
tts=deepgram.TTS(),
turn_detection=MultilingualModel(),
)
await session.start(agent=agent, room=ctx.room)
def prewarm(proc: JobProcess):
proc.userdata["vad"] = silero.VAD.load()
if __name__ == "__main__":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))
This way, your agent is nicely initialized and ready to be used in the AgentSession at runtime. If anything feels unclear or if you want me to walk you through any part, just let me know—I’m here to help!