You need to use the AI Editor, there is a button for it in the World Editor. In it, you choose how the AI works in the first tab, then in second what heroes they use, but this is if they're a melee AI. In the third, what will they build, buildings, units and such, and how many workers will build what. And in the fourth tab, you create attack waves, you choose what units will attack when.