Agent detection

Agent detection is the inclination for animals, including humans, to presume the purposeful intervention of a sentient or intelligent agent in situations that may or may not involve one.
Evolutionary origins.
It is believed that humans evolved agent detection as a survival strategy. In situations where one is unsure of the presence of an intelligent agent (such as an enemy or a predator), there is survival value in assuming its presence so that precautions can be taken. For example, if a human came across an indentation in the ground that might be a lion's footprint, it is advantageous to err on the side of caution and assume that the lion is present.
Psychologists Kurt Gray and Daniel Wegner wrote: 
Time-consuming steps, fast escapes and criticism.
Since it takes time to think of why a stimulus is present while simply reacting to it goes much faster, some evolutionary biologists criticize the assumption that agent detection would enhance the ability to escape predators as making a fast escape is of high importance to survive. These biologists state that simple reactions to stimuli that do not take a by-route over speculation about causes, such as running from the shape of certain footprints or a pair of eyes by simple reflex without even making a time-consuming association to a predator, would be selected instead by saving one step and therefore time. As a result, these biologists conclude that there are no specialized brain mechanisms for agent detection.
Role in religion.
Some scientists believe that the belief in creator gods is an evolutionary by-product of agent detection. A spandrel is a non-adaptive trait formed as a side effect of an adaptive trait. The psychological trait in question is "if you hear a twig snap in the forest, some sentient force is probably behind it". This trait helps to prevent the primate from being murdered or eaten as food. However this hypothetical trait could remain in modern humans: thus some evolutionary psychologists theorize that "even if the snapping was caused by the wind, modern humans are still inclined to attribute the sound to a sentient agent; they call this person a god".
Gray and Wegner also said that agent detection is likely to be a "foundation for human belief in God" but "simple overattribution of agency cannot entirely account for the belief in God..." because the human ability to form a theory of mind and what they refer to as "existential theory of mind" are also required to "give us the basic cognitive capacity to conceive of God."
According to Justin L. Barrett, having a scientific explanation for mental phenomena does not mean we should stop believing in them. "Suppose science produces a convincing account for why I think my wife loves me — should I then stop believing that she does?"