Magery Mastery changes the pet's spellcasting AI drastically, and gives them access to a wider variety of spells. They'll usually cycle between FS and E-Bolt until they run low on Mana, then they'll start casting lower level spells while mixing in a Mana Vampire to attempt to regain Mana. If the opponent has high Fire Resist, they'll use Mind Blast instead of FS (which is good damage with a high INT pet, like a Serpentine Dragon). They'll occasionally use Death Ray as well, but with the same restrictions as players. They can't move while channeling Death Ray, and if they take any damage during it, it interrupts the channel. If a pet repeatedly attempts Death Ray and keeps getting interrupted, it can suck down mana fast (initiating Death Ray is very mana intensive). They'll also Teleport a lot more frequently to the target, and they can cast Magic Reflection, which reduces their Physical Resist while increasing their Elemental Resists until their either re-toggle it, or are stabled.
Sadly, even with Magery Mastery, a pet's magic damage just can't compete with melee focused pets. 700 STR Chiv+AI pets put out far more consistent damage than even a Magery Mastery Serpentine Dragon (up to 1,040 INT) with 120 Magery/120 Eval/120 Med/120 Focus.