The invention relates to compounds of formula (I), useful for treating disorders mediated by the 5-hydroxytryptamine (serotonin) receptor IB (5-HT1B), vascular disorders, cancer and CNS disorders. The invention also provides methods of treating such disorders, and compounds and compositions . for their treatment.