“Why didn’t A.G. Sessions replace Acting FBI Director Andrew McCabe, a Comey friend who was in charge of Clinton investigation but got big dollars ($700,000) for his wife’s political run from Hillary Clinton and her representatives,” Mr. Trump wrote on Twitter. “Drain the Swamp!”

Andrew G. McCabe, a career law enforcement official, took over the F.B.I. after Mr. Trump fired James B. Comey, the bureau director, in May. Mr. McCabe’s wife, Jill, received contributions in 2015 for a State Senate run in Virginia from the state Democratic Party and a political action committee affiliated with Gov. Terry McAuliffe, who is a close friend of Hillary and Bill Clinton. Ms. McCabe lost the race.

By the afternoon, however, the White House seemed to have subtly moderated the tone, shifting to a more moving-forward message.

“He’s obviously disappointed but also wants the attorney general to continue to focus on the things that the attorney general does,” Sarah Huckabee Sanders, the White House press secretary, said, referring to the president. “He wants him to lead the Department of Justice. He wants to do that strongly. He wants him to focus on things like immigration, leaks and a number of other issues, and I think that’s what his focus is at this point.”

Asked why the president would criticize Mr. Sessions without firing him or asking for his resignation, Ms. Sanders said, “Look, you can be disappointed in someone but still want them to continue to do their job.”

Mr. Sessions, who has remained silent since the weekend, seemed to get the message. Anthony Scaramucci, the new White House communications director, said the attorney general was close to announcing an investigation into the intelligence leaks that have so angered Mr. Trump.

“I think he’s got a plan that he’s put together, and at some point, I don’t know if it’d be today, tomorrow or next week, he’ll announce that plan,” Mr. Scaramucci said on Fox News.