My suggestion is for a command within the editor.
That an AI unit be given a command to break off.
We are fighting an enemy unit and normally nobody fights to the last man.
In combat, a unit be given certain criteria. When the criteria is reached the unit would attempt to break off and withdraw. If a second criteria is reached the unit would surrender.
The criteria could sit between 2 random points meaning the criteria would reached at a different point if the scenario is played over and over again.
I am presuming the scenario is Human v an AI opponent.