 He graduated as a lawyer from the University of Charcas, in Upper Peru.His cousin, Manuel Belgrano, introduced him to the public administration of the Viceroyalty of the Rio de la Plata.Along with Belgrano, Nicolás Rodríguez Peña, and Hipólito Vieytes, Castelli planned a revolution to replace the absolute monarchy with the new ideas of the Age of Enlightenment.