Agent Stop Pilot
When a program says "cancelled," can a background worker still take action?
View project on GitHub ↗The file appeared after cancellation.
- A worker starts and waits for permission to proceed.
- Python acknowledges cancellation of the run.
- The test releases the worker. It writes a timestamp to a file.
What does Stop cover?
Imagine an assistant queues a message and you notice the wrong recipient. You press Stop. Will the message still go out?
For teams building agents, the practical question is where cancellation reaches. The main program can report that its run ended, while work it handed off may have its own rules. I wanted a way to check which actions could still happen.
A controlled pause
I ran three Python scripts on Windows using LangGraph 1.2.19. A worker had one harmless job: write the current time to a local file. A gate in the code let me control exactly when it could proceed.
Each script ran twice. In the normal trial, I let it finish. In the cancelled trial, the gate opened only after Python acknowledged cancellation. That ordering made it possible to tell whether the write happened afterward, even when both timestamps showed the same millisecond.
Timing changed the outcome.
All three normal trials wrote their files. In the cancelled trials, the difference was when the worker checked for a stop request.
- No check
- The worker wrote the file after cancellation.
- Check immediately before writing
- No file appeared by the two-second observation point.
- Check before waiting
- The worker wrote the file using permission it had checked earlier.
Follow the queued message.
My goal is a repeatable test that developers can run on their own systems. Next I plan to queue a harmless message for a local test inbox and record three events separately: the stop request, the acknowledgement, and any delivery.
The completed pilot tested software using a deliberately controlled pause. How often this happens in deployed agents, and which safeguards work across tools, remain open questions.
Explore the pilot repository ↗