SANA, Yemen — After more than three decades of autocratic rule, President Ali Abdullah Saleh signed an agreement on Wednesday that immediately transferred power to his vice president, bowing to unrelenting street protests and raising hopes for an end to a political crisis that brought this impoverished nation to the brink of collapse.