iCloud container taking excessive disk space I have almost no disk space left on my MacBook Air.

Having run Disk Inventory X, one of the main hogs is the files under Users/MyName/Library/Containers/com.apple.cloudphotosd/Data/Library/Application Support/com.apple.cloudphotosd/services/com.apple.photo.icloud.sharedstreams/assets (assets contains several folders with gobbledygook names).

**The content here seems to be my iCloud Photo Sharing shared photos (ie. "Shared" in Photos), which is about 21.9Gb large.

I don't understand why this is the case, since my "Photos" folder (ie. library) is only 12.94Gb large (local storage is optimised, real library more like 52Gb).**

My MacBook Air early 2015 has the 120Gb storage and runs OS X 10.11.6

So, what is this folder mentioned above, why is it so large, and can I delete any of it without losing my Shared photos or the photos streams which I have been added to?
The iCloud files come down from the cloud, so you can't really delete a local copy as it will start downloading again. Instead, let's review the settings that control what data comes down. 

Ideally, you can turn off iCloud on the Air and let the OS delete all the content so you have space to work. (Bad things break in odd ways when the boot drive fills). 

Open iCloud preferences and under photos turn off either/or/both:


iCloud Photo library 
iCloud photo sharing 


The first will be your pictures existing only on other devices and Apple servers. The second is all of the shared photos that other people have shared with you and you have shared with other people.  I even know of some people who use iCloud photo sharing to share photos only with themselves because these photos don't count against the free 5 Gb storage limit.

You are correct that the folder you found is for shared photos. If you can't free up other space on the Mac - you can opt out of some sharing of images / movies that are large. I also find the optimize photo size option handy on mobile devices when I don't need the full resolution of photos in my local copy of the Photos library: