rich-megabyte-73517
05/27/2026, 2:37 PM<tel:+17037312463|+17037312463>
To Number: <tel:+17036868627|+17036868627>
Agent ID: 9a16fbf4-2778-4718-9d96-493dd0bcc6da
Room: inbound-call-_+17037312463_33R9k5dhBre9
Conversation ID: aa0c8b37-ecae-45e9-9e97-8c1a7313328a
Error:
room error engine: connection error: engine is closed
Stack Trace:
Traceback (most recent call last):
File "/app/app/livekit_worker.py", line 2232, in entry
await agent.initialize(ctx)
File "/app/app/agents/standard_agent.py", line 674, in initialize
await self._background_audio.start(ctx.room, self.session)
File "/app/app/pipeline/audio_background.py", line 117, in start
return await self._start_ambient_mode(room, session)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/app/pipeline/audio_background.py", line 145, in _start_ambient_mode
await self._player.start(
File "/usr/local/lib/python3.11/site-packages/livekit/agents/voice/background_audio.py", line 262, in start
await self._publish_track()
File "/usr/local/lib/python3.11/site-packages/livekit/agents/voice/background_audio.py", line 394, in _publish_track
self.publication = await self._room.local_participant.publish_track(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/livekit/rtc/participant.py", line 759, in publish_track
raise PublishTrackError(cb.publish_track.error)
livekit.rtc.participant.PublishTrackError: room error engine: connection error: engine is closed
May 27, 2026 at 142734 UTCtall-airline-16756
05/27/2026, 2:38 PMtall-airline-16756
05/27/2026, 2:38 PM9a16fbf4-...) and room inbound-call-_+17037312463_33R9k5dhBre9.
2. Reproduce with logging around background audio publish:
◦ Log connection-ready state before calling publish_track().
◦ Add a short delay/retry before publishing to rule out a race.
1. If this is intermittent, monitor for patterns (same agent ID, same worker, same time window) to isolate network vs startup timing.
2. If you want an immediate workaround, consider skipping background-audio publish during initialization to confirm the rest of the agent can initialize.
If you’d like, I can:
• Help interpret related logs if you paste the connection / signaling lines around the timestamp.
• Suggest a small retry wrapper or sample code to delay/retry publish_track() to avoid the race. Which would you prefer? Sources: The ReAct Pattern for Voice Agents and How AI Agents Think, Act, and Respon... | Background audio | LiveKit Documentation | Understanding the STATE_MISMATCH Disconnect Reason, with interactive elements