philschmid RSS feed 09月30日
Subagents提升AI任务处理效率
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

Subagents通过将复杂任务分解为更小的、专门化的子任务来提升AI系统的效率和可靠性。它们可以显式定义或动态创建,通过孤立的环境和上下文窗口来避免传统AI代理的上下文污染问题。这种架构使得任务处理更专注、性能更优,并有助于降低达成目标成本。Subagents在B2C和 企业工作流程中都有广泛应用前景。

🔧Subagents是专门用于单个、明确定义任务的AI代理,通常与协调器结合使用,协调器负责分析请求、分解任务并将任务分配给合适的Subagent。每个Subagent拥有独立的上下文窗口和工具集,确保任务处理的专注性和隔离性。

📝显式定义的Subagent是可重用的永久性专家团队,通常在静态文件或代码中定义,协调器通过名称或描述匹配来调用它们。这种方法的优点是控制力强、行为可预测且易于隔离测试,缺点是系统刚性,扩展性较差。

🌐动态创建的Subagent由协调器根据用户请求临时生成,工具选择基于用户自然语言请求,从预定义工具池中动态分配。这类Subagent可以保持状态,记住先前运行时的上下文,优点是灵活且无需设置,缺点是可预测性较低且调试难度较大。

🛡️Subagents通过隔离上下文和限制工具集有效防止了传统AI代理的上下文污染问题,提高了任务处理的准确性和效率。这种架构使得复杂任务更容易被测试和评估,降低了系统整体成本。

📈未来,Subagents将在B2C和 企业应用中发挥更大作用,动态Subagent可能更适用于通用B2C应用,而预定义Subagent则更适合结构化、可重复的企业工作流程。

There is an increasing use of Subagents to reliably handle specific user goals. We can see this in tools like Claude Code and Poke.com. A subagent is a specialized Agent that is purpose-built for a single, well-defined task. Subagents can be explicit, where a user or model defines them for reuse or implicit and dynamically defined. This addresses a key limitation of monolithic AI agents context pollution. When a single, big and complex agent handles many tasks, its context window, number of tools, can become cluttered and less reliable.

What are Subagents?

Subagents are specialized AI agents. They are most of the time used in combination with an orchestrator, which delegates tasks to them. A subagent is just like a normal agent and has the same components. This includes a name for identification, a description of its capabilities, system instructions and a set of tools to interact with environments. It also has its own isolated context window.

            ┌───────────────────┐            │    User Request   │            └─────────┬─────────┘        ┌───────────────────────────┐        │   Orchestrator Agent      │- Analyzes Request         │- Decomposes Task          │- Delegates to Subagents   │        └───────────┬───────────────┘┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┼ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐                    │ Isolated Execution        ┌───────────┴───────────┬──────────────────┐        ▼                       ▼                  ▼┌────────────────┐    ┌────────────────┐    ┌────────────────┐│ Subagent 1     │    │ Subagent 2     │    │ Subagent n...- Own Context   │    │- Own Context   │    │- Own Context   │- Own Tools     │    │- Own Tools     │    │- Own Tools     │- Solves Task A │    │- Solves Task B │    │- Solves Task C │└───────┬────────┘    └─────────┬──────┘    └──────┬─────────┘        │                       │                  │        └───────────┬───────────┴──────────────────┘        ┌───────────────────────────┐        │   Orchestrator Agent      │- Synthesizes all results  │        └─────────────┬─────────────┘            ┌───────────────────┐            │   Final Answer    │            └───────────────────┘

Explicit, User-Defined Subagents

Explicit, User-defined Subagents are a permanent team of reusable specialists. Subagent can be defined in a static file or directly in code and the orchestrator uses them trough their name or when a prompt matches its description. Claude Code uses this method. The tools are manually listed in the definition, and the agent is stateless, meaning it starts fresh on every run.

Pros:

    You have full control over the agent's tools and behavior.The agent's actions are very predictable and secure.Reusable and easy to test in isolation

Cons:

    The system is rigid. You must update the definition file to add new tools.The orchestrator must manage all the state between steps.Hard to scale to hunderds of specialized task.

Here is a pseudo-code snippet of a definition file, inspired from Claude Code:

---name: "Code-Reviewer"description: "MUST BE USED for reviewing code against style guides and security practices."tools: ['file_read', 'search_code']---You are an expert security code reviewer. Your purpose is to analyze code and identify vulnerabilities. Provide feedback in a numbered list. 

Implicit, On-the-Fly Subagents

Implicit, On-the-Fly Subagents can be created temporary by an orchestrator to handle tasks as they come up. The orchestrator uses a tool (send_message_to_agent) to create and interact with the agent. The system dynamically assigns tools based on the user's natural language request from pre-defined pool which are needed to solve the task. Poke.com uses this method to created unlimited agents for specific user request. A key feature is that these agents can be stateful, e.g. keep context from previous runs when called with the same agent_name.

Here is a pseudo-code snippet for how the orchestrator calls the agent:

# The orchestrator calls this tool to create or reuse a subagentsend_message_to_agent(    agent_name="q3_report_email_draft",    description="An agent specializing in drafting internal company communications, specifically for report summaries and team updates.",    message=f"""Draft an email to the marketing team about the Q3 report.     TONE & STYLE:    - Professional yet approachable and optimistic.    - Be concise and data-driven. Avoid corporate jargon.    - IMPORTANT: Analyze my last 5 sent emails to the 'marketing-team@' mailing list to match my typical writing style, greeting, and sign-off.        RULES & CONSTRAINTS:    - The subject line must be clear and engaging. Start with "Q3 Report Highlights:".    - Use bullet points to present the key metrics for scannability.    - Keep the total email length under 200 words.    - End with a clear call to action: ask the team to review the full report and send their feedback for the Q4 planning session by EOD Friday.    """)
    Pros:
      The system is very flexible and requires no setup.Tools are selected based on the unique user task.Multi-step tasks are straightforward because the agent remembers its context.
    Cons:
      The system is less predictable and you have less direct control.It might fail if it misunderstands the task and assigns the wrong tools.Harder to debug and reproduce failures since the agent’s configuration is generated dynamically.

Conclusion

Both predefined and on-the-fly subagents will see increased usage. Dynamic agents might find more adoption in general B2C applications. Predefined agents are a great fit for more structured and repeatable enterprise workflows.

Context Engineering is everything. The key to success is giving the LLM the right information and tools at the right time. Using Subagents allows us to create a focused environment for the LLM with a clear, isolated context, specific system instructions, and a limited set of tools for the task. This improves performance and can reduce the cost of reaching the goal.

But even with a subagent architecture, reliability is still a challenge for agentic systems, breaking down a complex task into smaller subagent functions can make them easier to test and evaluate in isolation.

Models are improving very fast. Don’t over-engineer a solution today that a simpler or better model can solve tomorrow.

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

Subagents AI代理 任务分解 上下文隔离 AI效率
相关文章