Silicon Valley
Credit: Eddy Chen/HBO

“We have to s— ourselves to death.”

For six seasons, the Pied Piper crew has worked to revolutionize the world of tech, and in the series finale of HBO comedy Silicon Valley, they finally did it… too well. Told through present day and the filming of a documentary 10 years in the future, “Exit Event” reveals that Pied Piper is so highly functional that it will eventually mean the end of privacy. Richard (Thomas Middleditch) realizes that he needs to destroy his own creation — and in dramatic fashion, to prevent anyone from ever attempting to recreate their work. And so, with an incorrect code purposefully substituted in, Pied Piper fails miserably, even bringing on “Ratmeggedon.”

But that doesn’t stop our favorite coders from going on to great things: Richard is the Gavin Nelson Professor of Ethics in Technology at Stanford, Big Head (Josh Brener) is Richard’s boss as Stanford’s president, Dinesh (Kumail Nanjiani) and Gilfoyle (Martin Starr) are next-door neighbors and co-founders of a cybersecurity firm, Jared (Zach Woods) dedicates his life to the elderly, Monica (Amanda Crew) works at a think tank that is definitely the NSA, Jian-Yang (Jimmy O. Yang) steals Erlich’s (T.J. Miller) identity and fortune, and Gavin (Matt Ross) goes on to write 37 adult romance novels. In the end, the Pied Piper crew reunites at the hostel for one last game of “Always Blue,” followed by Richard offering to show the correct Pied Piper code to the documentary crew (Silicon Valley exec producer Alec Berg, who wrote and directed “Exit Event,” serves as the interviewer). There’s just one maybe-not-so-small problem: Richard can’t find the thumb drive with the possibly devastating material (not seen: Richard surely subsequently vomiting).

EW chatted with Berg about the cliffhanger, Bill Gates’ cameo, and whether a return of T.J. Miller was ever an option.

ENTERTAINMENT WEEKLY: It’s not often that I get to talk to the writer, director, and star of a series finale at the same time.
ALEC BERG: Oh yes, of all the backs of heads you’ve seen this year, mine is certainly top 50.

You spent six seasons having these guys try to make Pied Piper into something special, and in the end they did too good a job and are forced to destroy it. How did you arrive at this ending, and why did it feel right for the show?
Probably two seasons ago we landed on what we thought was the area of the ending, which was slightly different from where we ended up. So for the last couple years we had sort of a landmark of where we were headed. And then this year, when we really decided that this was going to be the final season, we started steering in this direction. This is a slightly modified version of what we thought the ending was going to be. The whole show is a rumination on success and can you succeed on your own terms, and if you succeed on someone else’s terms is that really success? So the question that we just kept asking as we were writing it was, “What have these guys earned, and what do they actually want?” Not what they say they want — Dinesh says he wants a billion dollars — but is that really what he wants? It got interesting with characters like Gavin Belson. We were like, “Gavin Belson is the enemy and their rival, so we should punish him in the end, right? He should end up losing.” But then we started thinking about like, “Well, we don’t actually hate Gavin Belson, we kind of like him.” And we gave him an ending that was a punishment of sorts but not really a destruction, and we went through that with every character: what would end up making them happy in the end?

That’s where we landed with this idea of doing the documentary. It was a way of checking in with them 10 years later and seeing where they were and what they had gotten up to in their lives. When we expanded upon the idea of the documentary, we knew they were pretending to fail and that there was a public-facing story and a private story, so the idea of someone doing a documentary and not knowing the whole story seemed really interesting to us.

You mention trying to see what each character earned or deserved. Was there one future that was the hardest to nail down?
It’s a stupid thing to say, but you just listen to the characters. At a certain point, we knew that Richard wasn’t cut out to be running a billion-dollar cutthroat business. We spent six years showing his divide between being an artist and being a man of commerce, so it seemed pretty easy that what would make him happy in the end was the satisfaction that he accomplished what he wanted, which was to build this great thing, but then he ended up in a less cutthroat arena. We knew that Big Head was going to keep failing up. Dinesh and Gilfoyle — it’s this love-hate relationship with them, so wherever they ended up we knew they would end up together. And the thing that led us down the Jared path was one of Zach’s greatest improvs, when he improv’d something about his best friend Gloria’s granddaughter. So we knew that his best friend was old enough to have a granddaughter and he was friendly with much older people, so that seemed like a good area. And Monica, we floated this shadier side of her, so it felt like her ending up at the NSA seemed pretty appropriate.

