I think it depends a bit on why you are taking it, if you are 5 to 10 kilos overweight or don't have a long term problem with obesity, then maintaining a good diet might work, without having to stay on glp's long term. Exercise is definitely good for you but there is not a lot of evidence it makes much difference to weight. It also would depend on how old you are and if you have other health problems. Any of hypertension, diabetes, pre diabetes, high cholesterol, heart disease, kidney disease, arthritis etc are good reasons to stay on it because they improve long term outcomes.
Assuming you have severe obesity or a lifelong problem, there is zero doubt that staying on them long term is a good idea. Losing weight is not the hard part, keeping it off is. In all the research I have read, with the exception of bariatric surgery 90 to 95% of people who lose significant amounts of weight through diet and exercise, put all or most of it back on over the next few years, even with expert help from multidisciplinary teams. And if you lose weight with glp's and then stop them the research says the same. Nearly everyone will gradually put the weight back on. Unfortunately self control is not an infinite resource, if you are having to consciously control how much you are eating with mental effort, it wears out eventually in nearly everyone no matter how much you don't want it to. There are not yet any very long term studies on glp's, I think 60 months is the longest , but they all show that if you stay on the dose that worked, then the weight loss is maintained.
A lot of people on here think that maintenance can be done with lower doses than were used to lose the weight, and that may apply if the weight loss was not massive or was still falling at a decent rate when you got to your target weight, but otherwise the maintenance dose is likely to be the dose that got you there. All the research on weight loss maintenance with glp's is at the final dose not at lower doses. The biggest problem with them for a lot of people like me, who are or were very overweight, is they are not quite effective enough yet, the best result being low 20% range from reta, and a lot of people want to lose more than that resulting in the experiments with multiple glps or other peptides. The drug companies seem to be looking into this as well, quite intensively, from what I have read, but apart from cagrisema, and a few early phase 1 and 2 trials, there are no results yet. But even 20% loss if you are 30 or 40 % overweight is still enough to make a huge difference to long term health consequences. And staying on glp's reduces the risks of most of the most common and serious health problems - cancers, heart disease, probably dementia and lots of others.