Rinse the green beans under cold water, trim the ends off, and pat them dry with a paper towel.
In a mixing bowl, combine olive oil, garlic powder, onion powder, salt, black pepper, and red pepper flakes if using.
Add the trimmed green beans to the mixing bowl and toss until they are well coated with the oil and seasonings.
Preheat the air fryer to 400°F (200°C) for about 3-5 minutes.
Place the seasoned green beans in the air fryer basket in a single layer, avoiding overcrowding.
Cook the green beans in the air fryer for 8-10 minutes, shaking the basket halfway through for uniform crispness.
Once the green beans are tender and slightly crispy, remove them from the air fryer and transfer to a serving dish.
For extra flavor, consider adding grated Parmesan cheese or lemon juice before serving.