Hello Hitman. During heat waves insects, spiders and various other critters will go places they usually don't go, for survival. In the case of ants, they'll risk the colony a bit by going into a cooler environment that does not necessarily have enough food or shelter for the whole colony.
I displace invading creatures rather than kill them. Most often they follow a food source back outside.. but in a heat wave or heavy rain, they just need the shelter. So in that case I'd do as mentioned in a post above and follow the trail as best I could to the queen's den and carefully relocate it to the coolest spot outside I could find, and as far from my house as possible (near shade trees?).
It's a tough call.. some have no trouble at all mass killing invading insects, etc. I just don't see it as necessary most of the time if one is willing to do some work to help the little guys out a bit. They just want to live as long as possible. Same as us.