Set in the near future, an aging ex-convict and thief named Frank (Frank Langella) lives alone and is experiencing increasingly serious mental deterioration and dementia. Frank's son Hunter (James Marsden), an attorney with a family of his own, grows tired of making weekly visits to his father's home, but is reluctant to put his father into fulltime care, so he purchases a robot companion (voiced by Peter Sarsgaard), which is programmed to provide Frank with therapeutic care, including a fixed daily routine and cognitive enhancing activities like gardening.
Initially wary of the robot's presence in his life, Frank warms up to his new companion when he realizes the robot is not programmed to distinguish between legal recreational activities and criminal ones, and can assist him in lock-picking. Together, the two commit a heist in order to win the affection of the local librarian (Susan Sarandon): they steal an antique copy of Don Quixote from the library, which is being renovated and turned into a community center in the wake of declining interest in print media.
In the meantime, Frank's daughter Madison (Liv Tyler), who is away on a philanthropic trip in Turkmenistan, learns of the robot and returns to convince her father to get rid of the machine, which she finds ethically objectionable. Frank insists on keeping the robot, and they commit one last heist, stealing jewels from Jake (Jeremy Strong), the rich young developer at the head of the library renovation project. The police become involved and begin to question and monitor Frank, who maintains his innocence, feigning deathly illness so that Hunter will return to see him. In order to cover his tracks, Frank is faced with the decision of whether or not to wipe the memory of his robot, even as his own memory rapidly deteriorates.
Frank returns to the library where he discovers that the librarian is actually his divorced wife, whom he had forgotten. He then returns home where the robot convinces him to wipe his holographic memory, as he is not a person and his sole reason for existence is to help Frank. Frank is then sent to a 'Brain Center', where he receives help in coping with his dementia. The police do not recover the jewels that, as Frank explains in a note to Hunter, are hidden under the tomato plants in the garden that the robot made.