code: async def _async_stop(self):
          
          if self.presence:
              self.presence.set_unavailable()
          for behav in self.behaviours:
              behav.kill()
          if self.web.is_started():
              await self.web.runner.cleanup()
  
          """ Discconnect from XMPP server. """
          if self.is_alive():
              # Disconnect from XMPP server
              self.client.stop()
              aexit = self.conn_coro.__aexit__(*sys.exc_info())
              await aexit
              logger.info("Client disconnected.")
  
          self._alive.clear()
docs: Stops an agent and kills all its behaviours.