Sabotage was loosely based on Joseph Conrad ' s novel , The Secret Agent ( 1907 ) , about a woman who discovers that her husband is a terrorist , and Secret Agent , based on two stories in Ashenden : Or the British Agent ( 1928 ) by W. Somerset Maugham .