ERROR:livekit.agents:Error in _llm_inference_task ...
# ask-ai
n
ERRORlivekit.agentsError in _llm_inference_task Traceback (most recent call last): File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 223, in _main_task await self._run() File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/inference/llm.py", line 429, in _run raise APIStatusError( ...<5 lines>... ) from None livekit.agents._exceptions.APIStatusError: message='Error getting model definition', status_code=400, retryable=True, body=Error getting model definition The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 17, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py", line 144, in _llm_inference_task async for chunk in llm_node: ...<47 lines>... ) File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py", line 456, in llm_node async for chunk in stream: yield chunk File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 393, in anext raise exc # noqa: B904 ^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 195, in _traceable_main_task await self._main_task() File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 245, in _main_task raise APIConnectionError( f"failed to generate LLM completion after {self._conn_options.max_retry + 1} attempts", # noqa: E501 143934.342 ERROR livekit.agents Error in _llm_inference_task Traceback (most recent call last): File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 223, in _main_task await self._run() File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/inference/llm.py", line 429, in _run raise APIStatusError( ...<5 lines>... ) from None livekit.agents._exceptions.APIStatusError: message='Error getting model definition', status_code=400, retryable=True, body=Error getting model definition The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py", line 17, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py", line 144, in _llm_inference_task async for chunk in llm_node: ...<47 lines>... ) File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py", line 456, in llm_node async for chunk in stream: yield chunk File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 393, in anext raise exc # noqa: B904 ^^^^^^^^^ File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 195, in _traceable_main_task await self._main_task() File "/home/athar/python_projects/WORKSHOP_DEMO/livekit-voice-agent/.venv/lib/python3.13/site-packages/livekit/agents/llm/llm.py", line 245, in _main_task raise APIConnectionError( f"failed to generate LLM completion after {self._conn_options.max_retry + 1} attempts", # noqa: E501 ) from e INFOlivekit.agentsshutting down worker 143939.373 INFO livekit.agents shutting down worker {"id": "unregistered"} DEBUGlivekit.agentssession closed 143941.580 DEBUG livekit.agents session closed {"reason": "user_initiated", "error": null} DEBUGlivekit.agentsshutting down job task 143941.583 DEBUG livekit.agents shutting down job task {"reason": "", "user_initiated": false} DEBUGlivekit.agentsjob exiting 143941.584 DEBUG livekit.agents job exiting {"reason": "", "tid": 38189, "job_id": "mock-job-53ea8ce7937a", "room_id": "SRM_14aee2e5b988"} DEBUGlivekit.agentshttp_session(): closing the httpclient ctx 143941.585 DEBUG livekit.agents http_session(): closing the httpclient ctx INFOlivekit.agentsprocess exiting 143941.587 INFO livekit.agents process exiting {"reason": "", "pid": 38155, "inference": true}
✅ 1
t
Thanks for reaching out, Sajjad. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I’m sorry you’re hitting that LLM inference failure. I’m ready to help troubleshoot, but I need a bit more context to narrow this down. Quick questions to start: • Which LLM provider and model name are you configuring (for example: OpenAI gpt-4, Anthropic claude-2, or a custom model)? • Where do you set the model definition (env var, config file, or code)? Please paste the exact value (sanitized of secrets) if possible. • Share the relevant bits of your agent config or code where the model is initialized (e.g., the section that constructs the LLM client or sets model parameters). • Have you recently changed API keys, model names, or API endpoints? • Does any other request to the LLM provider succeed from this environment (curl or a simple client test)? If you prefer, paste the small config file or the env vars (again, remove secrets) and I’ll point out likely mismatches that cause a 400 "Error getting model definition." , with interactive elements