# 已完成完成完成完成完成

Canonical URL: https://developers.iagenify.com/zh/sdk/agent/events/done/
Language: zh

`{ type: "done", text, todos, usage, stopReason, model }`

运行结束。 它会包含运行返回的确切内容—— 同一对象, 发往回回调而不是呼叫者 。

Status: last event · same as the return · children's done is dropped

## 字段 {#fields}

```javascript
{
  type: "done",
  text: "I read the four notes. Two are unfinished: …",
  todos: [{ content: "Check the figures", status: "completed" }],
  usage: { credits: 31, turns: 6, toolCalls: 9 },
  stopReason: "end_turn",
  model: "gemini-3.5-flash"
}
```

| Name | Type | Requirement | Description |
| --- | --- | --- | --- |
| `text` | string |  | 模型写的最后文本。 不一定是答案——见 `stopReason`. |
| `todos` | array |  | 计划完成后就完成了 |
| `usage` | object |  | `{ credits, turns, toolCalls }` - 整个运行,包括分剂。 |
| `stopReason` | string |  | `end_turn` · `stopped` · `max_steps` · `budget`. |
| `model` | string |  | 代理商的模型。 对于哪个模型为特定转弯服务, 请读 [转转](/zh/sdk/agent/events/turn) 活动。 |

## 使用文本前读取停止站 {#reason}

> **max_steps 预算和预算留下未完成的念头**
>
> 运行结束, 其原本, 所以文本是任何模式 上写的—— 可能是中计划。 end_turn 意思是说完要说的话了

## 分剂的完成 从来没有达到你 {#children}

儿童在儿童事件发生时即会丢弃,儿童完成不是完成,而是监听儿童活动的一个界面。 `done` 其数字将更早地公布在 `task` 调打 `tool_end`.

## 两种形式 {#both}

```javascript
const result = await agent.run({
  inputs: "…",
  onEvent: (e) => { if (e.type === "done") render(e); },   // for the interface
});

console.log(result.stopReason);                            // the same object
```

## 使用时计算一切 {#usage}

转手、付费工具、压缩摘要和每个子剂所做的一切——预算总额也相同。

- [执行循环](/zh/sdk/agent/loop): 每一步中,各有一部分被排放。
- [预算](/zh/sdk/agent/budget): 上限的使用是对照上限的衡量。

```python
{
    "type": "done",
    "todos": [{"content": "Check the figures", "status": "completed"}],
    "usage": {"credits": 31, "turns": 6, "toolCalls": 9},
    "stopReason": "end_turn",
}
```

```python
result = agent.run(
    inputs="…",
    on_event=lambda e: render(e) if e["type"] == "done" else None,   # for the interface
)

print(result["stopReason"])   # the same stop reason, with text and model added
```
