How to prevent agent session from closing when participants leave

This question originally came up in our Slack community and the thread has been consolidated here for long-term reference.

Is there a way to prevent the LiveKit agent from closing the session after all participants have exited the room for more than 30 seconds?

We need the agent session to stay active for at least 2-3 minutes.

Set the Room Configuration departure_timeout on the server side to control how long the room stays alive after the last participant leaves.

See the documentation: