What's the best way to end a session created from ...
# ask-ai
p
What's the best way to end a session created from cli using
console
command?
t
Thanks for reaching out, Mario. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! To wrap up a session created from the CLI, there's no direct
console
command like
lk end-session
, but don’t worry, you can still manage this smoothly: • Disconnect only the agent: You can use
ctx.shutdown()
right in the agent’s code to disconnect just that agent, while keeping the session alive for everyone else. • End the entire session: To close the session for all participants, you’d use the server-side API’s
delete_room
method. This can be added to your code or called through a custom endpoint. If you’d like me to walk you through any part of this or share some examples, just give me a shout—I’m here to help! Sources: Job lifecycle | LiveKit Docs | Inside a session | LiveKit Docs | Agents telephony integration | LiveKit Docs | cmd/lk/replay.go | src/app/api/stop_stream/route.ts