公告
数据公告

QQ群和tg群已经启用,欢迎加入。公开信息来源均审核后发布;请结合来源、库存和更新时间判断。

社群与联系Telegram 群点击加入Telegram 频道点击订阅联系我们tgAIPricedb交流群979789483
返回资讯列表
product

Claude Code 可让同一会话中的 Subagent 使用不同模型

社区资料显示,Claude Code 支持通过 subagent 将任务分派给独立执行单元,并为不同 subagent 配置不同模型。这样可以让规划、代码执行和文档扫描分别采用更合适的模型,在能力、速度与成本之间取得平衡。

88% VERIFIED

多份社区资料称,Claude Code 的 subagent 拥有相对独立的上下文,可由主 agent 调度执行具体任务。自定义 agent 定义中可以设置模型,例如让 Sonnet 负责规划,让 Haiku 处理代码搜索、长文档摘要或其他简单任务。

这种架构也能减少主会话上下文压力,并让独立 agent 对主 agent 的结果进行检查。不过,模型选择取决于具体产品和版本,不能直接推广到所有 AI 编程工具。

相关 VS Code issue 则显示,VS Code 当前的 runSubagent 工具没有单独的 model 参数,子 agent 会沿用顶层会话所选模型。这构成了重要限定:同一会话多模型的能力在 Claude Code 中有社区证据,但在 VS Code 中并非现成能力。

来源证据

Claude Code 多 Agent 协作:Subagents 和 Agent Teams 怎么选?-腾讯云开发者社区-腾讯云cloud.tencent.com · supporting

Claude Code 自带三个内置 Subagent: Explore:只读权限,用 Haiku 模型。Claude 需要搜索代码库但不想改东西时自动调它,速度快、省钱 Plan:只读权限。你进入 plan mode 时,它负责在后台收集代码库信息,不会影响主线 General-purpose:全权限,处理需要同时探索和修改的复杂任务 这三个是自动触发的,不用手动指定。 #### 自定义 Subagent 内置的不够用可以自己写。一个 Subagent 就是一个 Markdown 文件,放到对应目录里: `.claude/agents/`:只在当前项目生效,可以提交到 git 和团队共享 `~/.claude/agents/`:对你所有项目生效 文件格式: 代码语言:markdown 复制 [...] `description` 字段很关键——Claude 就靠这个决定什么时候调这个 Subagent。写得越精确,触发越准。 #### 主要配置项 `tools` 控制这个 Subagent 能用哪些工具。只想让它做只读研究,就限制成 `Read, Grep, Glob`,它就没法动你的代码。只写了 `tools` 字段,没列出的工具就用不了;什么都不写的话,继承主对话的全部工具。 `model` 控制用哪个模型。支持 `sonnet`、`opus`、`haiku`、`inherit`(跟主对话一样)。搜索扫描类任务用 Haiku 省钱,写代码或审查用 Sonnet。 `permissionMode` 控制权限模式。`acceptEdits` 让它自动接受文件编辑,`dontAsk` 让它遇到权限提示自动拒绝,`bypassPermissions` 跳过所有检查。 `memory` 给 Subagent 一个跨对话的记忆目录。设 `user` 存到 `~/.claude/agent-memory/`,设 `project` 存到 `.claude/agent-memory/`,跑完一次它会自己往里面写东西,下次还能看到。 也可以通过 CLI 临时定义一个,不保存到文件: 代码语言:bash 复制 [...] #### 架构 一个 Agent Team 由三部分组成: Team lead:你在用的那个主会话,负责建队、分

Allow sub-agents to be invoked with a different model · Issue #310138 · microsoft/vscode · GitHubgithub.com · supporting

Steps to Reproduce: 1. Ask to do something with a sub agent. Tell the orchestrator to use a specific model from Microstoft CoPilot (no third party involved here) 2. Verify that the sub agent did not run with that model, it has only run with the same model launching the sub agent \_\_\_\_\_\_\_\_\_\_\_ AI writeup and suggestion \_\_\_\_\_\_\_\_\_\_\_\_ AI WriteUp for better understanding: ## Summary When the agent invokes a sub-agent via `runSubagent`, there is no way to specify which model that sub-agent should use. The sub-agent always inherits the model selected in the VS Code UI by the user. This prevents the agent from delegating tasks to a more suitable model (e.g. a cheaper/faster model for simple lookups, or a more capable model for complex reasoning steps). [...] ## Current Behaviour Sub-agents are spawned using the same model that was selected by the user for the top-level conversation. There is no `model` parameter on the `runSubagent` tool. Prompting the agent to "us

Claude Subagent 你用对了吗? | Johnson Leejohnsonlee.io · supporting

每个项目都抄一遍?不现实。 ## 从项目级到全局级 那怎么让这条规则对所有项目生效? 答案很简单:把配置从项目目录搬到用户目录。Claude Code 会先读 `~/.claude/CLAUDE.md`,再读项目级的。全局配置对所有项目生效,项目级配置可以覆盖或补充。 于是有了这个 PR——把 routing rules 和 worker agent 定义直接写在 `~/.claude/` 下。routing rules 告诉主 agent"大部分任务优先走 background dispatch",worker agent 定义让委派有地方落。 这里有个措辞上的细节:worker agent 的 description 里要写 "PROACTIVELY"。Claude Code 的调度逻辑会读这个字段来决定是否主动委派。不加这个词,agent 只是"可用"但不"主动"——相当于雇了个人但从来不派活。这跟在 job description 里写"主动推进"还是"配合完成"一样,措辞决定了角色是找活干还是等分配。 顺手再设一个 `CLAUDE_CODE_SUBAGENT_MODEL` 环境变量,主 session 跑 Opus、subagent 跑 Sonnet,推理能力和成本各取所需。 这套从项目级到全局级的配置体系,本质上是在构建 AI 工具链的 convention——跟在团队里推 code style、commit convention、CI pipeline 一个道理。convention 建立了,每个新项目直接继承,不需要从零开始。 ## 几个坑 ### 后台无法交互 后台 subagent 不支持交互式确认。涉及文件写入的任务,Claude Code 会在启动前统一问你授权。忘了给权限,它会卡住。 ### Prompt 必须自解释 [...] # Claude Subagent 你用对了吗? Johnson Lee Get into trouble, make mistakes, fight, love, live 首页 归档 标签 关于 订阅 # Claude Subagent 你用对了吗? Mar 2, 2026 | Independent Thinking | 1.4k 字 | 5 分钟 之前聊过,AI 的工程

拆解 Claude Code SubAgent:隔离、专业化与权限设计 - knqiufan - 博客园cnblogs.com · supporting

`disallowedTools` Explore 和 Plan 的分工边界是:Explore 搜完就交结果,Plan 搜完还要分析、权衡、给建议。找函数在哪用 Explore,搞清”加这个功能要改哪些文件、按什么顺序改”用 Plan。 ### General-purpose(什么都干的全能选手) Explore 和 Plan 都被硬性禁止了 Edit、Write 等工具,但 General-purpose 没这个限制。`tools: ['']`,即父 Agent 有什么它就能用什么,这是它跟 Explore/Plan 的根本区别。搜索和规划是只读的活儿,而 General-purpose 要真刀真枪改代码。 `tools: ['']` 系统提示很短,两段话完事: Given the user's message, you should use the tools available to complete the task. Complete the task fully — don't gold-plate, but don't leave it half-done. 意思是把活干完,别画蛇添足,但也别半途而废。 General-purpose 适合的场景是那种连贯的多步骤流程:先读代码定位问题、再改代码、再跑测试验证。比如”修复认证模块的登录 bug”这种任务。 模型字段故意留空,由 `getDefaultSubagentModel()` 在运行时决定,是跟着会话配置走的。 `getDefaultSubagentModel()` ### Claude Code Guide——产品文档专家 [...] `getDefaultSubagentModel()` ### Claude Code Guide——产品文档专家 Claude Code 还有一个不太起眼的内置 SubAgent:claude-code-guide。当你问”Claude Code 怎么配 hooks?”、”Agent SDK 怎么用?”的时候,Claude 会派它去查官方文档。 它的工具是 Glob、Grep、Read、WebFetch、WebSearch。Haiku 模型,dontAsk 权限(不弹确认框)。干活流程是先抓 `code.claude.com` 和 `

