Perhaps not all spacecraft. Can you imagine how boring it would be for an AI to be a deep-space probe? The poor AI would spend 15 years watching the solar wind instrumentation give an occasional twitch before the mad excitement of a planetry flyby. Then it's back to the big black - empty aside from some magnetic fields and the occasion charged particle or dust grain.
Though if AI's can be uploaded and downloaded by radio link, they could possibly "commute" to the spacecraft and "be it" in shifts. Or be sent up just before the critical segments of the flight. Although there, you'd be up against the (huge) volume of data an AI occupies and limited bandwidth.
In fact uploading AIs may be compulsory. Since rockets still can blow up, presumably it'd be unethical to ask the AI to be on-board when the mission launches, when there's the very real risk of destruction. Launching rockets with people involves a lot of extra expense to assure their safety. To avoid that with an AI mission, you could launch the spacecraft with basic, non-sentient housekeeping software and then send up the AI when the spacecraft is in space, has been checked out and is safely on its way.
But then, would you even bother with an AI for most missions, when old fashioned 'dumb' computers would be good enough? It'd be awesomely useful to have one as a planetary rover, assuming bandwidth allows you to send him her or ze* up because again, landing is too risky for it to be right to do it with the AI in-situ. Even if the mission did manage to recruit one that's a gung-ho, adrenaline-junkie** nutcase who'd be up or it.
Meh... no real point, just randomly thinking out loud.
* I think it's reasonable to assume that some AIs don't actually identify as being gendered.
** Whatever the AI equivalent of adrenaline is.