Agarwal made 86 and Pujara put on 58 for the second wicket after India won the toss and chose to bat first in Pune.
Paceman Kagiso Rabada took both wickets to fall.
He claimed opener Rohit Sharma -- who hit two centuries in the first game -- edging a ball into the gloves of wicketkeeper Quinton de Kock for 14 in the 10th over.
Rabada had Pujara caught by captain Faf du Plessis just before the break.
India skipper Virat Kohli then faced four balls without scoring. Pujara, who was dropped by Temba Bavuma before he scored, hit a six and nine fours.
Agarwal, who hit a double century in the first Test, took charge of the batting despite being hit on the helmet from a bouncer by debutant quick Anrich Nortje.
Agarwal went on to hit Nortje for three glorious off drives in one over before lunch. He completed his fifth Test half-century in his sixth match with a boundary off spinner Keshav Maharaj.
Victory for India in the series will see them beat the record of 10 straight home series wins they share with Australia.