Skip to content

How to post-process cleanup at time of room completion? #2036

Description

@yuyuma

We're in amidst of migrating our v0 code to v1. Our use case involves a possible warm SIP handoff while removing the AI agent so we end up with a Human + Human interaction.

In v0, the shutdown hook that we register doesn't trigger at time of Agent removal. It only triggers when the room is removed by Livekit due to 0 participants or if we forcibly delete the room. This was desirable as we run some clean up code after.

In v1, the shutdown hook triggers when the Agent is removed from the room. This seems to be intended behavior based on the description here https://docs.livekit.io/agents/worker/job/#post-processing-and-cleanup. But as soon as this happens (e.g. when we have 2 human participants left in the room), we seem to lose all further control.

  1. Our ctx.room.on("participant_disconnected") hook ceases to be triggered when one or both of the human participants leave the room.
  2. The documentation at https://docs.livekit.io/agents/worker/job/#disconnecting-everyone implies that we can register a ctx.room.on("disconnected") hook to perform cleanup when the room is removed. I poked around (and might very well be wrong) but can't seem to find anything indicating where this is emitted in the agents framework and given point 1 above unsure whether it would fire even if implemented.

Would appreciate any guidance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions