While trying to replace the yoke of my derailleur I made the mistake of using a multi-tool hex key that was not able to handle the torque necessary for the task and snapped while the head stayed inside. I tried using gravity, a magnet, shaking and all combined to make the head fall down, to no avail. I've no idea on how to proceed further and am really thinking of getting a new derailleur.
Option 1: You say you've tried a magnet; was it a regular ferromagnet or a rare earth magnet? It might be worth trying to extract it using a strong rare earth magnet. I have a pair of small ones that are about 15mm dia, that are strong enough to cause damage if they snap together with any part of you between them. I'd clamp the magnet in a pair of locking pliers first so it's easier to handle.
Option 2: (Only if option 1 fails) Tool steel is usually pretty hard, but you still might be able to drill it enough with a carbide bit to get a small screw or screw extractor to engage inside it and pull it out.
You could try using an angle grinder or Dremel or similar multitool or iron saw to cut a slot into the bolt in which you can insert a flathead screwdriver to remove the old bolt. Then replace it with a new one of the same size. Similar to the method of removing broken bolts (where the head has broken off and the thread are still in the part you want to save for example an engine block) where a slot is cut into the remaining part of the bolt (that is stuck) and this part is removed using a flathead screwdriver..
You could try gluing something (for example the part of the tool that broke off that is still attached to the multitool handle) to the part of the hex key that's stuck and wiggling it out.
Alternatively you could perhaps drill through the bolt ( drill size just a bit smaller than the bolt itself) and chase the threads with a tap of the correct size (when there's just a thin piece of the bolt left after drilling). I would advice center punching the bolt and drilling from the non-bolt-head end of the bolt (for easier centering).
Another option could be to put a tiny drop of CA adhesive (cyanoacrylate, aka "super glue") on the broken end of the hex key still attached to the multi-tool, and then touch that end to the broken end stuck in the socket. You'd want to be very careful with the amount, because if adhesive squirts out of the break then it could attach the broken piece to the socket even more securely. For that reason, I'd try this method as a last resort before replacing the derailleur.