Probably eat anything threatening the owner and then follow him.
You can teach the critter the "Serve" trick from the animal archive to get other party members to give orders to the critter if this is a regular event.
Animals with the Defend command default to that unless ordered otherwise.
CRB p97 wrote:
Defend (DC 20): The animal defends you (or is ready to defend you if no threat is present), even without any command being given. Alternatively, you can command the animal to defend another specific character.