Our Man In Havana is a 1958 novel by Graham Greene. It was adapted into a movie directed by Carol Reed.

In August, 1941, Graham Greene joined the Secret Intelligence Service (SIS or MI6). An interesting sidelight of Greene's tenure in the SIS is the story of "Garcia": A double agent in Lisbon, he fed the Germans disinformation, pretending to control a ring of all agents all over England, while all he was doing was inventing armed forces movements and operations from maps, guides and standard military references. Garcia was the inspiration for Wormold, a character in Our Man In Havana. Greene left the service in May 1944.

Warning: Wikipedia contains spoilers

The novel is set in the time before Castro in Cuba.

One day Wormold, a vacuum-cleaner seller, meets Hawthorne who offers him to work for the British secret service. Wormold lives alone (his wife left him because of another man) with his teenage-daughter Milly (real name Seraphina). Since he does not earn enough money to grant all his daughter's wishes, Wormold decides to take on the job. But James Wormold does not do his work the way he should: he deceives the secret service, inventing that people he only knows by sight are his "agents". He carries his reports to extremes by sending his clients in London a circuit diagram of a Hoover, telling them that this is a sketch of a secret rocket launchramp. In London nobody except Hawthornden, who alone knows that Wormold is a vacuum-cleaner seller, doubts this report. Nevertheless Hawthornden does not tell his boss about his doubts. To help Wormold the secret service sends him a secretary, Beatrice Severn, and other assistants.

Beatrice has to contact his "agent" Raul hence Wormold lies that Raul is on the way to take the required photos of the rocket launchramp. Wormold and Beatrice meet doctor Hasselbacher who invites them to his place. After a phone call Hasselbacher tells them that Raul had an accident and died. Later, the bewildered Wormold asks Hasselbacher where he knows about Raul from (who never was an agent). Doctor Hasselbacher tells him that the other side found out about his report and blackmails Hasselbacher to help them, otherwise they would make sure that he was deported from Cuba. So Hasselbacher cracked the bookcode (that is the way London and Wormold correspond).

Now Beatrice and Wormold have to save the other supposed agents because there was an assassination attempt on doctor Cifuentes (also a "spy"). Meanwhile, London finds out that the other side wants to kill Wormold during a trade association-meeting. They are going to poison him. There, Wormold succeeds to unmask the enemy spy, it is Carter who even kills doctor Hasselbacher. Now Wormold has to get the list of names of the other enemy spies. Captain Segura, who wants to marry Milly, is in possession of it. Wormold makes Segura drunken during playing checker. The captain falls asleep and Wormold takes his gun and a microscope photo of the list. He wants to take revenge on Carter and kills him at night with Segura's weapon. The Hoover-seller sends the photo to London but it is overexposed.

Hawthornden and the secret service find out about the deception. Beatrice who knows it too (Wormold and Beatrice are in love with each other) is summoned to London, as well as Wormold. In spite of his invented sketch he is decorated with "the medal of the British Empire". Wormold and Beatrice want to marry and Milly agrees.