Perry the platypus is a mild mannered pet for Phineas and Ferb. At first glance you would not expect Perry to do much, but sometimes he disappears and reappears mysteriously. This is becuase he is a secret agent working under the code name "Agent P" for the O.W.C.A., a spy organization that uses animals.
When Agent P is called to action, he will take one of numerous entrances to his secret room underground. These entrances can include stepping inside a Grandfather clock, jumping on a floorboard (though the first one he took put him into the house basement) and going up a hosepipe. When he has entered his secret room, a large TV screen will activate and show Agent P his boss, Major Francis Monogram. Monogram will usually give him his mission, which will most likely be "Stop Doofenshmirtz". Agent P will leap into action, taking his jetpack, hovercar, heliseat or moped to get to Doofenshmirtz Evil Incorporated HQ building, a large tower in the middle of Danville, or Doofenshmirtz Abandoned Self Storage. Perry will usually burst through a wall to get into the building and after that trapped by one of Doofenshmritz's numerous traps. Doofensmirtz will then appear and monologue about his latest "-Inator", an invention by him to either rule the world or get rid of something that annoys him. Doofenshmirtz will then try and activate the -Inator but before he can, Agent P will escape and fight Doofensmirtz and stop him using the -Inator properly. Usually the -Inator will then destroy the invention of Phineas and Ferb, just before Candace will show her mother what Phineas and Ferb have built. Agent P will then make his way back to his house and assume the role of Perry.