The question to put to any critically acclaimed author whose last novel was a bravura restyling of "Hamlet" as told by a fetus must surely be: Where, artistically, do you go next? In Ian McEwan's case, the answer is not back to the recognizable past of three of his finest works, "The Innocent," "Atonement" and "On Chesil Beach," but into an alternative, counterfactual past, one in which history has turned out differently and the future has already arrived.

In "Machines Like Me," Charlie, a hapless, rudderless online trader, spends — or in his eyes, squanders — his mother's inheritance on Adam, the "first truly viable manufactured human with plausible intelligence and looks, believable motion and shifts of expression."

However, that buyer's remorse doesn't last long, for Adam proves to be a mine of useful information and a valuable help around the house. He is also an unwitting matchmaker, bringing Charlie and his neighbor Miranda closer together as they set about charging him, programming him and developing his personality.

But soon Adam triggers suspicions and creates problems. He tells Charlie that, according to his research and analysis, there is a possibility that Miranda is a malicious liar. Later, as Charlie strives to elevate his casual affair with Miranda to a deeper relationship, he suffers a setback when she swaps his bed for Adam's. Charlie tries to make light of Adam's feelings: "He cared for her as a dishwasher cares for its dishes." But when Adam declares his love for Miranda and begins to write her poems, the ménage à trois arrangement sours into a situation in which three is a crowd.

"Machines Like Me" isn't only about an outlandish love triangle. McEwan's busy plot also incorporates an unwanted child, a "wrongly kept secret," a death threat, and a quest for justice. In time, Adam's ruthless rationality and steadfast pursuit of the truth threatens Charlie and Miranda's vision of future happiness — which in turn leads to drastic decisions and desperate measures to prevent damage and take back control.

This is a novel which sees McEwan having enormous fun while also being deadly serious. His rewritten history is the best of times and the worst of times: In his version of 1980s London, Britain has just lost the Falklands war and the rise of machines has resulted in mass unemployment; the Beatles have recently regrouped and Joseph Heller's "Catch-18" continues to be read; JFK experienced near-death in Dallas, and pioneering British computer scientist Alan Turing has also lived longer and appears here as both Charlie's hero and antagonist.

McEwan has engaged with science before — most notably neurosurgery in "Saturday" and physics and climate change in "Solar." His world of artificial intelligence is chilly, clever and utterly credible. This bold and brilliant novel tells a consistently compelling tale but it also provides regular food for thought regarding who we are, what we feel, what we construct, and what we might become.

Malcolm Forbes has written for the Times Literary Supplement, the Economist and the Daily Beast. He lives in Edinburgh, Scotland.

Machines Like Me
By: Ian McEwan.
Publisher: Nan A. Talese/Doubleday, 333 pages, $26.95.