# stop()

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

`agent.stop()`

结束当前运行。 飞行中的模型请求被中止, 队列工具调不启动, 子试剂停止了 。

Status: synchronous · stops children · stopReason: stopped

```javascript
const running = agent.run({ message: "…" });

setTimeout(() => agent.stop(), 30_000);

const result = await running;     // stopReason: "stopped"
```

## 它可以做什么 {#what}

- 停止飞行中的模型请求 。
- 设置每步顶部的环读的标记 。
- 依次转弯发出队列的呼叫 回答 ” “ 被用户拦截 。 ” 而不是运行 。
- 停止所有子试剂

> **工具已运行完成**
>
> 正在执行命令, 正在写入文件, 已经在运行中的平行批次, 没有一个中途被中断。 停止是干净的, 不是即时的 。

## 停止的跑步从不重新尝试 {#no-retry}

重试和回溯逻辑检查:再次尝试与要求相反。

## 谈话是不停的 {#state}

停止之前的一切 都留在特工里 并且,在会话里,在账户上 `run()` 继续从那里继续。

## 倒带前停止 {#rewind}

`rewind()` 在一个运行中的代理扔 `agent_running`.先停止它——在写作时进行谈话不是尝试。

- [rewind()](/zh/sdk/ref/local-agent/rewind): 需要一个被制止的特工
- [执行循环](/zh/sdk/agent/loop): 国旗在其中。

```python
import threading

threading.Timer(30, agent.stop).start()

result = agent.run(message="…")    # stopReason: "stopped"
```
