Can you tell an agent when to leave the room in th...
# ask-ai
a
Can you tell an agent when to leave the room in the instructions?
t
Thanks for reaching out, Anne. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit offers a few handy ways to manage when an agent should leave a room: • Disconnecting the Agent: The agent can leave the room while letting others stay connected. You can do this easily by calling
ctx.shutdown()
with a reason. • Ending the Session for Everyone: If you want to wrap things up for all participants, just use the
deleteRoom
API. This will remove the room from the server and disconnect everyone. • Automatic Room Closure: The room will close on its own once the last non-agent participant leaves, which also disconnects any agents still there. If you'd like, I’m here to help with detailed steps on how to set any of these up—just let me know!