make sure the spell have a condition that says to cast only if in combat. And any move you want the bot to do while stealth the make sure the condition is in place for the stealth buff. In advanced options there is a setting that allows the bot to skip moves in the rotation make sure this is not enabled. I cant remember exactly were the option is but there is another option that allow the bot to attack before being attacked. Make sure to disable this option so the bot doesnt start combat if enemy is near.