OO Scale Latching Reed Switch 3 volt Battery Operated Flashing Red Tail Light Kit
1.8mm Red LED
You can either place the reed switch under the wagon with a magnet in the track (forwards over the magnet will turn the light on, reversing back over the magnet will switch it off), or you can place the reed switch in the roof of a wagon and pass a magnet over the part of the roof with the reed switch in.
Wiring diagram enclosed. Magnet not included.