You want to make them retreat?! I have enough trouble getting them to rush into battle and STAY there! I'm quite sure though that when the AI feels overwhelmed it retreats on its own, you'll notice you can assign the command ALLOWFLEE=TRUE/FALSE check it up in the command ref.
As for the game logic thing, yeah they should drop what they're doing and start following it, but I don't think its as simple as that, its been a while since I've done this stuff, but soon we should be able to help eachother out as my campaign devellops. I'll check this out since I'll probably be using something like that myself