The character of Thanos gets defeated in the comics by a variety of factors and characters. It could be a powerful solo hero or a coordinated attack from a group of them.
Well, there are multiple instances and circumstances. It could be a combination of heroes or a single powerful character, depending on the specific comic arc.
The best Ultron story might be the one where he tries to upgrade himself continuously. He is always seeking more power and knowledge. He goes from one form to another, each time becoming more dangerous. His interactions with other A.I.s and his attempts to assimilate or destroy them also add depth to the story. For example, his encounters with J.A.R.V.I.S. in the MCU, where he tries to corrupt and take over J.A.R.V.I.S., lead to some really intense moments in the story.
The defeat of Ultron in the comics was no easy feat. It required the heroes to think outside the box, use their unique abilities in creative ways, and stay one step ahead of Ultron's ever-changing tactics.