const running = agent.run({ inputs, onStep });
setTimeout(() => agent.stop(), 30_000);
const result = await running;import threading
threading.Timer(30, agent.stop).start() # stop() is safe to call from another thread
result = agent.run(inputs=inputs, on_step=on_step)With nothing running
It answers { ok: true, stopped: false } and makes no request — safe to call from an interface that does not track whether a run is in flight.
stop() and signal are not the same
| stop() | signal | |
|---|---|---|
| Tells the platform to stop | yes | no |
| Ends your request | when the run ends | immediately |
| The run may keep going | no | yes |
Aborting the request does not stop the work
The run continues on the platform, and anything it spends is still spent. Use stop() to end the work and signal to stop waiting — and when you mean both, call stop() first.
The local engine's stop is different
There the loop is in your process, so stop() is immediate and needs no request at all.