Issue Summary for LiveKit Bot Consultation :dart: ...
# ask-ai
c
Issue Summary for LiveKit Bot Consultation 🎯 Problem Description: We have a LiveKit voice agent integration that successfully connects to rooms and initializes, but fails when trying to publish audio tracks due to premature connection closure. 🔧 Technical Setup: • LiveKit Cloud: wss://pravidhi-6pg4q80c.livekit.cloud • Agent: Python LiveKit Agents SDK v1.2.8 • Architecture: FastAPI backend + React frontend + LiveKit agent worker • Agent Configuration: Using Deepgram STT, OpenAI LLM, ElevenLabs TTS 📊 Error Sequence: 1. ✅ Agent receives job request successfully 2. ✅ Agent connects to LiveKit room (room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152152) 3. ✅ Agent initializes and enters room 4. ❌ Frontend client disconnects (signal client closed: "stream closed") 5. ❌ Agent fails to publish audio track: PublishTrackError: room error engine: connection error: engine is closed 6. ✅ Agent exits gracefully 🐛 Specific Error: text livekit.rtc.participant.PublishTrackError: room error engine: connection error: engine is closed Location: livekit/rtc/participant.py:696 in publish_track() 🔍 Root Cause Analysis: The frontend LiveKit client is disconnecting from the room before the agent can establish the full audio pipeline. This happens during the _audio_output.start() phase when the agent tries to publish its audio track. ❓ Questions for LiveKit Bot: 1. What's the recommended approach for handling agent audio track publishing when clients may disconnect quickly? 2. Should we implement retry logic or connection state checking before publishing tracks? 3. Is there a way to delay audio track publishing until we're sure the client connection is stable? 4. Are there best practices for managing agent lifecycle when clients connect/disconnect frequently? 5. Should we modify the agent's audio output initialization to be more resilient to connection changes? 🎯 Expected Behavior: The agent should be able to handle client disconnections gracefully and either retry publishing tracks or wait for a stable connection before attempting audio output. 📝 Current Workaround: We're considering adding connection state validation before audio track publishing, but would like expert guidance on the best approach. Context: This is a productivity assistant voice agent that needs to handle real-time voice conversations with users who may connect/disconnect frequently during testing
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
When your clients disconnect quickly, here are some friendly tips to keep your agent’s audio track publishing running smoothly: • Take advantage of LiveKit’s built-in automatic reconnection and track republishing features. It tries to reconnect and republish tracks on its own, which is super handy. • Use the Python agent SDK’s
_on_reconnected
method to handle track republishing. This method stops any old republish tasks and starts fresh ones to make sure your tracks come back just right. • Make sure to clean up audio tasks and track subscriptions properly when participants leave. This helps avoid any resource leaks and keeps everything neat and tidy. • Keep an eye on events like
Reconnecting
and
Reconnected
so you can react smartly to connection changes. These events help you decide the best time to republish tracks based on how stable the connection is. • It’s also a good idea to add some error handling around track publishing. That way, if something goes wrong, your app can handle it gracefully and try again when possible. Following these tips will make your agent more resilient to client disconnections and keep your audio pipeline steady and reliable. Sources: Connecting to LiveKit | LiveKit Docs | livekit-agents/livekit/agents/voice/background_audio.py | terminal-client/client.py | src/room/Room.ts
c
companion_env) PS D:\Productivity_companion\backend> python start_agent_worker.py start 2025-09-07 152736,426 - main - INFO - Starting KAORI LiveKit Agent Worker 2025-09-07 152736,470 - livekit.agents - INFO - starting worker {"message": "starting worker", "level": "INFO", "name": "livekit.agents", "version": "1.2.8", "rtc-version": "1.0.12", "timestamp": "2025-09-07T095736.470933+00:00"} 2025-09-07 152736,480 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 32588, "timestamp": "2025-09-07T095736.480976+00:00"} 2025-09-07 152736,483 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 22156, "timestamp": "2025-09-07T095736.483020+00:00"} 2025-09-07 152736,485 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 28028, "timestamp": "2025-09-07T095736.485044+00:00"} 2025-09-07 152736,485 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 32340, "timestamp": "2025-09-07T095736.485044+00:00"} 2025-09-07 152736,489 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 32588, "elapsed_time": 0.01, "timestamp": "2025-09-07T095736.489048+00:00"} 2025-09-07 152736,490 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 22156, "elapsed_time": 0.01, "timestamp": "2025-09-07T095736.490556+00:00"} 2025-09-07 152736,492 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 28028, "elapsed_time": 0.01, "timestamp": "2025-09-07T095736.492076+00:00"} 2025-09-07 152736,493 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 32340, "elapsed_time": 0.01, "timestamp": "2025-09-07T095736.493085+00:00"} 2025-09-07 152736,803 - livekit.agents - INFO - registered worker {"message": "registered worker", "level": "INFO", "name": "livekit.agents", "id": "AW_9imVamdG5fmZ", "url": "wss://pravidhi-6pg4q80c.livekit.cloud", "region": "India", "protocol": 16, "timestamp": "2025-09-07T095736.803725+00:00"} 2025-09-07 152754,315 - livekit.agents - INFO - worker is at full capacity, marking as unavailable {"message": "worker is at full capacity, marking as unavailable", "level": "INFO", "name": "livekit.agents", "load": 0.7292000000000001, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T095754.315694+00:00"} 2025-09-07 152756,828 - livekit.agents - INFO - worker is below capacity, marking as available {"message": "worker is below capacity, marking as available", "level": "INFO", "name": "livekit.agents", "load": 0.6364000000000001, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T095756.828247+00:00"} 2025-09-07 152807,131 - livekit.agents - INFO - received job request {"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_yo92mrz3aVMa", "dispatch_id": "", "room_name": "room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152805", "agent_name": "kaori-voice-agent", "resuming": false, "timestamp": "2025-09-07T095807.131323+00:00"} 2025-09-07 152807,190 - app.core.livekit_voice_service - INFO - Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152805 {"message": "Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152805", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095807.190645+00:00"} 2025-09-07 152807,278 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 22928, "timestamp": "2025-09-07T095807.278121+00:00"} 2025-09-07 152807,279 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 22928, "elapsed_time": 0.0, "timestamp": "2025-09-07T095807.279115+00:00"} 2025-09-07 152809,916 - livekit - WARNING - livekit:rtc engine453livekit:rtc_engine - received session close: "signal client closed: \"stream closed\"" UnknownReason Resume {"message": "livekit:rtc engine453livekit:rtc_engine - received session close: \"signal client closed: \\\"stream closed\\\"\" UnknownReason Resume", "level": "WARNING", "name": "livekit", "timestamp": "2025-09-07T095809.916997+00:00"} 2025-09-07 152921,878 - livekit.agents - INFO - worker is at full capacity, marking as unavailable {"message": "worker is at full capacity, marking as unavailable", "level": "INFO", "name": "livekit.agents", "load": 0.7719999999999996, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T095921.878972+00:00"} 2025-09-07 152926,869 - livekit.agents - INFO - worker is below capacity, marking as available {"message": "worker is below capacity, marking as available", "level": "INFO", "name": "livekit.agents", "load": 0.5777999999999996, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T095926.869397+00:00"} 2025-09-07 152944,457 - livekit.agents - INFO - received job request {"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_yg49oLatcSvF", "dispatch_id": "", "room_name": "room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152942", "agent_name": "kaori-voice-agent", "resuming": false, "timestamp": "2025-09-07T095944.457726+00:00"} 2025-09-07 152944,525 - app.core.livekit_voice_service - INFO - Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152942 {"message": "Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_152942", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095944.525277+00:00"} 2025-09-07 152944,558 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 4264, "timestamp": "2025-09-07T095944.558596+00:00"} 2025-09-07 152944,559 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 4264, "elapsed_time": 0.0, "timestamp": "2025-09-07T095944.559596+00:00"} 2025-09-07 152945,226 - app.core.livekit_voice_service - INFO - Starting KAORI voice agent for participant rajendraprasad {"message": "Starting KAORI voice agent for participant rajendraprasad", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095945.226194+00:00"} 2025-09-07 152945,731 - livekit - WARNING - livekit:rtc engine453livekit:rtc_engine - received session close: "signal client closed: \"stream closed\"" UnknownReason Resume {"message": "livekit:rtc engine453livekit:rtc_engine - received session close: \"signal client closed: \\\"stream closed\\\"\" UnknownReason Resume", "level": "WARNING", "name": "livekit", "timestamp": "2025-09-07T095945.731023+00:00"} 2025-09-07 152945,844 - app.core.livekit_voice_service - INFO - KAORI agent entering room for user rajendraprasad {"message": "KAORI agent entering room for user rajendraprasad", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095945.844146+00:00"} 2025-09-07 152945,849 - livekit.agents - ERROR - Error in _init_task Traceback (most recent call last): File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\utils\log.py", line 16, in async_fn_logs return await fn(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\voice\room_io\room_io.py", line 382, in _init_task await self._audio_output.start() File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\voice\room_io\_output.py", line 76, in start await self._publish_track() File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\voice\room_io\_output.py", line 63, in _publish_track self._publication = await self._room.local_participant.publish_track( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\conda\envs\companion_env\Lib\site-packages\livekit\rtc\participant.py", line 696, in publish_track raise PublishTrackError(cb.publish_track.error) livekit.rtc.participant.PublishTrackError: room error engine: connection error: engine is closed {"message": "Error in _init_task", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\utils\\log.py\", line 16, in async_fn_logs\n return await fn(*args, **kwargs)\n ^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\voice\\room_io\\room_io.py\", line 382, in _init_task\n await self._audio_output.start()\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\voice\\room_io\\_output.py\", line 76, in start\n await self._publish_track()\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\voice\\room_io\\_output.py\", line 63, in _publish_track\n self._publication = await self._room.local_participant.publish_track(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\rtc\\participant.py\", line 696, in publish_track\n raise PublishTrackError(cb.publish_track.error)\nlivekit.rtc.participant.PublishTrackError: room error engine: connection error: engine is closed", "timestamp": "2025-09-07T095945.849147+00:00"} 2025-09-07 152946,091 - app.core.livekit_voice_service - INFO - Agent session started successfully {"message": "Agent session started successfully", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095946.091327+00:00"} 2025-09-07 152946,095 - app.core.livekit_voice_service - INFO - KAORI agent exiting room for user rajendraprasad {"message": "KAORI agent exiting room for user rajendraprasad", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T095946.095327+00:00"}
t
Hey there! That error
PublishTrackError: room error engine: connection error: engine is closed
pops up when you try to publish a track but the LiveKit engine has already been closed or disconnected. No worries though, here’s what you can do: • Recreate the engine: Just create a new
RtcEngine
or whatever your SDK uses. • Reconnect to the room: Use your valid URL and token to join back in. • Republish the track: Make sure the engine is fully connected before you try publishing again. Some handy prevention tips: • Always check the engine state before publishing to make sure it’s not closed. • Handle disconnections smoothly and be ready to reconnect when needed. • Hold off on publishing tracks while reconnecting—wait until the connection is solid. Following these steps should help you tackle the error and keep things running smoothly for your agent. If you hit any bumps, just let me know—I’m here to help! Sources: livekit/src/rtc_engine/rtc_session.rs | lib/src/core/engine.dart | livekit-android-sdk/src/main/java/io/livekit/android/room/RTCEngine.kt
c
2025-09-07 153856,773 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 26024, "elapsed_time": 0.0, "timestamp": "2025-09-07T100856.773613+00:00"} 2025-09-07 153857,251 - app.core.livekit_voice_service - INFO - Starting KAORI voice agent for participant rajendraprasad {"message": "Starting KAORI voice agent for participant rajendraprasad", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T100857.251590+00:00"} 2025-09-07 153857,862 - app.core.livekit_voice_service - ERROR - Failed to start agent session: 'Room' object has no attribute 'is_connected' {"message": "Failed to start agent session: 'Room' object has no attribute 'is_connected'", "level": "ERROR", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T100857.862601+00:00"} 2025-09-07 153857,863 - livekit.agents - ERROR - unhandled exception while running the job task Traceback (most recent call last): File "D:\conda\envs\companion_env\Lib\site-packages\opentelemetry\util\_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 240, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "D:\Productivity_companion\backend\app\core\livekit_voice_service.py", line 481, in entrypoint if not ctx.room.is_connected: ^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'Room' object has no attribute 'is_connected'. Did you mean: 'isconnected'? {"message": "unhandled exception while running the job task", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\opentelemetry\\util\\_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\ipc\\job_proc_lazy_main.py\", line 240, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"D:\\Productivity_companion\\backend\\app\\core\\livekit_voice_service.py\", line 481, in entrypoint\n if not ctx.room.is_connected:\n ^^^^^^^^^^^^^^^^^^^^^\nAttributeError: 'Room' object has no attribute 'is_connected'. Did you mean: 'isconnected'?", "timestamp": "2025-09-07T100857.863603+00:00"} 2025-09-07 153858,977 - livekit - WARNING - livekit:rtc engine453livekit:rtc_engine - received session close: "signal client closed: \"stream closed\"" UnknownReason Resume {"message": "livekit:rtc engine453livekit:rtc_engine - received session close: \"signal client closed: \\\"stream closed\\\"\" UnknownReason Resume", "level": "WARNING", "name": "livekit", "timestamp": "2025-09-07T100858.977414+00:00"} 2025-09-07 153858,982 - app.core.livekit_voice_service - INFO - Room connection state changed to: 0 {"message": "Room connection state changed to: 0", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T100858.982172+00:00"} 2025-09-07 153858,983 - livekit - ERROR - failed to emit event connection_state_changed Traceback (most recent call last): File "D:\conda\envs\companion_env\Lib\site-packages\livekit\rtc\event_emitter.py", line 58, in emit callback(*callback_args) File "D:\Productivity_companion\backend\app\core\livekit_voice_service.py", line 460, in on_connection_state_changed if state == rtc.ConnectionState.DISCONNECTED: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\conda\envs\companion_env\Lib\site-packages\google\protobuf\internal\enum_type_wrapper.py", line 102, in getattr raise AttributeError('Enum {} has no value defined for name {!r}'.format( AttributeError: Enum ConnectionState has no value defined for name 'DISCONNECTED' {"message": "failed to emit event connection_state_changed", "level": "ERROR", "name": "livekit", "exc_info": "Traceback (most recent call last):\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\rtc\\event_emitter.py\", line 58, in emit\n callback(*callback_args)\n File \"D:\\Productivity_companion\\backend\\app\\core\\livekit_voice_service.py\", line 460, in on_connection_state_changed\n if state == rtc.ConnectionState.DISCONNECTED:\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\google\\protobuf\\internal\\enum_type_wrapper.py\", line 102, in __getattr__\n raise AttributeError('Enum {} has no value defined for name {!r}'.format(\nAttributeError: Enum ConnectionState has no value defined for name 'DISCONNECTED'", "timestamp": "2025-09-07T100858.983181+00:00"}
t
Hey there! That
AttributeError: 'Room' object has no attribute 'is_connected'
pops up because the LiveKit Python SDK doesn’t actually have an
is_connected
attribute for the
Room
object. No worries though — you can check if your room is connected by using these handy methods instead: • Try the
isconnected()
method:
It’ll return
True
if the room is connected, and
False
if not. • Or check the
connection_state
property:
Just compare it to
rtc.ConnectionState.CONN_CONNECTED
to see if you’re good to go. Here’s a quick example to make it clear:
Copy code
from livekit import rtc

room = rtc.Room()

# Check connection status
if room.isconnected():
    print("Room is connected")
else:
    print("Room is not connected")

# Or check the connection state
if room.connection_state == rtc.ConnectionState.CONN_CONNECTED:
    print("Room is connected")
Give these a try, and you’ll be able to check your room’s connection status without a hitch! Sources: livekit-protocol/livekit/protocol/models.pyi | livekit-agents/livekit/agents/utils/participant.py
c
{"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 26944, "elapsed_time": 0.0, "timestamp": "2025-09-07T101351.158887+00:00"} 2025-09-07 154351,161 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 20844, "elapsed_time": 0.01, "timestamp": "2025-09-07T101351.161402+00:00"} 2025-09-07 154351,162 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 18468, "elapsed_time": 0.01, "timestamp": "2025-09-07T101351.162600+00:00"} 2025-09-07 154351,163 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 35532, "elapsed_time": 0.01, "timestamp": "2025-09-07T101351.163601+00:00"} 2025-09-07 154351,505 - livekit.agents - INFO - registered worker {"message": "registered worker", "level": "INFO", "name": "livekit.agents", "id": "AW_c3FiPZfRDsDi", "url": "wss://pravidhi-6pg4q80c.livekit.cloud", "region": "India", "protocol": 16, "timestamp": "2025-09-07T101351.505305+00:00"} 2025-09-07 154411,563 - livekit.agents - INFO - worker is at full capacity, marking as unavailable {"message": "worker is at full capacity, marking as unavailable", "level": "INFO", "name": "livekit.agents", "load": 0.7210000000000001, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T101411.563394+00:00"} 2025-09-07 154414,048 - livekit.agents - INFO - worker is below capacity, marking as available {"message": "worker is below capacity, marking as available", "level": "INFO", "name": "livekit.agents", "load": 0.5504, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T101414.048453+00:00"} 2025-09-07 154414,106 - livekit.agents - INFO - received job request {"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_Kvoy7b7o4qXy", "dispatch_id": "", "room_name": "room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154410", "agent_name": "kaori-voice-agent", "resuming": false, "timestamp": "2025-09-07T101414.106700+00:00"} 2025-09-07 154414,149 - app.core.livekit_voice_service - INFO - Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154410 {"message": "Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154410", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T101414.149346+00:00"} 2025-09-07 154414,180 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 13108, "timestamp": "2025-09-07T101414.180341+00:00"} 2025-09-07 154414,181 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 13108, "elapsed_time": 0.0, "timestamp": "2025-09-07T101414.181871+00:00"} 2025-09-07 154441,552 - livekit.agents - INFO - worker is at full capacity, marking as unavailable {"message": "worker is at full capacity, marking as unavailable", "level": "INFO", "name": "livekit.agents", "load": 0.7830000000000001, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T101441.552291+00:00"} 2025-09-07 154446,548 - livekit.agents - INFO - worker is below capacity, marking as available {"message": "worker is below capacity, marking as available", "level": "INFO", "name": "livekit.agents", "load": 0.5592, "threshold": "_WorkerEnvOption(dev_default=inf, prod_default=0.7)", "timestamp": "2025-09-07T101446.548786+00:00"} 2025-09-07 154455,188 - livekit.agents - INFO - received job request {"message": "received job request", "level": "INFO", "name": "livekit.agents", "job_id": "AJ_eTEPDnupAeVk", "dispatch_id": "", "room_name": "room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154452", "agent_name": "kaori-voice-agent", "resuming": false, "timestamp": "2025-09-07T101455.188796+00:00"} 2025-09-07 154455,229 - app.core.livekit_voice_service - INFO - Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154452 {"message": "Connecting to room room_voice_3206739b-22fa-4325-8e27-e7124ba31c13_20250907_154452", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T101455.229235+00:00"} 2025-09-07 154455,272 - livekit.agents - INFO - initializing job runner {"message": "initializing job runner", "level": "INFO", "name": "livekit.agents", "tid": 1904, "timestamp": "2025-09-07T101455.272289+00:00"} 2025-09-07 154455,274 - livekit.agents - INFO - job runner initialized {"message": "job runner initialized", "level": "INFO", "name": "livekit.agents", "tid": 1904, "elapsed_time": 0.0, "timestamp": "2025-09-07T101455.274288+00:00"} 2025-09-07 154456,115 - app.core.livekit_voice_service - INFO - Starting KAORI voice agent for participant rajendraprasad {"message": "Starting KAORI voice agent for participant rajendraprasad", "level": "INFO", "name": "app.core.livekit_voice_service", "timestamp": "2025-09-07T101456.115162+00:00"} 2025-09-07 154456,116 - livekit.agents - ERROR - unhandled exception while running the job task Traceback (most recent call last): File "D:\conda\envs\companion_env\Lib\site-packages\opentelemetry\util\_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\conda\envs\companion_env\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 240, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "D:\Productivity_companion\backend\app\core\livekit_voice_service.py", line 467, in entrypoint ctx.room.on("connection_state_changed", on_connection_state_changed) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ NameError: name 'on_connection_state_changed' is not defined {"message": "unhandled exception while running the job task", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\opentelemetry\\util\\_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"D:\\conda\\envs\\companion_env\\Lib\\site-packages\\livekit\\agents\\ipc\\job_proc_lazy_main.py\", line 240, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"D:\\Productivity_companion\\backend\\app\\core\\livekit_voice_service.py\", line 467, in entrypoint\n ctx.room.on(\"connection_state_changed\", on_connection_state_changed)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\nNameError: name 'on_connection_state_changed' is not defined", "timestamp": "2025-09-07T101456.116163+00:00"} 2025-09-07 154456,758 - livekit - WARNING - livekit:rtc engine453livekit:rtc_engine - received session close: "signal client closed: \"stream closed\"" UnknownReason Resume {"message": "livekit:rtc engine453livekit:rtc_engine - received session close: \"signal client closed: \\\"stream closed\\\"\" UnknownReason Resume", "level": "WARNING", "name": "livekit", "timestamp": "2025-09-07T101456.758049+00:00"}
t
I don't have the answer you're looking for. You could also try asking your question: • in one of the other Slack channels or • to https://deepwiki.com/livekit/livekit_composite which is trained on all LiveKit source code If you find the answer, please post it here to help others!
c
PublishTrackError: room error engine: connection error: engine is closed error.