What do you mean? Q 1. An AI to run a custom building? 2. A custom AI that builds and trains troops? 3. An AI to build towers in a tower defence? A 1. Easy unless building is very complex. 2. use the AI editor. 3. I dont think that is posiable.
I think you want 2. For that I first recomend you practice making normal melee AI using the AI editor. If you need more help with the AI just say.