Days after being ousted by its board of directors, the artificial intelligence company announced late Tuesday it had reached an “agreement in principle for Sam Altman to return” as CEO.