The entire country of Chile has a vested interest in the success of Ted Danson’s new Netflix comedy, “A Man on the Inside.” In the series, Danson plays Charles, a retired widower who answers a help wanted ad — and is then hired by a P.I. to embed in a retirement community and spy on its residents and staff.

From Universal Television, “A Man on the Inside” is based on the Oscar-nominated 2020 Chilean documentary “The Mole Agent,” which detailed the real-life version of this story. Danson’s character is based on the film’s central star, Sergio Chamy – who has since become a household name in his home nation.

Related Stories

“He’s a rock star,” says “The Mole Agent” director Maite Alberdi, who is now also an executive producer on “A Man on the Inside” through Micromundo Producciones. “He’s in all the commercials on TV. He shot a film with Amazon. And now, everybody is going crazy because Ted Danson is playing our star.”

Adds “The Mole Agent” producer Marcela Santibañez, who also is an EP on the new show: “I showed Sergio a picture of Ted Danson and I said, ‘This is the guy playing you.’ He’s like, ‘oh, that’s a very good copy!’”

Popular on Variety

It was “A Man on the Inside” EP Michael Schur’s producing partner Morgan Sackett who first watched “The Mole Agent” and suggested to Schur that it would make a perfect adaptation into a scripted series — with Danson, their “The Good Place” star, as the lead. “The Good Place,” which ended in 2020, tackled meaningful subjects like ethics, empathy and humanity — and “The Mole Agent,” which looks at human connections, particularly when it comes to aging, felt like the proper follow up.

Danson was immediately in. “In a little way, it’s almost a continuation, at least thematically or emotionally, of ‘The Good Place,’” he agrees. “Because it is about how to live a purposeful life right until the very end of life.”

Down in Chile, Alberdi and Santibañez had similarly believed “The Mole Agent” might lend itself to a scripted adaptation — but as documentarians, they didn’t think it would be right for them to do it themselves. “It was going to be weird to make a version of our own film,” Alberdi says.

That’s when they heard from Schur and Sackett — and things moved quickly from there.

“From the first meeting, they were very understanding of the sense of the film in a very profound way,” Alberdi says. “Their goal was to be respectful, and to work in the same tone, with the same topics that we have.”

Santibañez in particular, being a big fan of “The Good Place”, knew that it was the right fit. “[‘The Good Place’] had that amazing combination of being heartwarming, but also being a lot of fun and with humor,” she says. “When we were approached by them, I thought this is perfect. And then when they said that Ted Danson was gonna be Sergio, it was like, wow. That’s a dream come true. Like, who could be better than Ted Danson?”

The feeling was mutual. “I fell in love with it, and the lead of the documentary, Sergio,” Danson says. “Has such a sweet innocence about him. And he’s funny. Just the setup of an 80-year-old person trying to be a spy is inherently funny. And then instead of just following the evidence or the clues of why he was there, he starts to make everybody feel better about who they are, and in doing so, I think his life expands. It was a meaningful conversation about things that I’m at the right age to be talking about.”

The serendipity of “The Mole Agent” was that Alberdi and Santibañez originally set out to do a doc about a private investigator. But when that P.I. started working on the case of finding an older spy and embedding him in a retirement home, they switched gears and focused on the story of Sergio. It became a much more profound documentary, particularly about loneliness among older people.

That doesn’t sound like an obvious subject for a comedy, but Schur says he was drawn into that theme as well. “The most dangerous thing about aging sometimes is not an accident or a disease, but loneliness,” he says. “I read a bunch of articles about how loneliness is worse than smoking, in terms of what it does to your health at any age. And I think COVID really accelerated a loneliness epidemic in this country, especially for older folks.”

The premise, setup and main character were from “The Mole Agent,” but Schur knew he needed to flesh out the characters surrounding Danson’s Charles. On “A Man on the Inside,” the private investigator Julie (played by Lilah Richcreek Estrada) gets a more prominent role. And where we briefly see Sergio’s daughter in “The Mole Agent,” Charles’ daughter (Mary Elizabeth Ellis) has a regular presence here, as she reluctantly goes along with her dad’s ruse.

“I thought it would be very interesting to also examine a person in their 40s who has a father at that age, but also has her own career, her own kids, her own marriage and her own stresses,” Schur says, noting that he and his parents are at the exact same stage in their lives as Ellis’ and Danson’s characters.

After that, Schur says he wanted to make sure Charles’ fellow residents at the Pacific View retirement home — played by actors including Sally Struthers, John Getz, Margaret Avery, Stephen McKinley Henderson and others — were also three-dimensional.

“Ultimately what makes Charles — and Sergio in the documentary — come out of his shell and make his life bigger is he meets these people who have things to offer him, and he has things to offer them,” Schur says. “These were characters we spent a lot of time developing, and not just to be foils or suspects in the case. But they will be important people in Charles’s life, who could matter to him.”

Adds Danson: “Mike and the casting department hired some brilliant actors who were very nimble, and could go wherever the writing took them.”

Alberdi and Santibañez were also consulted throughout the process, visiting the writers’ room and set, and getting a chance to review scripts and rough cuts. “They were very generous with us,” Alberdi says.

The filmmakers were impressed with the callbacks to the film, and how certain elements were incorporated into the series. In “The Mole Agent,” Sergio infiltrates a retirement home named “San Francisco.” In “A Man on the Inside,” the entire series takes place in the city of San Francisco. Also, the older characters struggle with technology, and the recruitment process in the P.I.’s office comes directly from the doc.

The duo also shared some cutting-room floor footage of “The Mole Agent” with Schur, including a sequence where Sergio went through spy training. Schur ended up adapting some of that for Charles in the first episode as well.

The similarity in tone is what strikes the “Mole Agent” duo the most. Schur doesn’t shy away from dramatic moments in “A Man on the Inside,” very much like the original doc. “It’s going to be our instinct as comedy writers to end on a joke,” he says. “But sometimes we’re just gonna sit in the essential sadness of the situations we create, and it’s gonna be OK. We have to resist our impulse to turn everything into a lighthearted little moment. Some of the episodes are broadly comic, and some of them are much more serious.”

“We’re not gonna pull our punches when we’re talking about memory loss, when we’re talking about death,” Schur adds. “We’re not going to make it seem like it isn’t really sad, because it is. And I want the show, more than anything, to be honest about aging and memory loss and death. I want it to be fun to watch. I want there to be joy and happiness, but I don’t want it to seem false.”

In many ways, that’s similar to the balance of tone Schur struck in “The Good Place.” And for fans of that show, there are plenty of Easter eggs in “A Man on the Inside” — starting with Danson, of course. But keep your eyes peeled for other actors from that series (like Eugene Cordero), and even Charles’ room: 322, a number that frequently popped up in “The Good Place.”

Schur says he has plenty of stories in mind to keep “A Man on the Inside” going in future seasons. “The writers are already at work thinking about Season 2, if we should be so lucky,” he says. “I will keep working with this guy [pointing to Danson] and this team of people as long as I possibly can. As long as they want us to make the show, I will be making the show.”

That’s good news for Chile, as well. “I will love to see the numbers, because they’ll all waiting for the show,” Alberdi says. “There’s big expectations. Everybody’s counting down the days to see it here.”

More from Variety