On the day Matthew Perry died, his live-in personal assistant gave him his first ketamine shot of the morning at around 8:30 a.m. About four hours later, while Mr. Perry watched a movie at his home in Los Angeles, the assistant gave him another injection.

It was only about 40 minutes later that Mr. Perry wanted another shot, the assistant, Kenneth Iwamasa, recalled in a plea agreement that he signed.

“Shoot me up with a big one,” Mr. Perry told Mr. Iwamasa, according to the agreement, and asked him to prepare his hot tub.

So Mr. Iwamasa filled a syringe with ketamine, gave his boss a third shot and left the house to run some errands, according to court papers. When he returned, he found Mr. Perry face down in the water, dead.

Mr. Iwamasa was one of five people who the authorities in California said this week had been charged with a conspiracy to distribute ketamine, a powerful anesthetic, to Mr. Perry. The defendants also included two doctors, a woman accused of being a dealer and an acquaintance who pleaded guilty to acting as a middleman.

Mr. Perry, a beloved figure who rose to fame playing Chandler Bing on the sitcom “Friends,” had long struggled with addiction. Court papers filed in the case shed light on the desperate weeks leading up to Mr. Perry’s death on Oct. 28 at the age of 54.