Receive the latest entertainment-news updates in your inbox

President Obama, while introducing the reboot of “Cosmos” on Fox Sunday night, declared, “There are new frontiers to explore… there are no limits.”

He could have been talking about his own journey as a president venturing into unknown territory while logging more entertainment show appearances than any sitting chief executive in U.S. history. Obama's inspiring words about the power of possibility came barely 36 hours before he showed up online trading cynical barbs with Zach Galifianakis on the comedian's "Between Two Ferns" Funny or Die parody talk show.

Obama has displayed a sense of humor before, exchanging gentle one-liners with the likes of Jay Leno and David Letterman, and even "slow-jamming" the news with Jimmy Fallon. But the president's "Ferns" appearance plants him in riskier, unfamiliar terrain. Unlike the late-night comedy show hosts Obama has visited in the past, Galifianakis is playing an awkward character – an anti-social buffoon who asks idiotic questions.

"I have to know: What is it like to be the last black president?" Galifianakis asked Obama.

"Seriously? What's it like for this to be the last time you ever talk to a president?" Obama responded.

The president is clearly in on the apparently scripted joke. But he knows that might not matter to some who will see such banter as unseemly for the country’s leader, particularly amid the crisis in Ukraine and other woes. Obama, though, is betting that it’s worth chancing criticism to reach a young audience about getting health insurance through the Affordable Care Act.

The "Cosmos" and "Between Two Ferns" appearances, while vastly different in tone, share a commonality: Both are about Obama’s second-term agenda. The president has called for a manned mission to orbit Mars in two decades, a goal the host of the original "Cosmos," the late Carl Sagan, certainly would have lauded. Obama’s sitdown with Galifianakis proved more of a straight pitch to get young adults to sign up for healthcare by the March 31 deadline.

"Is your plug finally over?" Galifianakis scoffed.

The "Between Two Ferns" gig signals a new phase for Obama in his role as our talk-show-guest-in-chief. He played the late-night TV entertainment show circuit like no other sitting president during the 2012 re-election campaign. Now he’s using entertainment media to plug his programs while trying to secure his legacy.

He needs, though, to be careful that the focus on his legacy doesn’t turn on images of him teasing Galifianakis about his "three-inch vertical" or "The Hangover" bawdy comedy movie trilogy.

"It must stink, though, that you can’t run three times” for president, Galifianakis observed.

"If I ran a third time, it would be sort of like doing a third 'Hangover' movie," Obama said. "Didn't really work out very well, did it?"

The verdict is out on how Obama’s trip between the ferns worked out or whether he’s in for a political hangover. As the president tests the limits of mixing the Oval Office and comedy, catch the Obama-Galifianakis show above.