Personally I lost a ton of weight doing full-on keto (I specify, because some people just kinda cut out carbs) and then kept it off for over 2 years. But I put the weight back on after that, albeit slowly (over the course of maybe 7 years).
I've also done Mounjaro, and I can keep it off a while after I go off it, but not that long.
YES, you have to change your habits, maybe lifestyle, maybe deal with other issues in order to keep it off. But I think, not only is that difficult, it's not a "you did it and you're done" deal. It's easy to slip backwards, and I won't make any claims about you personally, but for anyone who's kept it off for less than a year, I think the good money would be on it coming back within another year. I doubt someone is "out of the woods" even two years on.