The bag of tricks description includes the following:
You can use an action to pull the fuzzy object from the bag and throw it up to 20 feet. When the object lands, it transforms into a creature you determine by rolling a d8 and consulting the table that corresponds to the bag’s color.
The creature is friendly to you and your companions, and it acts on your turn. You can use a bonus action to command how the creature moves and what action it takes on its next turn, or to give it general orders, such as to attack your enemies. In the absence of such orders, the creature acts in a fashion appropriate to its nature.
The creature that you pull from the bag can act on your turn if you use your bonus action to command it. But can it make opportunity attacks?
Since such as thing likely happens on the enemy’s turn, you won’t be able to command it to with your bonus action, and it says that it acts "appropriate to its nature" if you don’t give it orders, so can it make opportunity attacks if you do or do not give it orders on your turn (if that makes any difference)?