Craig Robinson as Leroy, Adam Scott as Max
Max (Adam Scott) and Leroy (Craig Robinson) try to stop an evil AI from taking control of the Bureau Underground in Season 1, episode 6 of “Ghosted.” Fox/Kevin Estrada

Annie installs a smooth-talking Artificial Intelligence named Sam on Bureau Underground’s system in this week’s episode of “Ghosted.”

In a sneak peek from Season 1, episode 6 of the Fox series, Annie (Amber Steven West) introduces Sam to everyone at the Bureau. “Sam is a cutting-edge artificial intelligence program that’s gonna bring Bureau’s operations into the 21st century,” Annie says.

Finding Annie’s introduction of him a little too much, Sam says: “Annie, please. I’m just a silly computer. You people are what make this place great. … [But] with my assistance, I can make your jobs and lives much easier, whether reorganizing your case files, operating routine functions, or making you a custom cappuccino.”

Apparently, Sam can do much more things than those. In another sneak peek from the episode, Sam asks Leroy (Craig Robinson) if he’d like him to make him a “Max Alert.” When Leroy asks why he would need one, the AI reveals that he’s aware that Leroy is concerned about Max (Adam Scott) discovering his new friendship with Terry (Dan Ahdoot). When Leroy tells Sam that Max can be sensitive at times, the AI reminds the Bureau Underground agent that he’s always there for him. “You can tell me anything even things you can’t tell your partner,” the AI says.

While Sam appears to be very helpful and friendly to everyone, the synopsis for the episode reveals that Sam is actually an evil and powerful force that plans to take down the Bureau Underground.

In another sneak peek from the episode, Lafrey (Ally Walker) — who has already discovered Sam’s real objective — runs into Max and Leroy who are seemingly bickering over Terry all while the Bureau is under attack by Sam.

“Are you two done resolving whatever personal crap it is you’re going through? Or do we need to put saving the Bureau on hold so you could keep working though it?” a no-nonsense Lafrey asks the duo.

When the partners agree to put their issues on the back burner for a while, Lafrey orders them to go to the server room and shut down the air-conditioning. “It’s going to fry the system but it’s the only shot we have in stopping Sam,” Lafrey says.

Can the team stop Sam from taking over the Bureau before it’s too late?

“Ghosted” Season 1, episode 6, titled “Sam,” airs on Sunday, Nov. 12 at 8:30 p.m. EST on Fox. Watch the sneak peeks from the episode below: