Claude Code 中的子代理和网页搜索
Source: Dev.to
子代理(Subagents)
子代理可以在各自的上下文中并行运行任务。典型的使用场景包括:
- 文件搜索
- 代码探索
- 研究
并行任务
你可以让模型自动生成子代理(例如 minimax-m2.5、glm-5、kimi-k2.5),也可以显式请求它们:
spawn subagents to explore the auth flow, payment integration, and notification system
create subagents to map the database queries, trace the API routes, and catalog error handling patterns
触发子代理
- 自动 – 某些模型在检测到需求时会自然触发子代理。
- 手动 – 通过指示模型 “use/spawn/create subagents” 强制创建子代理。
网络搜索集成
当模型需要最新信息时,Ollama 会执行网络搜索并直接返回结果——无需额外配置。因此子代理可以并行进行研究并提供可操作的输出。
示例提示
research the postgres 18 release notes, audit our queries for deprecated patterns, and create migration tasks
create 3 research agents to investigate how our top 3 competitors price their API tiers, compare against our current pricing, and draft recommendations
支持的模型
minimax-m2.5:cloudglm-5:cloudkimi-k2.5:cloud
快速开始
ollama launch claude --model minimax-m2.5:cloud
祝编码愉快!