 Section 4 of the 24th Amendment, which deals with this, requires the vice president and a majority of the cabinet to essentially, for all intents and purposes, have an in-house coup to send to the Senate and tell them the president is incapable of conducting the office. It's been invoked when presidents have had surgeries temporarily.