If only it did. AI is designed to do what you tell it to, and that mostly works. But in the general case, AI does what it does, with no real guarantee of anything.