I think the Animated Objects in MM are just animated to attack, for example to guard a place.
It would be a very interesting idea to add a spell-like ability to such a creature, for example a single spell that the AO casts at will or every e.g. 1d4 rounds. If you write a monster which is the same as AO but with a high enough Int/Wis/Cha score you can do whatever you want, but IMHO it would require a very high-level spallcaster to animate such a creature. OTOH, you don't need to be high-level to craft a magic item which is used to cast a low-level spell, such as a wand of magic missile.
It would be very nice to come up with a simple system to give an AO the ability to cast magic missile*, or another simple spell suitable for the task the object was animated, does anybody know if Encyclopaedia Arcane: Constructs has any ruleset for something similar?
*in a repetitive way, such as "cast it as soon as someone enters, against the closest foe", so not to require an Intelligent creature to cast it. Essentially, just as an animated trap.