First, if they are detained, they will be strip searched long before any torture takes place. You either take it early or not at all - odds are everything will be taken away.
Second, the last thing you want in such situation is ambiguity - people don't just commit suicide willy-nilly. Instructions must be very clear.
Thirdly, either the agent has secret information that cannot be divulged, or they don't. This is known upfront before the mission. Any agent at high risk of capture is kept away from sensitive information, to minimise possible damage. Every spy and reconnaissance organisation work like that. As soon as agent is captured, damage control is put in place.
Lastly, orders to commit suicide are not legally possible.