The AI will only use the spells when set to "Cast". If the caster gets into melee, he has a 50% chance not to fight but to cast spells nevertheless. Most times the AI chooses some short-ranged, high-damage spell.
Most prefered are area effect spells which kill own and enemies troops in similar numbers, and the caster as well if things work out really good
Only jokin', really ...
Had Abysia trying to assasinate one of my Pans lately - think it was even the national hero: Assasine stabbed the Pan (who had cast Protection etc.) with his poisoned dagger, the Pan retaliated with "Poison Toch". The Pan had more hit points and got away even without any affliction ...