deepagents-subagents
在 Deep Agents 中使用 SubAgentMiddleware 启动子代理进行任务委托、上下文隔离和专门工作。
npx skills add majiayu000/claude-skill-registry --skill deepagents-subagents --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# deepagents-subagents (JavaScript/TypeScript) ## 概述 SubAgentMiddleware 通过 `task` 工具实现任务委托。优势:上下文隔离、专业化、token 效率、并行执行。 **默认子代理**:"通用型" - 自动可用,具有与主代理相同的工具/配置。 ## 定义子代理 ### 基于字典的子代理 ```typescript import { createDeepAgent } from "deepagents"; import { tool } from "langchain"; import { z } from "zod"; const searchPapers = tool( async ({ query }) => `找到 10 篇关于 ${query} 的论文`, { name: "search_papers", description: "搜索学术论文", schema: z.object({ query: z.string() }), } ); const agent = await createDeepAgent({ subagents: [ { name: "research", description: "研究学术论文并提供摘要", systemPrompt: "你是一个研究助手。提供简洁的摘要。", tools: [searchPapers], model: "claude-sonnet-4-5-20250929", // 可选 } ] }); const result = await agent.invoke({ messages: [{ role: "user", content: "研究关于 transformers 的最新论文" }] }); ``` ### CompiledSubAgent(自定义图) ```typescript import { createDeepAgent, CompiledSubAgent } from "deepagents"; const weatherGraph = createWeatherGraph(); // 你的自定义 LangGraph const weatherSubagent = new CompiledSubAgent({ name: "weather", description: "获取天气预报", runnable: weatherGraph }); const agent = await createDeepAgent({ subagents: [weatherSubagent] }); ``` ## 代码示例 ### 示例 1:研究子代理 ```typescript import { createDeepAgen
- 概述
- 定义子代理
- 基于字典的子代理
- CompiledSubAgent(自定义图)
- 代码示例
- 示例 1:研究子代理
- 示例 2:具有 HITL 的子代理
- 示例 3:具有自定义技能的子代理
- 边界
- Agent 可以配置的内容
- Agent 不能配置的内容
- 注意事项
- 1. 子代理是无状态的
- 2. 自定义子代理不继承技能
What does the deepagents-subagents skill do?
在 Deep Agents 中使用 SubAgentMiddleware 启动子代理进行任务委托、上下文隔离和专门工作。
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill deepagents-subagents --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
