Agent error handling