The shooting happened around 4 a.m. as the agents were executing "high-risk" federal warrants related to a 2010 gang-related triple homicide.
The victims were taken to the hospital with non-life-threatening injuries. A witness at the scene said at least one agent was airlifted.
The suspect, who has not been identified, was taken into custody.
The 2010 incident involved drive-by fatal shootings in South San Francisco. Gonzalo Avalos, 19, Omar Cortez, 18 and Hector Flores, 20 - who police said were alleged gang members - were gunned down while walking with a group after four men riding in a brown Chevrolet Impala with tinted windows drove up and opened fire. Three others were also wounded in the 2010 shootings.
The Associated Press contributed to this report.