This is indeed a good question. There is not a magic way to find the best digital marketing agency. Well, you can choose to hire Neil Patel's agency or other super high-rated agencies. Still, in this case, you'll have to overpay as such agencies have higher rates.
I work with
crowdmark.net, and they have helped me a lot. Still, it doesn't mean that they are the best agency, or you will certainly get the best results.
I consider you should hire an SEO agency when you know what are you looking for. When you know how to measure the effect, and what works best for your niche, you'll be able to set clear and measurable goals for the agency you hire.