WASHINGTON — Barack Obama did not think Joseph R. Biden Jr. should run for president — he hardly needed to say it out loud for aides to understand that. The trick that summer of 2015 was finding a way to nudge Mr. Biden to stay out of the race without looking as if he was nudging Mr. Biden to stay out of the race.

[Election 2020: Obama endorses Biden for president in 2020 race.]

By the time that Mr. Biden began weighing a campaign, the president had long since concluded that Hillary Clinton had the best chance of winning in 2016. Beyond that, Mr. Biden was awash in grief over the death of his son, hardly the state of mind for a grueling presidential marathon.

But Mr. Obama did not want to push and sought to give his vice president room to come to the decision himself. Over the course of weekly lunches, he gently pressed Mr. Biden on his thinking. Eventually, the president arranged for his own strategist to deliver a daunting assessment of the odds against a race. Mr. Biden got the message. “The president was not encouraging,” he later acknowledged.

Those difficult days in the seventh year of their partnership illustrated just how far the two had come — and the limits of their alliance, as well. What started out as a Felix-and-Oscar odd couple bringing together a reserved, no-drama, new-generation intellectual and a gregarious, shoulder-squeezing, old-generation pol evolved into a surprisingly close friendship unlike any between a president and vice president in modern times.