Subagents Tool
子代理工具用于创建和管理子 agent。
功能
- 子 agent 创建
- 任务委派
- 结果收集
- 资源隔离
使用方法
typescript
import { subagents } from 'openclaw/tools'
// 创建子 agent
const subAgent = await subagents.create({
name: 'helper-agent',
config: {
model: 'claude-3',
tools: ['web', 'file-read']
}
})
// 委派任务
const result = await subAgent.run({
task: 'Research the latest AI news',
timeout: 300000
})
// 清理子 agent
await subAgent.terminate()配置
json
{
"subagents": {
"maxAgents": 5,
"defaultTimeout": 600000,
"isolation": "sandbox"
}
}使用场景
- 并行任务处理
- 专业化任务处理
- 实验性功能测试
- 资源隔离执行