I am writting a real time game which contains Enemy AI I need write Enemy AI on server to send action( move, attack, .. ) to clients? or any way to do that? If i write Enemy AI on client? how to be authoritative enemy's actions?
Enemy AI is one of those things which should always be handled on the server.
Remember that anything which happens on the client can be manipulated by a hacked client. If you let the client handle enemies, the client can just claim that the ultimate raid boss just committed suicide and dropped the rarest item in the game.
But even if you assume that all your clients play fairly (you can't), that you can just slap an anti cheat tool on it and it will fix any cheating problems (it won't) or that you can detect cheating heuristically (will cause you more problems than it solves), you still need to deal with synchronization problems. What do you do if multiple clients fight the same monster and they come to different conclusions about how the fight turned out? Due to network latency, this is quite likely to happen.