Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions en/use/subagent.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,30 @@ Click the "Add SubAgent" button:
- **Assign Tools**: Select the tools this SubAgent can invoke.
- **Provider Override (Optional)**: You can specify different model providers for specific SubAgents. For example, the Main Agent could use GPT-4o, while a simple query SubAgent uses GPT-4o-mini to save costs.

## Delegation Tool Parameters

When the Main Agent calls a delegation tool (`transfer_to_<subagent_name>`), it can pass the following parameters:

| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `input` | string | Yes | The task description to be handed off to the SubAgent. Should be clear and concise. |
| `image_urls` | array | No | An array of image sources (public HTTP URLs or local file paths) used as references in multimodal tasks such as video generation. |
| `background_task` | boolean | No | Whether to execute as a background task. Background tasks run in the background and notify the Main Agent upon completion. |

### Image Parameter Example

The Main Agent can pass images when delegating tasks, useful for multimodal tasks requiring visual input:

```json
{
"input": "Generate a description based on this image",
"image_urls": [
"https://example.com/image.jpg",
"/path/to/local/image.png"
]
}
```

## Best Practices

- **Single Responsibility**: Each SubAgent should handle one category of related tasks (e.g., search, file processing, smart home control).
Expand Down
30 changes: 27 additions & 3 deletions zh/use/subagent.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,42 @@ SubAgent 编排是 AstrBot 提供的一种高级 Agent 组织方式。它允许

### 1. 启用 SubAgent 模式

在页面顶部开启启用 SubAgent 编排
在页面顶部开启"启用 SubAgent 编排"

### 2. 创建 SubAgent

点击新增 SubAgent按钮:
点击"新增 SubAgent"按钮:

- **Agent 名称**:用于生成委派工具名(如 `transfer_to_weather`)。建议使用英文小写和下划线。
- **选择 Persona**:选择一个预设的 Persona,即人格,作为该子 Agent 的基础性格、行为指导和可以使用的 Tools 集合。你可以在人格设定页面创建和管理 Persona。
- **选择 Persona**:选择一个预设的 Persona,即人格,作为该子 Agent 的基础性格、行为指导和可以使用的 Tools 集合。你可以在"人格设定"页面创建和管理 Persona。
- **对主 LLM 的描述**:这段描述会告诉主 Agent 这个子 Agent 擅长做什么,以便主 Agent 准确委派。
- **分配工具**:选择该子 Agent 可以调用的工具。
- **Provider 覆盖(可选)**:你可以为特定的子 Agent 指定不同的模型提供商。例如,主 Agent 使用 GPT-4o,而负责简单查询的子 Agent 使用 GPT-4o-mini 以节省成本。

## 委派工具参数

当主 Agent 调用委派工具(`transfer_to_<subagent_name>`)时,可以传递以下参数:

| 参数 | 类型 | 必填 | 说明 |
|------|------|------|------|
| `input` | string | 是 | 要传递给子 Agent 的任务描述,应清晰简洁。 |
| `image_urls` | array | 否 | 图片源列表,支持公开 HTTP URL 或本地文件路径,用于多模态任务(如视频生成参考图)。 |
| `background_task` | boolean | 否 | 是否作为后台任务执行。后台任务会在后台运行,完成后通知主 Agent。 |

### 图片参数示例

主 Agent 可以在委派任务时传递图片,适用于需要视觉输入的多模态任务:

```json
{
"input": "根据这张图片生成一段描述",
"image_urls": [
"https://example.com/image.jpg",
"/path/to/local/image.png"
]
}
```

## 最佳实践

- **职责单一**:每个 SubAgent 应该只负责一类相关的任务(如:搜索、文件处理、智能家居控制)。
Expand Down