Start by trimming the green beans and slicing your onions thinly. I like to keep the onions uniform so they cook evenly and caramelize nicely.
Heat olive oil in a skillet, add onions, and cook on medium-high until soft. Reduce to medium-low and stir occasionally for about 30 minutes until golden brown.
Toss green beans with olive oil, salt, and pepper, then spread them on a baking sheet. Roast at 400°F for 20-25 minutes, shaking the pan halfway for even browning.
Once the beans are roasted, fold in the caramelized onions gently. I always taste and adjust the seasoning with a bit more salt and pepper before serving.