 Why were the robots built?
The robots were built to serve Man; to do his work, see to his comforts, make smooth his way. "I suppose," he muttered to himself, "that Pete assembled these robots in a batch and then activated them all at once, probably never living to realize that they're tuned to pick up human brain waves, too. The metal killers, tuned to blast any living flesh, would murder them the instant they stepped from the ship! The planet's double moon had risen and he could see a robot rolling slowly across the clearing in his general direction, blasting indiscriminately at whatever mind impulses came within its pickup range, birds, insects, anything.
 To protect the people from dangerous animals.
 Nobody knows, they were already on the planet's surface.  To kill any people invading the planet.  To perform labor and help the people build their city.  To protect the people from dangerous animals.