We are using livekit-agent 0.x. After creating a L...
# ask-ai
b
We are using livekit-agent 0.x. After creating a LiveKit room and calling ctx.connect(), we observed that the room gets deleted approximately 300 seconds later. We couldn’t find any related code in our codebase. Is this behavior coming from LiveKit’s internal logic?
t
Thanks for reaching out, 최윤지. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit automatically deletes rooms after a period of inactivity, and this behavior is managed by the LiveKit server, not by your client code or the SDK. There are two relevant server-side timeouts: • Empty Timeout: If a room is created but no one joins, it will be deleted after 300 seconds (5 minutes) by default. • Departure Timeout: If all participants leave a room, it will be deleted after 20 seconds by default. This logic is implemented on the server, which periodically checks and closes idle rooms. The default 300-second timeout you observed matches the server's empty room timeout. You can adjust these timeouts via the server configuration or when creating rooms through the server API if you need different behavior. This is expected and intended LiveKit behavior. Sources: pkg/service/roommanager.go | packages/livekit-server-sdk/src/RoomServiceClient.ts | livekit-rtc/livekit/rtc/room.py
b
• Is the agent included as a participant? • If ctx.connect() is successfully executed, does that mean the agent participant is joined? Or is it a separate step?
t
• Is the agent included as a participant? Great question! Yes, when the agent connects using
ctx.connect()
, it automatically joins the room as a participant. Think of it like the agent getting a virtual seat at the table - it's represented as a
LocalParticipant
object in the room. • If ctx.connect() is successfully executed, does that mean the agent participant is joined? Or is it a separate step? Good news - a successful call to
ctx.connect()
means the agent is already part of the room. No extra steps needed! It's as simple as that. Just a heads up though: agents are considered a special type of participant. Even if only agents are hanging out in the room, the room will still close based on the usual timeout rules. So agents can't keep the room open indefinitely - they'll be disconnected if no other participants are around. Sources: LiveKit Agents | Inside a session | LiveKit Docs | agents/src/job.ts | Anatomy of an Agent | LiveKit Docs
b
Your answer differs from deepwiki's answer. https://deepwiki.com/search/we-are-using-livekitagent-0x-a_26f02d9a-84f7-447e-a810-79e771890ae9 "좋은 질문입니다. `ctx.connect()`를 호출했다고 해서 방이 더 이상 empty가 아닌 것은 아닙니다. main.py:65-66 Agent 연결과 Room Empty 상태 LiveKit agents에서 `ctx.connect()`는 agent를 방에 연결하지만, 이것만으로는 방이 "empty"가 아닌 상태가 되지 않습니다. pipeline_agent.py:34-35 실제로 agent가 방에 참여하려면 추가 단계가 필요합니다: 1. Agent Session 시작: `session.start()`를 호출해야 합니다 agent.py:93-106 2. 참가자 대기: 많은 경우 agent는 실제 사용자 참가자가 들어올 때까지 대기합니다 pipeline_agent.py:37-39 Empty Timeout의 작동 방식 `emptyTimeout`은 방에 Standard 참가자가 없을 때 적용됩니다. room.ts:159-164 Agent는 일반적으로 다른 유형의 참가자로 분류되므로, agent만 있는 방은 여전히 "empty"로 간주될 수 있습니다."
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!