In this world, AIs are treated as people. Legally, culturally, ethically...

This includes their "Bodies." Now, what constitutes an AI's body? Depends on the AI. The easiest ones to define are the spacefaring ones - If an AI controls a ship, that ship is their body. If they're in control of a building, that building is their body.

It is possible for a ship to be damaged in such a way that would destroy the AI controlling it but leave the ship itself largely intact. Culturally, this is treated much like a human's body.

**What do we do with it?** Obviously, for something the size of a spacecraft, you can't just dig a hole and bury it. Cremation is also not an option. You can take devices and machinery from it and move it elsewhere, which is often done and is akin to organ donation for a human. Human dies, but their heart is good. Put it in a human that has a bad heart. AI dies, but they have a perfectly good thruster assembly. Put it in an AI that needs a new one. While, technologically, in this universe brain transplants are possible, there are better and easier ways to fix someone, and there's a cultural stigma against such a procedure as well, extending to the similar concept of putting a new AI in an older one's body. It has happened, of course, but it's infrequent and 'weird.'

With modern ships, we cut them up and scrap them, a process which is not given any sort of reverence for the ship being scrapped. There are places where ships are beached and people carve them up with blowtorches for the valuable parts, but the skin and rest of it is just left to rot. And when we demolish a building, it's usually accomplished by explosives and the resulting rubble is torn apart by heavy machinery.

The body of an AI would need some form of respectful disposal. The external body of an AI would generally be made of common materials that don't need to be recycled, but something needs to be done with the body, especially in cases of buildings. 

**For clarification:** AI deaths are rare. Being mechanical in nature, their parts can be replaced or repaired, often from beyond a point at which a human would be able to recover from, although they could still suffer from memory loss if enough redundancy was damaged. Generally speaking, an AI's death comes from catastrophic damage, such as weapons or industrial accidents. Building-based AIs are especially safe since they avoid a lot of the issues that arise from being mobile in a hostile environment.