I had to deal with something similar with a pair of players. A gnome riding in a minotaur's backpack in my case.
I ruled that No it did not grant cover because a cloth bag is not an obstacle to an AOE and AOE affect spaces not creatures.
We know full cover can only be provided by obstacles.
A target with total cover can't be targeted directly by an attack or
spell, although some spells can reach such a target by including it in
an area of effect. A target has total cover if it is completely
concealed by an obstacle. (PHB pg 196)
But we are never told what an qualifies as an obstacle, but we do know some things do not provide protection from AOE, total cover.
A target with total cover can't be targeted directly by an attack or
spell, although some spells reach a target by including it in an area
of effect. A target has total cover if it is completely concealed by
an obstacle. PHB p.196
SO total cover by itself is not enough something else must also be true.
If we look at the rules for AOE we get a confounding answer and a hint
A spell's effect expands in straight lines from the point of origin.
If no unblocked straight line extends from the point of origin to a
location within the area of effect, that location isn't included in
the spell's area. To block one of these imaginary lines, an
obstruction must provide total cover. (PHB. pg 204)
So at first you might say total cover does or does not protect you depending on which passage you read. but notice that AOE's hit locations and if the creature is in the location simply blocking line of sight is not enough. After all the creatures in the bag are in the same location as the creature carrying it, so if the carrier is not protected the creatures in the bag are not as well.
Clothes and armor which also reasonably block line of sight a character but don't protect you from AOE because you are standing in the location hit by the spell. Wearing a ghost costume or full plate armor would not make you immune to fireball so hiding in a bag does not either.
You see some thing similar for the section deterring cover on a grid, line of sight and cover revolve around the entire space occupied by the creature not just the creature itself.

I adjudicate it as: to protect from AOE, the thing between the source (point of origin) and target must provide a better barrier than armor or clothing, and must protect the entire square/hex/location you are in.
It would grant you concealment if you stay in the bag, and don't move around, it might even grant you cover depending on who you ask, but it does not protect you from AOE. Of course I could be wrong but without some better clarification that is what I ruled based on RAW, and not wanting players claiming standing behind a shower curtain protects them from dragons breath or the gust of wind spell.