OSAKA, Japan — Before President Trump had even arrived for the Group of 20 summit in Osaka, Japan, this past week, he set the tone by attacking America’s closest allies, including the host country.

By the time he left for South Korea on Saturday, he had shared jokes with President Vladimir V. Putin about getting rid of journalists and about election meddling, surprised his aides with an overture to the leader of North Korea, and announced the resumption of stalled trade talks with China.

[Read more of our coverage on the G20 summit.]

Here are five takeaways from Mr. Trump’s dive back into international diplomacy.