 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.He led the Buenos Aires patriots during the May Revolution, which ended with the removal of viceroy Baltasar Hidalgo de Cisneros from power.