async def stop_when_done(self):
        """This is a helper function that sends an EndFrame to the pipeline in
        order to stop the task after everything in it has been processed.

        """
        logger.debug(f"Task {self} scheduled to stop when done")
        await self.queue_frame(EndFrame())
This is a helper function that sends an EndFrame to the pipeline in
        order to stop the task after everything in it has been processed.

        
src/pipecat/pipeline/task.py