If you mean a long-running agent process, I’d start by logging memory growth over time and separating three things:
1. runtime heap / process leaks
2. accumulated conversation or tool-call history
3. persistent external state, like files/db/vector memory
A lot of “agent memory” problems are actually #2: the loop keeps carrying too much context forward. If you can checkpoint/summarize state and restart workers periodically, that’s usually safer than trying to keep one process alive forever.
What stack are you using?