Raphael Lagarde's late penalty looked to have won it for the home side, but Louw crossed the line in the 79th minute to put Bath back in front and Stephen Donald's conversion added the gloss to the scoreline.
The visitors fell behind in the third minute when Benjamin Petre scored a try for Agen and the accurate Lagarde converted.
Donald and Lagarde exchanged penalties as Agen extended their lead to 10-3, but Michael Claassens scored a crucial try for Bath just before half-time to make it 10-8 to the French side at the interval.
Another Lagarde penalty extended Agen's lead at the start of the second period before Kyle Eastmond crossed for Bath's second try to level the score and Donald's conversion nudged Bath in front for the first time.
Lagarde restored Agen's advantage and, although Donald crossed for Bath in the 54th minute, he missed the conversion and it threatened to cost Bath dear when Lagarde pulled Agen back within a point.
Lagarde's 71st-minute penalty gave the hosts a 22-20 advantage which looked like being enough until Louw's late strike maintained Bath's 100 per cent start to the group.
Gilbert has released a new line of rugby cleats. The Gilbert Virtuo 8S is part of the exciting new product. Check it out.
The entire All Blacks apparel line has been updated for 2013/14. Check out the New Zealand All Blacks polo.
The Nike Tiempo is a solid rugby cleat and one of few styles still made from full-grain natural leather.
The Gilbert Blitz 8S rugby cleat is a great cleat at a great price of $69.99. Get a new pair of cleats today.
A cool looking all black rugby cleat with the high performance adidas is known for. Get in the Gear!
Wear the crest of the British and Irish Lions on your t-shirt. A great look for the summer.
$29.99
The All Blacks Performance t-shirt is black with hints of blue from the training jersey. Very Cool.
The New Zealand All Blacks training jersey for 2013/14. Get in the Gear!
The USA Rugby Pro Alternate rugby jersey is perfect for any fan of the Eagles. Get yours to wear during the summer Test matches.
The NEW All Blacks 2013/14 jersey has arrived at World Rugby Shop. Dare to wear the colors of the All Blacks.