better-minister-50441
07/23/2025, 1:17 PMtall-airline-16756
07/23/2025, 1:17 PMtall-airline-16756
07/23/2025, 1:18 PMlivekit.agents.llm.realtime.RealtimeError: generate_reply timed out waiting for generation_crafted event means your agent did not receive a response from the realtime LLM model within the expected 5-second window.
To resolve this:
• Check your network connection to ensure stable internet access to the LLM service endpoints.
• Verify your API credentials and configuration in agent.py and your .env.local file. Make sure environment variables are loaded and valid.
• Wait and retry in case the realtime model service is temporarily unavailable or under high load.
• Review any instructions/context you pass to generate_reply() to ensure they are properly formatted and not causing the model to hang.
• Implement error handling around generate_reply() to catch and log errors, and consider adding retry logic:
try:
await session.generate_reply(instructions="Your instructions here")
except llm.RealtimeError as e:
logger.error(f"Realtime error: {e}")
# Implement retry logic or fallback behavior
Monitor your logs for any reconnection or recovery events. If the problem continues after these steps, it may be related to the realtime model service status or configuration.
Let me know if you need further details on any of these steps.
Sources: livekit-agents/livekit/agents/llm/fallback_adapter.py | agent.py | LLM Integrations | livekit/livekit_composite | DeepWiki