 He was president of the village of Watertown in 1866, and town supervisor from 1865 to 1868.Elected as a Republican, Bagley was U.S. Representative for the twenty-second district of New York to the Forty-fourth and Forty-fifth Congresses.He was in office from March 4, 1875 to March 3, 1879.