limited-spring-14213
11/18/2025, 12:44 AMtall-airline-16756
11/18/2025, 12:44 AMtall-airline-16756
11/18/2025, 12:45 AMRuntimeError: trying to generate reply without an LLM model. This usually happens when the generate_reply() method is called on an AgentSession that hasn't been set up with a Large Language Model (LLM) instance yet. No worries—we can get this sorted out together! To fix this, please make sure that an LLM is properly configured either in your AgentSession or directly in the Agent.
Here are some friendly steps to help you configure an LLM:
• Option A: Configure LLM in AgentSession
session = AgentSession(
llm=openai.LLM(model="gpt-4o-mini"),
stt=deepgram.STT(),
tts=cartesia.TTS(),
vad=silero.VAD.load()
)
• Option B: Configure LLM in Agent
class MyAgent(Agent):
def __init__(self):
super().__init__(
instructions="Your instructions here",
llm=openai.LLM(model="gpt-4o-mini")
)
Also, a handy tip: you can use model string IDs directly, and they’ll be automatically turned into LLM instances for you:
session = AgentSession(
llm="openai/gpt-4.1-mini",
# ... other components
)
If you try these and still run into trouble, it might be worth double-checking that the LLM is initialized properly and accessible. Please feel free to reach out if you want me to walk you through it or if you have any other questions—I’m here to help!
Sources: tests/test_evals.py | Large language models (LLM) | LiveKit Docs