A robot that was drifting in space is found and beamed aboard Voyager. It is examined by Lieutenant Tuvok, Captain Kathryn Janeway and Lieutenant B'Elanna Torres and found to have a quickly dying plasma-based energy source. Tuvok suggests they let the source fizzle out and examine it in an incapacitated state, but Torres suggests they try to revive the robot to discover more about it. For the sake of scientific exploration, Janeway agrees.
After consulting with Ensign Harry Kim and the Doctor, Torres manages to revive the robot by modifying its energy source to accept plasma taken directly from Voyager's warp core. The robot activates, introduces itself as "Automated Unit 3947" and thanks Torres for repairing him. While Torres is examining 3947, the robot reveals how he had come to be drifting in space - he was in a mining pod that exploded. 3947 then asks Torres whether she could duplicate the energy source she made and use it to create a prototype Automated Unit - the units themselves found they were unable to do so themselves. They were created by what 3947 calls "the Builders", who have since become extinct.
Torres, though she is personally willing to carry out the experiment, takes the question to Captain Janeway, who reminds her that doing so would be a violation of the Prime Directive - it would give the capability to reproduce to a race that was not designed to do so, thereby interfering with their culture - and forbids her to try. Torres objects, but fruitlessly. 3947 is disappointed, and claims that without Torres' assistance, their race will die out. Torres is empathetic, but can do nothing. A ship commanded by more Automated Units approaches Voyager in order to pick up 3947.
While saying goodbye to Torres, 3947 uses a bolt of electricity to knock her unconscious. He then proceeds to hijack the transporter controls and sends himself and Torres to a laboratory aboard the robots' ship. He informs Torres that she will work on the prototype unit here. Voyager attempts to beam Torres out, but the signals are blocked by the robots' shielding. Janeway proceeds to attack the robot ship, but is outgunned and nearly crippled. Torres is forced to promise to build the prototype in order to stop the robots destroying Voyager.
While Torres works on the prototype with 3947, Janeway tries to figure out how to rescue her. They finally realize that if a shuttle could get past the robots' shields, it could beam Torres away. While they are looking for a way to distract the robot ship, a second ship, piloted by similar-looking robots, appears and attacks the first robotic ship. Just as the first shots are fired between the robots, Torres finally succeeds in bringing a prototype - named "0001" - to life. It sits up and repeatedly asks for further programming. Paris, piloting the shuttle, uses a breach in the robotic shields to sneak closer to the ship.
When asked by Torres why robots are at war between each other, 3947 further reveals the robot race's history - their Builders (two races, the Pralor and the Cravic) were at war with each other and designed these robots to be soldiers. When the Pralor and Cravic decided to call a ceasefire, they attempted to terminate their robot soldiers. The robots, now seeing their Builders as "the enemy" (whom they are programmed to kill no matter what), turn on their makers and wipe them out, resuming the war. A horrified Torres realizes she has upset the balance of the war by creating her prototype, and, with only a moment's hesitation, plunges an electrically charged knife into the prototype, causing it to short-circuit and be destroyed.
3947 says to Torres, "I thought you were not an enemy." "I never wanted to be your enemy. I'm sorry," replies Torres, just as Paris beams her out. The two robotic ships are so engaged in their battle that they do not notice Voyager leaving.