How do you handle agent failures and implement error recovery?

Situational