Not sure about commercially roasted beans but I’ve tried a roast within hours of roasting and can confirm they definitely benefit from some resting.
Unless you enjoy the taste of boiled grass I’d recommend giving it at least a couple of days!
3-5 days after roasting and it’s certainly enjoyable by that point.