STT from livekit inference and assembly AI returning error

Hey team,

We are seeing a surge in this error, this causes the session to get stuck, and eventually end.

Attaching an example log -

agentId:CA_twTMjpNUeaEj
entity.guid:MzExMDU2M3xBUE18QVBQTElDQVRJT058MTY4MDI5OTkyMw
entity.guids:MzExMDU2M3xBUE18QVBQTElDQVRJT058MTY4MDI5OTkyMw
entity.name:livekit.hosted.agents
exc_info:Traceback (most recent call last):
File “/app/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py”, line 17, in async_fn_logs
return await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/app/.venv/lib/python3.13/site-packages/livekit/agents/inference/stt.py”, line 602, in recv_task
raise APIError(f"LiveKit Inference STT returned error: {msg.data}")
livekit.agents._exceptions.APIError: LiveKit Inference STT returned error: {“type”:“error”,“session_id”:“e35d2c9d-1147-4f7c-a312-c4a02556b7f1”,“message”:“session closed due to agent inactivity”,“code”:2007}

We are using assembly AI Through livekit’s inference for STT

Have you tried to adjust inactivity_timeoutIf you have Agent Insights enabled, can you see if this occurred during a long period of silence?

Also, make sure you do not have any code that would block the STT thread.