#3634·agents

LLMAdapter with Langgraph doesn't work

Author: GennariAlCreated Oct 13, 2025Updated Sep 11, 2026
Labelsbug

I implemented LangGraph in the voicebot, using the Livekit plugin: https://pypi.org/project/livekit-plugins-langchain/

I'm running the script in local: no errors displayed, the initialization process goes smoothly. But the voicebot never respond me. See log below.

Two questions:

  1. How can I check where the problem is?
  2. Someone successfully implemented LangGraph?

Here's my code
with_langgraph.py

import logging, os
from typing import Annotated, TypedDict
from dotenv import load_dotenv
from langchain.chat_models import init_chat_model
from langchain_core.messages import BaseMessage
from langgraph.graph import START, StateGraph
from langgraph.graph.message import add_messages
from livekit.agents import (
Agent,
AgentSession,
JobContext,
JobProcess,
RoomInputOptions,
WorkerOptions,
cli,
)
from livekit.plugins import langchain, silero, openai
from livekit.plugins.turn_detector.multilingual import MultilingualModel

logger = logging.getLogger("basic-agent")

load_dotenv()

def prewarm(proc: JobProcess):
proc.userdata["vad"] = silero.VAD.load()

class State(TypedDict):
messages: Annotated[list[BaseMessage], add_messages]

def create_graph() -> StateGraph:
openai_llm = init_chat_model(model="azure_openai:gpt-5-nano")

def chatbot_node(state: State):
    return {"messages": [openai_llm.invoke(state["messages"])]}

builder = StateGraph(State)
builder.add_node("chatbot", chatbot_node)
builder.add_edge(START, "chatbot")
return builder.compile()

async def entrypoint(ctx: JobContext):
graph = create_graph()

agent = Agent(
    instructions="",
    llm=langchain.LLMAdapter(graph),
)

session = AgentSession(
    vad=ctx.proc.userdata["vad"],
    stt = openai.STT.with_azure(
        language="it",
        model="gpt-4o-mini-transcribe",
    ),
    tts=openai.TTS.with_azure(
        model="gpt-4o-mini-tts",
        voice="coral",
    ),
    turn_detection=MultilingualModel(),
)

await session.start(
    agent=agent,
    room=ctx.room,
    room_input_options=RoomInputOptions(
    ),
)
await session.say("Ciao! Sono l'Agente Merchant, come posso aiutarti?")

await session.generate_reply(instructions="ask the user how they are doing?")

if name == "main":
cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint, prewarm_fnc=prewarm))

Running the script, I obtain these logs:

  • INFO livekit.agents - starting worker {"version": "1.2.14", "rtc-version": "1.0.16"}
  • INFO livekit.agents - starting inference executor
  • INFO livekit.agents - initializing process {"pid": 48113, "inference": true}
  • DEBUG livekit.agents - initializing inference runner {"runner": "lk_end_of_utterance_multilingual", "pid": 48113, "inference": true}
  • DEBUG livekit.agents - inference runner initialized {"runner": "lk_end_of_utterance_multilingual", "elapsed_time": 0.8319074579994776, "pid": 48113, "inference": true}
  • DEBUG asyncio - Using selector: KqueueSelector {"pid": 48113, "inference": true}
  • INFO livekit.agents - process initialized {"pid": 48113, "inference": true, "elapsed_time": 8.98}
  • INFO livekit.agents - initializing job runner {"tid": 745145}
  • DEBUG asyncio - Using selector: KqueueSelector
  • INFO livekit.agents - job runner initialized {"tid": 745145, "elapsed_time": 0.08}
  • DEBUG livekit.agents - using audio io: ChatCLI -> AgentSession -> TranscriptSynchronizer -> ChatCLI
  • DEBUG livekit.agents - using transcript io: AgentSession -> TranscriptSynchronizer -> ChatCLI
  • DEBUG livekit.agents - received user transcript {"user_transcript": "Ciao, dimmi che cosa sai fare.", "language": "it"}
  • DEBUG livekit.plugins.turn_detector - eou prediction {"eou_probability": 0.1085105687379837, "input": "<|im_start|>assistant\nciao sono l'agente merchant come posso aiutarti<|im_end|>\n<|im_start|>user\nciao dimmi che cosa sai fare", "duration": 0.038}