Struggling actor Andrew Largeman (Braff) wakes up from a dream in which he apathetically sits on a crashing plane to a telephone message from his father (Holm), telling Andrew that he needs to return home because his mother has died.
Andrew leaves Los Angeles and returns home to New Jersey to attend the funeral. He recognizes the grave-diggers as old friends Mark (Sarsgaard) and Dave (Alex Burns), who invite him to a party that night. At home, his father gets Andrew a doctor's appointment for headaches he's been having.
Later that night, Andrew goes to the party where he meets up with Mark, Dave and Jesse (Armando Riesco), an old friend who has just earned a fortune after creating silent Velcro. After smoking marijuana and taking ecstasy at the party he still remains detached.
The morning after the party, Andrew proceeds to the appointment. In the waiting room, he meets a young woman named Sam (Portman), who is a pathological liar. She later explains that most times she does not know why she lies and will always admit to them afterward. In Andrew's meeting with his doctor (Ron Leibman), it is revealed that Andrew has been on lithium and other mood stabilizers, as well as antidepressants, for his entire adult life, but has recently stopped taking them. He also says that his father, who is his psychiatrist, put him on the medication. Andrew finds Sam outside the office and offers her a ride home. Sam invites him into her house, and he meets her mother, who inadvertently reveals that Sam has epilepsy. Andrew tells Sam of his mother's death, and Sam tearfully eulogizes her hamster. After returning home, Andrew's father confronts him and is insistent that they have a talk before Andrew leaves.
Later, Andrew and Jesse sit in the cemetery as Mark digs another grave. Andrew observes Mark stealing jewelry from the corpse he is burying. Andrew then returns to Sam's house, and the two spend the rest of the day together, joining his friends later at Jesse's mansion. Andrew tells her that when he was nine years old he pushed his mother in frustration, knocking her over a broken dishwasher in an accident that left her paraplegic; he says that his father blames him for his wife's paralysis and put him on his medications to "curb the anger" he supposedly harbors. Sam listens, and Andrew then admits his feelings for her.
The next day, Mark tells Andrew that he needs help "tracking down" a going-away present for him. Sam, Andrew, and Mark spend the day together, ending it in a quarry in Newark where Mark talks to a man named Albert (Denis O'Hare), who is employed in keeping intruders out of the quarry. The three visitors discuss the reasons for which Albert and his wife choose to live in the quarry. Albert explains that living there and exploring the quarry is "doing something that's completely unique, that's never been done before," mirroring an earlier speech by Sam. Finally, Albert explains that what actually matters is living with his family. Andrew is inspired by the conversation, and outside in the rain, he climbs atop a derelict crane and screams into the quarry, joined by Sam and Mark. He and Sam then share a kiss.
When Mark and Andrew look at the gift later on, it turns out to be Andrew's mother's favorite pendant, one of the items Mark stole from her grave, sold, and subsequently located. Andrew eventually talks with his father, and states that he was not to blame for his mother's accident and that he will live the rest of his life without medications. He forgives his father and says he wants to build a better relationship with him.
The morning after, Andrew says his goodbyes to Sam at the airport, while she begs him not to leave. He acknowledges that she has changed his life but that he still has to fix his personal problems before continuing the relationship. Andrew boards the flight, and Sam is left crying in a telephone booth. Andrew then returns, saying that he doesn't want to waste any more of his life without Sam. He wonders what to do next, and the two then kiss.
Output: Who originally put Andrew on medication?