Magey the Mage is in a very special situation.
Magey is on a D&D Gameshow! run by his DM, who is that special combination of smart, creative, and the physical manifestation of pure evil.
Here's the situation:
Magey is in a room with five Bags of Holding. Two of these mystery bags contain very little – a few gold, but nothing big. One of them has the amazing artifact Magey has been searching for for well over a year, in his grasp! But… the other two bags contain demiliches, who don't need air, so they're totally fine, unless someone very much like Magey opens their comfy little bags.
How can he discover what's in each bag?
A divination spell seems possible, but which one? Or an item, but what could let him see in? Or a 'Creative Uses of Game Mechanics' scenario (in the same vein as killing an enemy with the bag of sand in a Scholar's pack), but it would have to work.
What would reliably work to see what's in a bag of holding without first opening the bag?
Note that Magey can be any class that's convenient for solving the problem. The name is just because I imagined a spellcaster is most likely.
Best Answer
Just as you expected, divination spells are the way to go.