"Purpose in the Machine" is the second episode of the third season of ABC's Agents of S.H.I.E.L.D. and the forty-sixth episode of the series overall. It aired on October 6, 2015. It was written by DJ Doyleand directed by Kevin Tancharoen.
S.H.I.E.L.D. calls in Dr. Andrew Garner to evaluate Joey Gutierrez, a new Inhuman whom Agent Daisy Johnson wishes to add to her potential Secret Warriors team, for which Garner has not yet approved a member other than Johnson. Garner again denies the request, stating that Gutierrez needs time to adjust to his new reality before even being considered for a covert strike force.
Grant Ward, looking to rebuild Hydra, kidnaps the young Alexander Braun, a child of wealth whose ransom could support the now fledgling terrorist organisation. While being interrogated by Ward’s right-hand man Kebo, Braun fights back rather than submitting, and reveals himself to actually be Werner von Strucker, son of the previous Hydra leader. Ward, already having known this, explains that Strucker has proven his own strength beyond his name, and tasks him with infiltrating Garner's psychology class.
S.H.I.E.L.D. Agent Lance Hunter tracks down Agent Melinda May, who has been on leave from S.H.I.E.L.D. for six months and is looking after her father, who was injured in a car accident. Hunter hopes that May will help him find and kill Ward, and notes that she suspects that Ward was behind her father’s accident, but May is hiding from her life at S.H.I.E.L.D. and difficulties in her relationships with Garner and S.H.I.E.L.D. Director Phil Coulson. May is eventually convinced by her father that getting back into her S.H.I.E.L.D. life by going with Hunter is the best thing for her, and the two leave to infiltrate the new ranks of Hydra.
Agent Leo Fitz, who has been searching for his partner Jemma Simmons since she was apparently consumed by a Kree Monolith, realizes that the stone is a portal. S.H.I.E.L.D. enlists Asgardian Elliot Randolph, who had investigated the portal centuries earlier when it was used by some English Lords for ritualistic sacrifices. Randolph takes them to the ancient English castle of the lords, where a machine was constructed to open the Monolith using vibrations. When the machine falls apart due to age, Johnson uses her Inhuman abilities to replicate its vibrations, despite the portal causing her physical harm. Fitz enters the portal and finds Simmons on a barren planet, bringing her back as Johnson's power destroys the Monolith. Later, Simmons takes comfort with Fitz after a nightmare of her time on that planet.
- This episode scored 4.32 million viewers upon its initial airing.