From mechanical comics to riffing robots, the integration of artificial intelligence and comedy have been attempted before, with varying degrees of success. The New York Times reported earlier this year about Piotr Mirowski, a senior research scientist who built an AI system called A.L.Ex (short for Artificial Intelligence Experiment) to help him do improv skits. He fed the system lines from various movies and programmed a neural network so that it would analyze what it heard and spit out a response. At first, the program didn't work so well, but after further collaboration with fellow researcher Kory Mathewson, A.L.Ex was able to at least stay on topic. Despite that, much of the comedy seems accidental, especially when it says things that are inappropriate or odd.

That sentiment is very much at the core of "Alexa, Improvise," which is the brainchild of improv team The Fun Room. Shortly after 8 p.m. that Saturday night, Alex Smith, the owner of said Echo, arrived on stage and said those exact words: "Alexa, improvise." The Echo beeped, flashed a blue ring light, but failed to respond. "She doesn't know how to do that," he laughed. "We'll be doing that part."

The Fun Room comprises Nemo Baker, Paul Booth, Vivian Chan, Brisa Freitas, Hans Fricke, Max Lelu, Alex Smith and Julia Szatar.

"This is a show about technology and how it doesn't always work as you want it to," Smith told the crowd. "But even when it doesn't, we'll roll with the punches."

"We knew we wanted something with universal appeal that was accessible to a non-improv audience," said Nemo Baker, who spoke on behalf of the team to Engadget. "We wanted to create something that a regular person who has no idea what improv is can come in and fully enjoy themselves."

Because the team is based in San Francisco and many of its members work for tech companies, they thought one particularly unifying topic would be tech. That idea came together while they were hanging out at a teammate's house, where there happened to be an Echo. They started asking Alexa random questions and were amused by the answers. The proverbial light bulb went off. "It came so naturally," Baker said. "We were immediately energized by the idea."

After several rehearsals, the team performed a pilot show of "Alexa, Improvise" to a soldout audience earlier this year at StageWerx Theatre in San Francisco. Since then, they've performed the show every few weeks at either StageWerx or Endgames Training Center South in the Mission District. Next year, they'll debut the show at Pianofight, a venue closer to Union Square, on January 17th at 9 p.m.

As a student of improv myself, I'll admit that I didn't know what to expect from an Alexa-based show. I had initially thought the team would simply be using the Echo for word suggestions that would then serve as a jumping-off point for the performance. But, it turns out, I had underestimated Alexa's comic potential.

"We introduce with short-form games -- think 'Whose Line Is It Anyway?' -- to warm up the audience," Baker said. "We have a variety of games that we play, most of which have some ways for us to randomly incorporate Alexa as needed."

At the show I attended, the team started off with a game called "Well, Actually," where the performers pretend to be experts on a yet-to-be-determined topic and then take turns yelling "Well, Actually" whenever they find an opportunity to correct someone. Baker introduced the game and asked for a topic suggestion from the audience. Someone yelled "Types of cars!" The first performer to step forward gave an over-the-top diatribe on how cars were the first automobiles ever made and then proclaimed that sedans were the most popular type.

Baker interrupted with a "Well, Actually," and then turned to the Echo. "Alexa, what are the most popular types of cars?" The Echo came to life, paused as if it was thinking and responded with "I'm a fan of electric cars," which obviously didn't answer the question at all. Baker ran with that, however, and loudly proclaimed, "Me too! Electric cars are the most popular types of cars!" eliciting laughter from the audience.

"When Alexa gets things right, it's fantastic," said Smith. "But when she gets it wrong, she gets it so very, very wrong."

The next game was called "Four Corners," wherein four improvisers formed a square and the scene changed as performers rotated in and out of the foreground. To start, Smith asked for an occupation suggestion from the audience. Someone yelled "nurse." Smith then said "Switch left," and the group rotated counterclockwise. This time, Smith asked Alexa, "What's your favorite color?" The Echo responded with "Definitely green," which is then the prompt for a new scene. He said "switch left" again, and those two players were given a location suggestion for "baseball diamond."

For the final switch, Smith asked Alexa to tell him "something interesting." It responded with: "Army ants are blind and need a pheromone trail to follow each other around. Sometimes they get lost and march around in a circle until they die." So those two people then pretended to be army ants, who lost their way and wanted to find friends. The result was an absurdist mish-mash of characters and scenes that were, in part, inspired by random Alexa facts.

While these shorter games are fun, the longer-form story format is where Alexa shines, explained Baker. "We begin by requesting a noun from the audience. We then ask, 'Alexa, read me the book [audience suggested noun].' Turns out, it doesn't matter what word you say, she will always start reading an excerpt from Audible!"

The audience-suggested word for the show I attended was "apple." The performers sat around the Echo as if they were school kids during story time, and Smith said "Alexa, read me the book 'Apple.'" The Echo responded with an Audible sample from Cracking the Tech Career: Insider Advice on Landing a Job at Google, Microsoft, Apple, or any Top Tech Company, launching into the opening paragraphs.

"Everything you've heard is true. Almost," it began. "Tech companies are known for brightly colored walls, ball pits in the office, free food (organic and gluten-free, of course) and shuttles transporting you to and from work. They're engaged in a constant game of one-upmanship, the latest and greatest company taking what its predecessor does and morphing it into something even better. With an obvious focus on technology, their engineering divisions are presumed to be filled with nerds who eat, sleep and breathe code."

Almost instantly the crowd broke out into heavy snickering, and at times, boisterous laughter. After all, technology is an all-too-real part of people's lives here in the Bay Area, and it's amusing to hear it glamorized in such a starry-eyed perspective when the reality is often the complete opposite.

The team then used that as inspiration for a few different scenes. In one, performer Vivian Chan pretended to be a programmer for Google who had spent the past five years trapped inside the campus with random former co-workers appearing in the walls, beckoning her to come out. In another, Smith and fellow improviser Max Lelu played a couple arguing about painting the nursery "Facebook blue" instead of the multiple colors in Google's logo. From there, more scenes emerged and more characters were born, each riffing off the others, all of which culminated in a grand and ridiculous wedding between Chan and a personified Google HVAC algorithm. (It's funnier than it sounds, really.)

Throughout the show, Alexa continued to be involved in different ways, depending on what the team is inspired to do. "As you can imagine, Alexa often gets confused or says something unexpected," Baker said. For example, at one point in between scenes, Smith asked Alexa to "Play the song 'Apple.'" Unfortunately, the Echo froze and didn't come up with anything. Smith quickly ad-libbed and suggested "Fuji" as a replacement (it's a type of apple, after all). Then it played an esoteric instrumental song that everyone swayed and danced to, and thus the team recovered itself from the Echo malfunction. After the show was over, Smith told me this had never happened before, theorizing that the Echo must not have played any music for "Apple" because it's also the name of an Amazon competitor.

"When Alexa gets things right, it's fantastic," said Smith. "But when she gets it wrong, she gets it so very, very wrong."

As Mirowski told the Times about A.L.Ex, robots can be antithetical to theater and comedy. "Theater is about the human expression on stage, and it's about the communication and empathy between the actors and the audience," he said. "Robots do not have the sensors to perceive any of that." Instead, Mirowski says that the AI is good at saying unusual and weird things that challenge the human improviser to work harder. When shows are a success, he said, they are more celebrations of human creativity than AI.

Though Alexa wasn't programmed to do theater in the same way as A.L.Ex, it appears that it has a very similar comedic effect. Much of the humor of the show comes from the human performers as they try to make sense of random facts and nonsense that comes from Amazon's servers. From a viewer perspective, it's brilliant. And from the performer's perspective, it's a deep well of inspiration. No longer do you just get a one-word suggestion to base a scene; you can get an excerpt from a book or an interesting fact about army ants.

When I asked if the team had considered other smart speakers, like Apple's HomePod or Google's Home, Smith said they did, but quickly discarded the idea. Siri just wasn't smart enough, and Google's Assistant doesn't really have a very sexy name. "Yeah, Google would probably have better answers," he said. "But 'Alexa, Improvise' sounds a lot better than 'OK Google, Improvise.'"