# 并行执行

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

只有当每个用户都是阅读或子代理时, 才会一次一转拨。 任何可以询问用户的都一次一次运行 。

Status: read and task only · all-or-nothing per turn · subagents fan out

规则是故意直率的:发动机看 [类别](/zh/sdk/agent/permissions/categories) 轮流著,轮流著,依著著 **全部** 其中 `read` 或 `task`。在批次中写一个,整个转折顺序。

```javascript
// Parallel: three reads in one turn
read { path: "a.md" }   glob { pattern: "**/*.ts" }   grep { pattern: "TODO" }

// Sequential: the write makes the whole turn sequential
read { path: "a.md" }   write { path: "b.md", content: "…" }
```

## 为什么它无 - - - - - - - - - - - - - - - - - - - {#why}

> **无法对许可快速进行赛跑**
>
> 如果两次需要批准电话同时发出,用户将面临两次行动提示,其命令没有确定,批准一次将意味着批准另一个同时改变的状态。 运行这些电话是为了让每个电话都迅速描述一个实际真实的情况。

也让失败的故事简单化:在顺序转弯时,一个失败的呼声,接着是能够看到失败的呼声。

## 分剂是它付钱的地方 {#subagents}

`task` 平行的一组, 所以在同一转折中要求的多个子试剂 真正同时运行, 每个都有自己的上下文。 在那里, 长工会大大缩短。

```javascript
// The model asks for three in one turn — all three run at once
task { agent: "explore", description: "Map the data layer" }
task { agent: "explore", description: "Map the API routes" }
task { agent: "explore", description: "Find every TODO older than a year" }
```

父母的转圈加在父母的转圈上 `usage` 当他们被发生的时候,他们同同受刑罚者一样; [预算预算预算预算](/zh/sdk/agent/budget) 他们把许多动物,都咬着他们,他们的情状,是你们所认识的。 `onEvent` 带有 `parentId`,并且它们的识别特征与任务前置。

## 连续转转检查, 以在调用中停止停止 {#stopped}

每批接连呼叫前先进行截停检查,所以 `stop()` 平行批次已经在飞行中和完成中。

## 模型分批处理 {#encourage}

下 [系统快速系统系统](/zh/sdk/agent/system-prompt) 现有表格- `read { paths }`, `bash { commands }`一种独立的工具,一个转弯——因为模型本身不能产生这种工具。 每种工具调用需要一整圈,因此批量是运行成本最大的一个杠杆。

- [任务任务任务任务任务任务](/zh/sdk/agent/tools/task): 亚试剂工具
- [类别类别类别类别类别类别类别类别](/zh/sdk/agent/permissions/categories): 是什么叫读数?
- [执行循环](/zh/sdk/agent/loop): 一步就是一步,结束它。

```python
# The Python engine runs the calls of one turn in order, one after the other:
#   read {"path": "a.md"}   glob {"pattern": "**/*.ts"}   grep {"pattern": "TODO"}

# A write in the same turn simply runs at its place in that order
#   read {"path": "a.md"}   write {"path": "b.md", "content": "…"}
```

```python
# The model may ask for several subagents in one turn; Python runs them one after the other
#   task {"agent": "explore", "description": "Map the data layer"}
#   task {"agent": "explore", "description": "Map the API routes"}
#   task {"agent": "explore", "description": "Find every TODO older than a year"}
```
