Wash the beans and trim the ends. Bring about 2 cm of lightly salted water to the boil in a medium-size saucepan, and add the beans. Cook, covered, for about 8 minutes, or until crisp-tender. Drain, reserving 1 1/2 tblsp of cooking water. Return the beans to the pan and place over lowest heat.
Mix the eggs and vinegar in a bowl, add the reserved water, and beat the ingredients together with a fork. Pour the mixture over the beans.
Add the onion, garlic, salt and pepper, and stir until the beans are coated with the sauce. Serve warm.