The risk is you give them the fuel to breed, creating more ants for the future.
Just keep donating piles and piles of sugar to the ants and leave the house for a week or go outside.
I also keep one or two of these on hand at all times: https://en.m.wikipedia.org/wiki/Cat#:~:text=The%20cat%20(Fel.... Very helpful for the handful of creepy crawlies that make their way in. The older model we have is incredibly effective. The one we purchased last year isn't as efficient unfortunately.