AI is only as good as the people who write the code for it. There needs to be a Asimov like set of laws written that precludes AI from harming humans in any manner like his:
The first law is that a robot shall not harm a human, or by inaction allow a human to come to harm. The second law is that a robot shall obey any instruction given to it by a human, and the third law is that a robot shall avoid actions or situations that could cause it to come to harm itself.
If we don't, it could end up like what happened to the Krell in the movie, Forbidden Planet. They built a machine that could materialize their thoughts, thinking it would create an Eden of sorts and be the pinnacle of their civilization.
They all synced in at night before going to sleep and ended up releasing the darkest regions of their Ids, destroying themselves overnight. We're about 1/3 the way right now thanks to the internet and its ability to close distances to almost nothing and now we're constantly bumping uncomfortably into one another.
A classic and prescient movie if there ever was one.
All the best,
Nonoise