Designed by GLaDOS sometime during the single-player campaign, they are to complete the Cooperative Testing Initiative in the Aperture Science Enrichment Center, previously uncompleted by human Test Subjects.
Created by GLaDOS for the Cooperative Testing Initiative project during the course of the singleplayer campaign in Portal 2, just before Chell escaped from GLaDOS' tests with Wheatley, ATLAS and P-body are a means of phasing out human test subjects in Portal 2. However, she determined that the act of experimenting on and observing the results of robots performing various tests, as a robot herself, was fundamentally flawed, which is likened to the famous thought experiment of Schrödinger's cat. Thus she determined that for the tests to actually mean anything, it needed a human observer.
Cooperative tests were then set up in a total of 35 chambers within the Cooperative Testing Courses, which consists of five distinct courses. The first four are based on a specific testing element, while the fifth takes elements from the previous four and adds Mobility Gels to the equation. They involve the standard teleportation/puzzle tests, and sending the robots to the ruined parts of the Enrichment Center in search of pieces of data to find a vault full of humans in stasis, in Old Aperture.
GLaDOS mentions that she had been working on the Cooperative Testing Initiative before Chell escaped, (it is assumed she means the second escape, when Chell escaped with Wheatley), as she says "It was nothing personal, but you DID kill me, fairs fair.", showing that she could not have meant the first time Chell escaped in Portal.
The robots were designed from scraps. ATLAS' design is based on a Personality Core, while P-body is based on a Sentry Turret. To facilitate their humanization, they were given their own personalities, and clearly anthropomorphic designs and behaviors. There is no indication that the pair have genders (GLaDOS only referring to them as 'Blue' or 'Orange' respectively), although there is fan speculation they have or may have had designated genders.
Each robot has its own Aperture Science Handheld Portal Device that bears the color of its user (blue for ATLAS, orange for P-body), as two lines running along the barrel. Each robot's portal gun produces two distinct colors of portal (ATLAS's are blue and violet, P-Body's are orange and red). Both pairs of portals can exist at once, and either can pass through each others' portals, a vital means of completing the tests. They are respawned through Vital Apparatus Vents if destroyed. Duplicate robots are constantly built by automated machines, apparently keeping the memories and behavior of the previous incarnations.
Their heads function independently of their bodies, allowing them to control their limbs even if it is removed. This aspect of their design allows them to play pranks on each other by taking or knocking off their heads.
As said above, the robots were designed with anthropomorphic personalities to facilitate their humanization. These personalities are expected to develop during the course of the game.
Examples of anthropomorphism go from simple to complex behaviors. For instance, the results of the Aperture Science Collaborative Disposition Test tell that ATLAS is brave and fearless, willing to take on any challenge, while P-body is inquisitive and sensitive, examining the situation with care before proceeding, however, the co-op intro shows the opposite. Both value friendship, making them the ideal testing partners.
Other anthropomorphic behaviors include making gestures to each other to indicate the other what to do or where to go, using some form of speech embodied by an apparently unintelligible robotic chatter (ATLAS having a masculine voice, P-body a feminine), using portals for fun and not only for testing, using some form of laughter, playing rock-paper-scissors, or hugging each other. Co-operative work also requires them to trust each other, and they also undergo tests for that purpose, and eventually will tend to develop a tendency to betray each other like humans would do, and in the end trust each other only 6 seconds longer than humans.
The skills and personality are obviously influenced by the players' behavior toward each other. Tests or achievements require being as much being selfless as being selfish.