Once a UC agent is trained to execute take-downs and rescue operations, I believe they'll think tactically and will be inclined not to put themselves in certain situations. UC personnel who receive SWAT-style training will also know how to act if they're in a dangerous situation and must be taken into custody with violators or rescued from harm's way. Having photographs of the UC operative and meeting with the UC operative in advance to work out take-down signals and a rescue plan should be standard operating procedure for all medium to high-risk UC operations.
It's also important to cross-train SWAT personnel in undercover operations, so tactical officers can appreciate what the UC operative is going through when they meet with violators and subjects of an investigation. An undercover agent may be inside an air-conditioned bar or restaurant on a hot summer day, while their back-up team is outside for an hour. This isn't always as much fun as you would imagine.
SWAT cops are usually the personnel who are the most heavily armed, best trained and physically fit. Undercover agents usually carry the lowest quotient of firepower, don't have time to exercise as often as they should, dress like bad guys and tend to possess the supreme confidence that allows them to be good at what they do.
Undercover and SWAT personnel arrive from different ends of the law enforcement spectrum, and when they meet on-duty usually take down higher-risk violators. In one worst-case scenario, a tactical team could be called in to rescue a UC agent who has been taken hostage or isn't allowed to leave a secure location until the deal does down to the satisfaction of the bad guys.
If an undercover agent gets trapped inside a car or building with armed violators, the agent needs to know how to conduct themselves when a SWAT team takes down the violators to rescue the UC agent. For example, UC agents should be trained that when they hear a certain siren sound in the neighborhood, they'll know in advance that in 10 seconds a SWAT team will execute a dynamic breaching operation.