Claude Code 更新 2.0.28 subagents 可以切換模型了! 代表 plan 跟 execution 能更好分離出來 讓 plan 的 subagent 用 sonnet 讓 execute 的 subagent 用 haiku 就好 期待更多測試心得出現threads.com · supporting

# Thread 2.1K views darrell_tw_'s profile picture darrell\_tw\_ Claude Code 更新 2.0.28 subagents 可以切換模型了! 代表 plan 跟 execution 能更好分離出來 讓 plan 的 subagent 用 sonnet 讓 execute 的 subagent 用 haiku 就好 期待更多測試心得出現 35 2 1 Log in or sign up for ThreadsSee what people are talking about and join the conversation. Log in with username instead

Claude Code 使用技巧:讓 AI 再幫你指揮 AI —— Sub Agent 跟 Agent Team 差在哪?youtube.com · supporting

那我自己 也覺得還有另外兩個好處想要跟你分享 第一個好處就是我們都知道 如果今天讓同一個模型在同一個對話裡面 他同時去做事 並且他同時回來驗證 有些時候會有球員兼裁判的問題發生 他前面自己做的事情 自己再回來驗證 他可能會合理化自己所做過的事情 但是如果我們用一個 獨立的 SUB agent 擁有獨立的上下文去 來做檢驗 那就會相對公平公正 所以我也常常會用 SUB agent 不承繼主 agent 的上下文 讓它專門來 去審查主 agent 的成果 再來另外一個好處就是 有些時候主 agent 我用的是比較高階的模型 比如說 Opus 比較貴 但是 我有一些任務可能文件比較大 他不需要弄那麼高階的模型 不然會很吃 token Token 的金額 又比較高 我就會去請他派出使用比較便宜的模型 比如說 Haiku 的模型 去處理這些長文字 但是比較簡單的任務 比如說這個檔案有 200 多頁 如果讓 Opus 去讀的話 那個額 額度一下子就會飆高 我就會請他不要親自讀 而是派一個 Haiku 最便宜的模型 他雖然能力沒有那麼強 但是如果給他的任務只是讀長文件總結的話 那就夠了 我覺得請他派出比較便宜的模型 Haiku 當作是 SUB agent 去讀完之後把摘要回傳回來 所以這個也有起到省 額 度的效果 或者是 如果今天文字太長的時候 你讓 AI 去做檢查 去做總結 可能就會有注意力缺失的問題 他可能記得前半段 記不得後半段 他選擇性地記得一部分 結果其他部分都散掉了 那我們也可以把這個文件拆成好幾段 每一段派一個 SUB agent 去負責 這些 SUB agent 各自只拿到那一段的文字 那麼上下文就不會被拉長 那各自的 agent 他們做起任務來也就比較不會有注意力缺失的問題 我們再請出 agent 來會診他們的結果 這些都是 sub agent 的好處 那至於什麼是 [...] 是叫一個助理去做一件事情 他做完了之後跟你彙報結論 好 那他只會回報結果給你 不會跟任何人講話 所以他無法跟其他的 agent 溝通 他只能跟主 agent 溝通好 那我們只會看到他回傳過來的摘要 細節在自己的上下文裡面 他適合單一任務 再來 Agent team 則是說我們招了好幾個部門的主管 好 他們各自有完整的工作空間 最大的差別是這些 agent 之間可以互相的討論 他可以去平行