You mention Jared’s famous Gloria line, and so often after that you managed to find a way to add weirder and weirder little details about him and his background. Was there one specific piece of information that you loved but you just could never get it in? Are some things even too dark for Jared?
The evolution of Jared was a great tennis match between the writers and the actor. [In] seasons 1 and 2, there were a lot more of these dark peeks behind how demented Jared was, and we picked up on that as writers. We would write to that and Zach would improv on top of it and it would go back and forth. Most of them were these little insights into the horrors that he had seen. There’s one in the finale that made me laugh, which was that he had a foster mother who thought he was the devil and tried to kill him and it must have been very traumatic for her. And there was another great one that might have made it in — this is the trouble when you edit shows and you don’t remember what ends up in the final product of any of these shows anymore — but there was one about him and Richard pairing up again and he said, “The dynamic duo are back together again: Batman and Alfred.” Even in his fantasy he’s not Robin, he’s the servant. He’s just the most aggressively beta of any character.

Another great one was the season finale last year when they were looking for Colin at the campground and they’re yelling, “Colin” and that guy said, “Hey, shut the hell up,” and Zach improv’d, “How’d you like to die today, motherf—er?” It was just out of nowhere, like you can see as docile and as helpful a character as he is, there’s an incredible rage in him. [Laughs] And that’s what made me love his version of that character — it’s so complicated and beneath the calm waters, there’s clearly a lot of turbulence and a lot of damage.

We joked about your cameo in the episode, but there are other special guest stars, including Bill Gates, who is maybe the biggest fish that a show like this could catch. Was that a long time in the making?
Yeah, he’s a fan of the show, which is awesome and very gratifying. We had been in touch with his people, and a couple of years ago we did a research trip to Seattle. We usually, before every season, go to the Bay Area, but one year just to mix it up we went to Seattle, and he was nice enough to sit down with us for an hour and shoot the s—. We talked about his experience and his thoughts about the show and what the guys would be up to and what we were missing. He was a very supportive and nice and generous guy, and so when it came time to do this episode where it would be completely suitable to grab him for 10 minutes as himself, not as an actor, it just worked out. We flew up and grabbed some stuff and he was great. We wrote three or four different lines for him and he had them all memorized and was a super pro about it. It’s funny, when we started doing all the documentary footage, we did these little improv runs with each of the actors and we were getting so much good stuff that I think it’s actually going up a week after the finale. There’s a standalone half-hour documentary that will be on HBO Go and HBO Now, so we got to use a lot more of that footage.

Was there anyone from the tech world that you just couldn’t make happen?
Marc Andreessen is a guy who has been a friend of the show since season 1. I remember when the first season started airing, there was a day where Marc Andreessen was just tweeting quotes from the show and it was kind of freaking us all out. So he’s a guy who we kept trying to figure something out with and it never worked out. We were dancing around Mark Zuckerberg for a little bit. Oddly, people who run gazillion-dollar businesses are busy.

Silicon Valley Season 4, Episode 4
Credit: John P. Johnson

Speaking of people who don’t appear, going into the episode, I had no expectations of seeing T.J. Miller pop back up as Erlich. But as the episode went on and Erlich’s name kept coming up, I was like, “Wait, is he going to show up?” Was there ever talk of actually bringing him back, despite how his exit went down?
No… [Laughs] No, there never was. But I like that people think he was going to pop up. That was kind of the design, to get people going, “Wait a minute, are we going to see him?”

So did it just feel like Erlich should still be a presence since he was once such a crucial part of the show?
Yeah, he was a major character for the first four seasons, so he’s still very much in the world of the show. I remember going through older footage to build the documentary footage and he was in all the old pictures of the company, so he exists in the lore of the show, in the same way that Peter Gregory [Christopher Evan Welch, who passed away after season 1)] does.

The episode — and series — ends with a cliffhanger of sorts as Richard is unable to find the thumb drive. What did you like about going in that direction? Was it your way of leaving the door open for a continuation in the future, or just more of a fun little thing for fans to theorize about?
I will be perfectly candid that we have no grand plan to return, but we were joking about it, like, “Oh, that’s the Silicon Valley movie, the search for the thumb drive.” We just like the idea that they create this doomsday device and then, in the end, Richard forgot where he put it. It just seemed like a funny place to end. But if it leads to something… look, I love this cast and I love this show, and if there were an opportunity at some point and it felt right to do more with them, I’d do it in a heartbeat. But there are no plans to do that, and that was not the design or seed of any new project…until it is!

Related content:

Episode Recaps

Silicon Valley
  • TV Show
  • 5
stream service