Oh I just realized I forgot something else.
Your AI should only exist on the server. You don’t need it anywhere else. Only the server should know what the AI actually does and calculate that. You only replicate the results (aka units moving, creating a new building, etc).
The clients don’t need the logic that drives the AI itself.