Six months after the events of the first film, Neo (Keanu Reeves) and Trinity (Carrie-Anne Moss) are now a couple. Morpheus (Laurence Fishburne) receives a message from Captain Niobe (Jada Pinkett Smith) of the Logos calling an emergency meeting of all of Zion's ships. Zion has confirmed the last transmission of the Osiris: an army of Sentinels is tunneling towards Zion and will reach it within 72 hours. Commander Lock (Harry Lennix) orders all ships to return to Zion to prepare for the onslaught, but Morpheus asks one ship to remain in order to contact the Oracle (Gloria Foster). The Caduceus receives a message from the Oracle, and the Nebuchadnezzar ventures out so Neo can contact her. One of the Caduceus crew, Bane (Ian Bliss), encounters Agent Smith (Hugo Weaving), who takes over Bane's avatar. Smith then uses this avatar to leave the Matrix, gaining control of Bane's real body.
In Zion, Morpheus announces the news of the advancing machines to the people. Neo receives a message from the Oracle and returns to the Matrix to meet her bodyguard Seraph (Collin Chou), who then leads him to her. After realizing that the Oracle is part of the Matrix, Neo asks how he can trust her; she replies that it is his decision. The Oracle instructs Neo to reach the Source of the Matrix by finding the Keymaker (Randall Duk Kim), a prisoner of the Merovingian (Lambert Wilson). As the Oracle departs, Smith appears, telling Neo that after being defeated, he refused to be deleted, and is now a rogue program. He demonstrates his ability to clone himself using other inhabitants of the Matrix, including other Agents, as hosts. He then tries to absorb Neo as a host, but fails, prompting a battle between Smith's clones and Neo. Neo manages to defend himself, but is forced to retreat from the increasingly overwhelming numbers.
Neo, Morpheus, and Trinity visit the Merovingian and ask for the Keymaker, but the Merovingian refuses. His wife Persephone (Monica Bellucci), seeking revenge on her husband for his infidelity, betrays him and leads the trio to the Keymaker. The Merovingian soon arrives with his men. Morpheus, Trinity and the Keymaker escape, while Neo holds off the Merovingian's servants. Morpheus and Trinity try to escape with the Keymaker on the freeway, facing several Agents and the Twins, the Merovingian's chief henchmen. Morpheus defeats the Twins, Trinity escapes, and Neo flies in to save Morpheus and the Keymaker from Agent Johnson. In the real world, Zion's remaining ships prepare to battle the machines. Within the Matrix, the crews of the Nebuchadnezzar, Vigilant and Logos help the Keymaker and Neo reach the door to the Source.
The crew of the Logos must destroy a power plant to prevent a security system from being triggered, and the crew of the Vigilant must destroy a back-up power station. The Logos succeeds, while the Vigilant is bombed by a Sentinel in the real world, killing everyone on board. Although Neo asked Trinity to remain on the Nebuchadnezzar, she enters the Matrix to replace the Vigilant crew and complete their mission. However, her escape is compromised by an Agent, and they fight. As Neo, Morpheus, and the Keymaker try to reach the Source, the Smiths appear and try to kill them. The Keymaker unlocks the door to the Source, allowing Neo and Morpheus to enter and escape from the Smiths, but the Smiths kill the Keymaker while he tries to close the door to the Source. Neo enters a door and meets a program called the Architect, the Matrix's creator.
The Architect explains that Neo is part of the design of the sixth iteration of Matrix, designed to stop the fatal system crash that naturally occurs due to the concept of human choice. As with the five previous Ones, Neo can choose either to return to the Source with his unique code to reboot the Matrix and pick survivors to begin to repopulate the soon-to-be-destroyed Zion, or cause the Matrix to crash and kill everyone connected to it; combined with Zion's destruction, this would mean mankind's extinction. Neo learns of Trinity's situation and chooses to save her instead. As she falls off a building, he flies in and catches her, then by somehow phasing his hand into her body he removes a bullet from her body and restarts her heart. Back in the real world, Sentinels destroy the Nebuchadnezzar. Neo displays a new ability to disable the machines with his thoughts, but falls into a coma from the effort. The crew are picked up by another ship, the Hammer. Its captain, Roland, reveals the other ships were wiped out by the machines after someone activated an EMP too early, and that they found only one survivor afterwards revealed to be the Smith-possessed Bane.
Output: To prevent triggering the security system, what must the Logos do?