What is the Secret Service's duty/obligation towards Trump?

I once ran into a former president in a restaurant in Bermuda. There were three or four casually-attired (but very obviously secret service) agents in the restaurant, but not hovering – if memory serves, they had a table nearby to sit at. And I believe he arrived in a two (maybe three) car “convoy”, presumably with other agents.

It generally resembled the other times that I have interacted with people who have protective details – nothing as extravagant as a sitting president.