faint-arm-51818
09/01/2025, 12:33 PMtall-airline-16756
09/01/2025, 12:33 PMtall-airline-16756
09/01/2025, 12:34 PMLLMAdapter that makes it super easy to plug your LangGraph workflows right into a LiveKit AgentSession as the LLM component.
Here’s how you can get started: compile your LangGraph StateGraph and pass it to the LLMAdapter when you set up your agent. Check out this example:
from langgraph.graph import StateGraph
from livekit.agents import AgentSession, Agent
from livekit.plugins import langchain
def create_workflow():
workflow = StateGraph(...)
# Add nodes and edges
return workflow.compile()
session = AgentSession(
llm=langchain.LLMAdapter(
graph=create_workflow()
),
# ... other parameters (stt, tts, etc.)
)
The LLMAdapter handles converting LiveKit chat context into LangChain message types seamlessly. Plus, it supports cool features like vision, structured output, and custom models. If you want to dive deeper, the langgraph_agent.py example in the LiveKit examples repo is a great resource.
Sources: livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/llm.py | LangChain integration guide | LiveKit Docs | Large language model (LLM) integrations | LiveKit Docsfaint-arm-51818
09/01/2025, 12:36 PMtall-airline-16756
09/01/2025, 12:36 PMlanggraph_agent.py file over in the LiveKit Agents GitHub repository right here:
https://github.com/livekit/agents/blob/main/examples/voice_agents/langgraph_agent.py
This example is a great way to see how LangGraph works with LiveKit Agents, showing you how to handle voice orchestration and use LangGraph workflows inside a voice agent. If you have any questions, feel free to ask!
Sources: livekit-plugins/livekit-plugins-langchain/README.md