# stop()

Canonical URL: https://developers.iagenify.com/sdk/ref/agent/stop/
Language: en

`agent.stop() → Promise<{ ok, stopped }>`

Asks the platform to end the run in progress. Without one in flight it answers that there was nothing to stop.

Status: one request · no-op when idle · signal is the other way

```javascript
const running = agent.run({ inputs, onStep });
setTimeout(() => agent.stop(), 30_000);
const result = await running;
```

## With nothing running {#idle}

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 {#versus-signal}

|  | 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 {#local-agent}

There the loop is in your process, so [stop()](/sdk/ref/local-agent/stop) is immediate and needs no request at all.

- [run()](/sdk/ref/agent/run): What it ends.
- [LocalAgent.stop()](/sdk/ref/local-agent/stop): The local one.

```python
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)
```
