Emergency treatment for ventricular fibrillation includes cardiopulmonary resuscitation (CPR) and shocks to the heart with a device called an automated external defibrillator (AED) . Medications, implanted devices or surgery may be recommended to prevent episodes of ventricular fibrillation.