You gotta admire the bots dedication, though. They can attack with 100 guys, yet that last 1 will still charge in, not giving a fuck.
So let's kill two birds with one canonshot:
Add X extra bots to each wave, and when <X bots remain, the bots retreat.
Could also do some mumbo jumbo coding magic that also considers the ammount of defenders left (10 guys will retreat from 25 defenders, but not 5).