An Artificial Friend (AF) named Klara is introduced while on display in a store. She and another AF, Rosa, observe the outside world from the store window as they watch people and activities pass by. Klara is particularly fascinated by the Sun, believing it has life-giving properties essential for her well-being. The manager allows Klara and Rosa to move closer to the window, which gives them a better view of the outside world, including the Sun.
Klara observes various customers and their interactions as she learns from their behavior. She forms a friendship with Josie—a sickly girl who eventually chooses Klara to be her AF. Klara's primary function is to provide companionship and emotional support to Josie. Josie’s mother, known as the Mother, is concerned about Josie’s health and future. Klara becomes part of Josie's household as she observes the dynamics between Josie, her mother, and her friend Rick. Rick is a neighbor and Josie's closest companion. He is not "lifted," meaning he has not undergone genetic enhancements that many children in their society have, which limits his opportunities.
Meanwhile, Klara learns about the complexities of human relationships and emotions through her interactions with the family. Josie’s illness is a constant source of tension and worry. The family participates in "interaction meetings" to help Josie develop social skills, which highlights the artificial and pressured nature of these gatherings. As Josie's condition worsens, Klara becomes more determined to help her. Klara believes that the Sun has the power to heal Josie and formulates a plan to seek the Sun's special help. Her observations lead her to focus on the Cootings Machine she sees in a nearby barn. She becomes convinced that eliminating this pollution is crucial for the Sun to heal Josie.
Later, Klara learns from Mr. Capaldi that instead of simply mimicking Josie, she is expected to become Josie if the need arises. Despite Mr. Capaldi's assurance that the new Josie will be a continuation, the Mother remains distressed, especially after the failure with Sal. She questions the feasibility and her ability to accept such a replacement. Mr. Capaldi emphasizes that Klara's deep understanding of Josie makes her uniquely suited for this role. They drive away from Mr. Capaldi’s office to a quiet spot, where the Mother confides her fears and asks Klara for her commitment.
Klara’s faith in the Sun is rewarded when Josie starts recovering after a sunny morning. However, Josie and Rick grow distant from Klara as they move on to new social circles. After a few years, Josie grows into a healthy young adult with the help of the Sun's nourishment. Mr. McBain maintains the fields around the barn while Josie becomes involved in her college preparations. Rick now comes less due to his busy life and the increasing presence of his car. During a conversation with Klara, Rick reflects on their past as he expresses doubt about whether their love will remain intact.
Later on, Klara observes the orderly yet seemingly untidy Yard where she resides. A special moment occurs when the Manager, who once oversaw Klara’s development, visits her in the Yard. They discuss Klara’s past, Josie, and the nature of her service. The manager is pleased to hear that Klara is content with her placement and reassured that she did her best for Josie. Klara acknowledges that her role in Josie’s life was fulfilling.