# stop()

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

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

要求平台结束运行中运行。 没有运行中的运行者, 它回答说没有什么可以停止的。

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;
```

## 什么都没有运行 {#idle}

答案是: `{ ok: true, stopped: false }` 并且不提出要求——安全地从一个不追踪运行是否在飞行中的接口打电话。

## 停止() 和信号不相同 {#versus-signal}

|  | stop() | 信号信号信号信号 |
| --- | --- | --- |
| 告诉平台停止 | 否 是 | 无 无 |
| 结束您的请求 | 运行结束时, | 立即 |
| 跑步可能继续 | 无 无 | **否 是** |

> **中止请求不会停止工作**
>
> 运行在平台上继续, 任何支出都仍然用完。 使用停止( ) 结束工作并信号停止等待 。 当你同时表示, 请先拨打停止 ( ) 。

## 本地引擎的停停站不同 {#local-agent}

循环在你的过程中,所以 [( 停止)](/zh/sdk/ref/local-agent/stop) 立即提出,无需任何请求。

- [run()](/zh/sdk/ref/agent/run): 结束的结局
- [LocalAgent.stop()](/zh/sdk/ref/local-agent/stop): 当地那个

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