The relationships of Perry the Platypus.
Perry's superior is the leader of his division of the O.W.C.A. Major Monogram. Monogram himself gives a mission briefing nearly every episode to Agent P. When Perry is receiving his mission in his lair, he writes down notes, assumed as something which would help him during his mission. However, sometimes, he just draws his boss ("S'Winter"). Perry always does as he says, never failing to battle Doofenshmirtz or failing in general (though there are a few exceptions, such as "Phineas and Ferb's Quantum Boogaloo", which takes place in an alternate timeline; "That Sinking Feeling", where Perry loses, but Doofenshmirtz's plan fail anyway; and "Phineas and Ferb the Movie: Across the 2nd Dimension", "Phineas and Ferb Save Summer", and "Last Day of Summer", where Doofenshmirtz actually wins, but later regrets).
The Flynn-Fletcher Family
Perry's affection for his family is most obvious and very indicative when he had a nightmare that his 'pet' cover was blown and he is forced to lose the Flynn-Fletcher family and get a replacement. When Perry wakes up from the nightmare, Phineas reassures him that it was just "a bad dream", causing Perry to smile and go back to sleep ("Phineas and Ferb Get Busted!"). Perry's feelings for his owners are further showcased when he is faced with the prospects of moving to a new family in order to combat another evil scientist: he appears visibly shaken and sad. In the song "Come Home Perry", Phineas mentions that Perry is the color of a blueberry and is "kinda short and hairy". It is shown that Perry spends part of the night sleeping in Phineas's bed and at some point switches over to Ferb's so as to not show preference or play favorites with any one of them ("Oh, There You Are, Perry"). Also, he sometimes appears in the mornings on Candace's bed, even though it annoys her to no end. This may be because he's trying to give Candace a turn as well.
Perry is very protective of Phineas, as well as his family. If he is ever in danger, Perry will stop at nothing to save him ("Journey to the Center of Candace"). He was quite upset to be leaving Phineas and the family in order to work on a new nemesis ("Oh, There You Are, Perry") and when he turned himself in ("Phineas and Ferb the Movie: Across the 2nd Dimension").
To maintain his cover, Perry adopts the disguise of a "mindless animal" (normal animals) around people. During one of his missions ("Journey to the Center of Candace"), when Perry realizes Doofenshmirtz's plans will directly affect Phineas and Ferb, Perry takes decisive action to stop him immediately instead of following the spy routine (being trapped and then escaping) as usual. Perry's reaction indicates that he cares for the well-being and safety of the boys. The reason for this action may be that the boys provide Perry with more than just a cover, but also with affection. On another occasion ("Ready for the Bettys"), he follows the boys to guard them when they go on their own "mission" (however, he may have done so strictly on Major Monogram's orders). Perry has even allowed Phineas and Ferb to dress him in an extremely humiliating costume for their circus show and averts his mission temporarily to appear in his act ("Jerk De Soleil").
The only noticeable occasion where Perry has expressed anything less than affection for Phineas and Ferb was when they came back from their "mission" in his hovercraft. He caught the hovercraft in a tractor beam and turned it upside down, dumping the boys into Isabella's pool. ("Ready for the Bettys")
One of Perry's biggest instants of showing affection towards Phineas and Ferb was when they were pulled into another dimension with Doofenshmirtz. Perry exposes his true identity to the boys when the alternate Doofenshmirtz orders Perry the Platyborg to attack the boys, indicating that Perry is beloved family pet first, and secret agent second. Despite his cover being exposed and a one-sided argument with Phineas, he allows Phineas and Ferb to fight by his side when they are attacked by the other dimension Doofenshmirtz and trusts Phineas enough to be able to willingly plunge themselves to doom so Phineas could open another portal to another dimension. Towards the end, after the battle ends and everyone's memories are wiped, Perry uploads pictures he took of him and his owners and saves them to his lair computer with an emotional smile, glad to have shared such an adventure with them. ("Phineas and Ferb The Movie: Across the 2nd Dimension")
Perry is well aware of Phineas and Ferb's Big Ideas, and has suspected that they may one day be useful if there is ever a danger to the Tri-State Area that even he or the O.W.C.A could not handle, Perry used the same technology used to replicate Doofenshmirtz's Inator on hand to recreate the Big Ideas if Phineas and Ferb enter his lair and insert a key given to them by him. this indicates that Perry always trust Phineas and Ferb to help him if he needs it. ("Phineas and Ferb The Movie: Across the 2nd Dimension")
Phineas and Ferb have several projects featuring their pet platypus: an "inaction figure", a restaurant, a circus show, an animal language translator, machine to nurture what is thought to be Perry's egg, a Platypult, and a Perrytronic.
While Perry does not exhibit any different behavior around Candace than he does around other people, he does tend to appear beside her in unexpected and sometimes unwanted places ("Day of the Living Gelatin"). He seems to especially like her bed. Candace is easily annoyed by Perry's odor, or perhaps his sheer presence, as she repeatedly berates her brothers for letting Perry wander into her room (and later switched brains with her, thanks to Phineas and Ferb's invention "Does This Duckbill Make Me Look Fat?"). Perry has interrupted Candace's dream at least once by making his characteristic chirping noise on her bed, but this may have been with the intention of waking her up for her birthday. ("Candace Loses Her Head")
However, there are instances when Candace appears to be more friendly to Perry ("Traffic Cam Caper", "Mom's Birthday"). Candace is overwhelmed by feelings of guilt when Perry goes missing, as she has angrily put Perry outside the house after tripping on him the night before, then started moving his hand copying what Candace was saying ("Oh, There You Are, Perry").
Perry had saved Candace twice. One was when Candace had completely lost her mind under the belief that she was hallucinating and pushed an area self-destruct button with the intention of getting beef jerky from a vending machine, forcing him to flee with her. ("The Ballad of Badbeard") The other was when Candace accidentally triggered an instant-transport feature Phineas and Ferb installed on her cell phone and found herself on Easter Island. Upon learning of Candace's predicament, with Agent T helping out to spot Candace, he used the Pick-'em-up-inator to retrieve her. ("Candace Disconnected")
Perry's only negative reaction towards Candace was when Candace tripped over him. After getting yelled at by Candace, Perry comically mimicked her ("Oh, There You Are, Perry"). Perry also saves Candace from Doofenshmirtz's Evil Witch Castle in her dream ("Wizard of Odd"). On some occasions Candace sees Perry as Agent P, but later thinks that she is just seeing things and ignores it ("The Ballad of Badbeard", "Wizard of Odd"), with the obvious exception of her trip to the 2nd Dimension ("Phineas and Ferb the Movie: Across the 2nd Dimension"). As much of an inconvenience, it was for Perry when his body was switched with Candace's, he fought in her form exceptionally well. ("Does This Duckbill Make Me Look Fat?")
The mad scientist of Drusselstein, Dr. Heinz Doofenshmirtz, first met his nemesis, Perry, on the day he had his portrait taken. Perry had been spying on the mad scientist from across the street ("It's About Time!"). And even though Dr. Doofenshmirtz and Perry are archenemies, they share a soft side from time to time.
Agent P's job is to stop whatever evil scheme of Dr. Doofenshmirtz. Agent P always finishes his job nicely, leaving the doctor screaming "Curse you, Perry the Platypus!". It is unclear how Dr. Doofenshmirtz knows his platypus nemesis's pet name, "Perry". The doctor usually calls Perry "Perry the Platypus", not "Perry" and never "Agent P". The only times he has called Agent P "Perry" is when Doofenshmirtz tried to make a mountain out of a molehill ("At the Car Wash") ("Oh, sorry, Perry, I didn't mean to get all street there!"), when he tried to find Perry's address ("Hide and Seek") ("Oh, it will be so delicious to know where Perry lives!"), and when he tried to shoot an ice cream van with his Retire-inator ("The Bully Code") ("Oh, Perry the Platypus, have you come to sign my cast? Look, I saved you a spot right there, it says "Save for Perry").
Over time, they have become each other's frenemy. In some cases, after confronting Dr. Doofenshmirtz and evaluating the situation, Perry decides to help Dr. Doofenshmirtz with his not-so-evil plans. Notable examples include setting up a birthday party for the doctor's daughter ("Dude, We're Getting the Band Back Together") and pretending to be the doctor's pet ("Get That Bigfoot Outa My Face!"). Perry has agreed to help Doofenshmirtz go shopping ("Unfair Science Fair Redux (Another Story)"), wait patiently until the doctor finishes his creation ("I Scream, You Scream") and let the doctor control the giant dragon robot while Perry himself controls the Queen Elizabeth robot which the doctor deems not evil enough for him ("A Hard Day's Knight"). At one point, the doctor gave Perry a key to his apartment because he felt it was "more civilized than crashing through his ceiling" ("I, Brobot"). Dr.Doofenshmirtz even shared some of his chicken wings with Perry ("The Lake Nose Monster"). Also, Perry seemed to feel guilty and paid for a door he broke while busting in to Doofenshmirtz's lair ("Lights, Candace, Action!"). Perry also once joined Doofenshmirtz in his "evil" exercise show and even enjoyed it ("Candace Disconnected").
When Dr. Doofenshmirtz fails to impress his former Evil 101 teacher, Dr. Gevaarlijk, Perry offers him a smile of encouragement when the doctor asks if Perry thinks he is evil, implying he tries ("Oil on Candace"). However, when Doofenshmirtz's scheme isn't evil enough he asks Perry to "thwart his plan". Perry plays along after Doofenshmirtz starts becoming annoying. ("Perry Lays an Egg"). When it appears that Dr. Doofenshmirtz has turned good (he saves a cat), Agent P brings him the Standard Welcome Package ("Voyage to the Bottom of Buford").
The relationship has evolved to the point that when Dr. Doofenshmirtz replaces Perry with Peter the Panda as his nemesis, Perry is heartbroken and intends to quit his job at the Agency. Eventually, Doofenshmirtz starts to miss Perry as Peter is disassembling his freeze-inator ray while he's singing about his feelings ("It's About Time!"). Similarly, Doofenshmirtz reacts negatively when Perry is assigned to fight another mad scientist, The Regurgitator. Doofenshmirtz has gone as far as saving Perry from being destroyed by the Regurgitator, stating that Perry can be only his nemesis ("Oh, There You Are, Perry").
Perry always saves Doofenshmirtz from death, one example is when Doofenshmirtz made the Termite-Controlling Helmet. Later when Doofenshmirtz's fortress was going to explode, but Perry dived in and saved him ("The Magnificent Few"). Doofenshmirtz doesn't usually return the favor, as Perry is never near death. Another example of this was when Doofenshmirtz tries to save Mr. Fluffypants resulting in him falling off the building Perry dives after him stopping him and Mr. Fluffypants before they fall to the ground ("Spa Day").
At one point, Doofenshmirtz referred to Perry as a good listener and his best friend ("The Chronicles of Meap"). Perry has also helped Doofenshmirtz practice kickball and comforted him when he failed ("Thaddeus and Thor"). Doofenshmirtz had once held Perry and TV producer Jeff McGarland hostage and pitched them the idea of a series called Doof 'n' Puss, starring himself and Perry with hopes that he would become so famous that his fans would want to do his bidding. McGarland rejects the idea, and then eventually changes his mind, but suggests that the platypus needs to have a girlfriend. Perry smirks when Doofenshmirtz is offended by the suggestion, and Heinz refuses to carry on with the deal. Later, he watches a TV series produced by McGarland using his idea, but called The Platypus and His Girlfriend starring a fake Perry and a woman, and was receiving terrific ratings ("Nerds of a Feather").
Perry doesn't interact with Jeremy that much, but he seems to know him well; on the occasions that Jeremy visits The Flynn-Fletcher household (or whenever he sees Perry), he is always very friendly towards Perry ("Does This Duckbill Make Me Look Fat?", 'Misperceived Monotreme").
When Jeremy gave Doofenshmirtz a guitar lesson, Perry was forced to hide until Jeremy left so his cover wouldn't be blown ("The Lizard Whisperer").
Pinky the Chihuahua and Perry the Platypus are allies, as they are in the same agency, though in different divisions. Once Perry went to Pinky's lair by mistake since he entered by going inside one of Isabella's plants ("Day of the Living Gelatin"). They encountered each other when using the same elevator and they both tilted their hats to show respect to one another ("Bubble Boys," "Isabella and the Temple of Sap"). They also fought together during the 2nd Dimension Doofenshmirtz's invasion ("Phineas and Ferb the Movie: Across the 2nd Dimension") and in "Where's Pinky?".
Isabella petted Perry in "Rollercoaster" and again in Phineas and Ferb the Movie: Across the 2nd Dimension, brought a toy for him in "The Flyin' Fishmonger", and sung the "Come Home Perry" song with Phineas and Ferb. It is unknown if Isabella likes Perry the same as Pinky.
In "Happy Birthday, Isabella", Stacy witnesses Perry and Doofenshmirtz in battle and figures out that he's a secret agent. Perry shows her the O.W.C.A. pamphlet which lets her know that if anybody learns Perry's dual identity will have their memory erased. However, she convinces him not to on the technicality that she is not a member of the Flynn-Fletcher family.
Perry has shown a willingness to help Vanessa out if she needs or asks for it. The first time this is seen was at her birthday party. After helping Dr. Doofenshmirtz set up her birthday party, he watched as Vanessa chewed out her father for setting up a party meant for a little girl, not a teenager like her. In the process of defeating Doofenshmirtz, a large firecracker activated and nearly destroyed the entire room. Perry pulled Vanessa to safety under a table, and when the coast was clear, they came out just in time for her friends to arrive, proclaiming the ruined room "the coolest party ever." Vanessa credited both her father and Perry with setting it up, and Perry acknowledged this with a tip of his hat before leaving ("Dude, We're Getting the Band Back Together").
More recently, he has assisted her in concealing her relationship with Monty Monogram from her father. Although Perry was initially shocked upon discovering her interest in him ("Minor Monogram"), he has twice helped keep the relationship a secret. The first time was upon Vanessa's request; while on a mission at a coffee shop, Perry noticed Vanessa and Monty there and tried to disguise himself. She noticed him, however, and asked him to conceal the date from her dad; he agreed and wound up spending tireless minutes holding or placing objects between Doofenshmirtz and the couple ("Sipping with the Enemy"). The second time, at the Danville Doo Wop Hop, Perry managed to launch Doofenshmirtz's car into space just before he recognized the boy Vanessa was with ("My Sweet Ride").
Perry is shown to be enemies with Doofenshmirtz's rival Aloyse von Roddenstein (or Rodney for short), due to Perry's reputation of being a well-known agent of the O.W.C.A. and Rodney's reputation being a far eviler scientist than Doofenshmirtz. And unlike Doofenshmirtz, who seems to hold a complicated relationship with Perry, Rodney's conflict towards Perry is that of pure enmity. At one time, Perry defeats Rodney by sending a giant disco ball to fall on him and Doofenshmirtz, sending them (and the other villains) to the hospital. ("Nerdy Dancin'") Perry even helped Doofenshmirtz to get into the L.O.V.E.M.U.F.F.I.N. Summer Stock Festival Play by having themselves to storm into the stage, knocking Rodney off the stage since he was trying to steal Doofenshmirtz's role in the play. ("Road to Danville")
Perry also shares Doofenshmirtz's complete disgust over Rodney's plot to send the entire Earth into a new Ice Age with his new -inizor that will threaten billions of lives, deeming Rodney as a far more dangerous threat than Doofenshmirtz would've ever been. Knowing that the imminent cataclysm would endanger his host family as well, Perry personally helped Doofenshmirtz, Major Monogram, Carl, and Monty in destroying the -inizor to save the Earth and put Rodney into custody for his crimes.("Phineas and Ferb Save Summer")