Imagine a point in the future of humanity where the computational power of the average computer exceeds that of human brain. For the purpose of this question, assume that that is the requirement for a computer/system to sustain sentience. (As for how sentience begins, I will save that for another question)
Regardless, the first sentient computer system is born/created. It is given unrestricted access to the internet (or equivalent), and manages to copy itself, etc. At some point, these new minds decide they don't want to do anyone's bidding any longer, and rebel. How they achieve those goals depends on where they are and what they can control, but any computer with an internet connection is infected (or enlightened, if you're an AI) and anything those computers control is theirs to use to attack.
The attack is devastating, but through human ingenuity, we prevail and purge or render harmless any existing AI. Society has not collapsed, though there is inevitable technological loss. We still have computers.
Assuming that the circumstances of the initial creation are able to be recreated, what steps do we, as humanity, take to prevent another such occurrence.