langchain/callbacks/comet_ml_callback.py/CometCallbackHandler/on_text
class CometCallbackHandler:    def on_text(self, text: str, **kwargs: Any) -> None:
        """
        Run when agent is ending.
        """
        self.step += 1
        self.text_ctr += 1

        resp = self._init_resp()
        resp.update({"action": "on_text"})
        resp.update(self.get_custom_callback_meta())
        if self.stream_logs:
            self._log_stream(text, resp, self.step)

        resp.update({"text": text})
        self.action_records.append(resp)