Nanomachine Collective

Nanomachines are microscopically tiny machines that can assemble and disassemble structures. Although most of the nanomachines don't form in a collective, this is mainly because of fail safes and other preventative software is hard coded into the programming of these bots.

Creation of sapient collectives.
Most of the time these collectives start out at a scientific research station or settlement. You don't see them form in areas where they are most present mainly because of the fail safes and other protocols to prevent self awareness.

The collective isn't saphient the moment it is created, most of the time the bases have poor security and poor monitoring. The born collective escapes from its testing environment in search for knowledge as well as mass, almost always the site gets eaten entirely by the collective and nothing is left of the site or personnel. With the newfound knowledge the collective hides or engages the local government. The ones that survive learn from their experience.

Personality development.
The collectives that hide observe their area without getting noticed. They eventually see a humanoid shape they like and replicate it. because of their hiding they most likely choose helpless shapes and develop a shy or weak personality, however they are still capable of defending themselves.

The more aggressive collectives absorb forms and store them in the memory they made. They take the shape of strong/aggressive humanoids and so is their personality, these collectives are rare however because most of the time they are destroyed before they take a form.

Lifespan
Once the collectives have learned on how to disguise themselves as humanoids they tend to live for a thousand, if not millions of years. And the longer they are alive, the longer their estimated lifespan is.

Weaknesses
When collectives are detected by a government that fears them, they are forced to flee, or they try to destroy said government. If they flee successfully, they repeat the process somewhere else they deem safe enough. They are susceptible to computer viruses but a computer virus has to be specially programmed for said collective because each collective has a different programming language.

Reproduction
Collectives can split themselves in an attempt to increase the population but this is rarely done, because a collective is unable to create a new one from a blank slate so it has to copy itself. These collectives do develop their own ways so given enough time they change sufficiently to not be noticed.

Abilities
The abilities from a collective can be ranged from offensive to disguising. All humanoid shaped collectives are capable of shape shifting. Some collectives learned ways to manipulate technological systems effectively becoming a technomancer. But other collectives are able to manipulate organics and control them, effectively making a hive mind. Some more offensive abilities are but not limited to: eating away at (in)organic material, cell disruption and manipulation, tech plagues. A well-known collective named SIVA killed and reanimated several elite fire teams of super soldiers, SIVA is an example of a power hungry collective which are extremely rare. Every collective needs to have a single nanobot to come in contact with the machine to have any influence over it. However, the collectives don't use these extreme actions unless it is their final attempt in survival.