Cut the onion and fennel into long thin slices.
Heat the oil, then gently sauté the onion and fennel for 5 minutes under a lid.
Add the vinegar and stir for a couple of minutes, then add a splash of water and season with salt and pepper. Put the lid on and gently cook for another 5 minutes, until the fennel becomes tender and slightly caramelized.
Add the beans and a splash of water and warm through for a couple of minutes.
Stir in the dill, turn off the heat, cover and keep warm.
Meanwhile, cut the halloumi into 4 pieces, brush them with oil, then fry them on both sides in a non-stick frying pan until golden brown.
Cut the bagels in half (horizontally) and lightly toast them. Put the fried halloumi on the lower part of the bagels.
If using eggs, add a drop of oil to the frying pan and fry them to your liking.Or poach them in boiling water.
Spoon the fennel and bean mixture on top of the halloumi, then add the egg, if used.
Serve immediately.