By default, LiveKit automatically closes a room wh...
# agents
p
By default, LiveKit automatically closes a room when the last non-agent participant leaves (as documented: "By default, a room is automatically closed when the last non-agent participant leaves"). The issue I’m facing is that this also ends the entire agent session. What I’d like instead is to keep the agent active in the room, so if a user/participant reconnects within a certain timeframe, they can seamlessly rejoin and continue the session/conversation. Ideally, they’d be added back into the same audio processing pipeline without starting over.
c
I think this is what you want
Copy code
await session.start(
        agent=agent,
        room=ctx.room,
        room_input_options=RoomInputOptions(
            close_on_disconnect=False
        ),
    )
p
I already do that. I want to create more like sticky session.'
c
I'm not sure I understand, isn't that already the case if you leave and rejoin with that flag set to false i.e. the room remains active and the agent does not leave until the room idle timeout is exceeded
The timeouts are adjustable as part of room creation
p
The room and agent both remain active, but on the client side I need to request a new token to rejoin the same room. The issue is that the session ID changes each time. Do you know a workaround for this? Ideally, I’d like to use a custom session ID that persists on the server side—so when the client requests a new token, I can generate a fresh access token while keeping the same session ID along with the room ID or room name.
c
You can use the same token to rejoin the same room, they are not single use to my knowledge?
p
Is that so, let me test it. I remember doing that and it did't work. Let me confirm.
👍 1
I could rejoin, but the audio stream is not working!
c
sorry never seen that issue
👍 1
h
I have the same issue, under similar circumstances I can't reconnect