SuperAPI AI 工具集

multi-agent

智能体与模型

查看项目

更新于 10-16 10:51

技能介绍

用途

multi-agent 用于构建协调式的多智能体系统,以完成复杂任务。当任务需要多个专用智能体、需要构建 orchestrator-worker 模式、实现智能体工作流或协调并行执行时,可调用该技能。

主要能力

该技能支持编排与协调、工作流以及分布式架构,主要提供以下能力:

  • 架构模式:orchestrator-worker、hierarchical、peer-to-peer(默认 orchestrator-worker)。
  • 框架选择:langgraph、autogen、crewai(默认 langgraph)。

参数 Schema

参数 类型 必填 说明 默认值
task string 是 多智能体目标 -
architecture enum 否 orchestrator-worker, hierarchical, peer-to-peer orchestrator-worker
framework enum 否 langgraph, autogen, crewai langgraph

使用方式

快速开始示例(代码原样保留):

from langgraph.graph import StateGraph, MessagesState
from langgraph.prebuilt import create_react_agent

# Create specialized agents
researcher = create_react_agent(llm, [web_search])
coder = create_react_agent(llm, [execute_code])

# Build graph
graph = StateGraph(MessagesState)
graph.add_node("researcher", researcher)
graph.add_node("coder", coder)
graph.add_conditional_edges("coordinator", router)

架构模式

Orchestrator-Worker:

Orchestrator (Opus)
    ├── Researcher (Sonnet)
    ├── Analyst (Sonnet)
    └── Writer (Haiku)

Hierarchical:

Manager (Opus)
    ├── Research Lead (Sonnet)
    │   ├── Web Researcher (Haiku)
    │   └── Doc Analyst (Haiku)
    └── Engineering Lead (Sonnet)
        ├── Frontend Dev (Haiku)
        └── Backend Dev (Haiku)

模型分配

Agent Type Model Rationale
Orchestrator Opus Complex planning
Specialist Sonnet Reasoning
Worker Haiku Simple tasks

故障排查

Issue Solution
Agents not coordinating Check message bus
Deadlock Add timeout, detect cycles
Inconsistent results Synchronize state
High costs Use cheaper models for workers

适用场景

适合需要多个专用智能体协作的复杂任务,例如编排者-工作者(orchestrator-worker)模式、分层(hierarchical)结构、智能体工作流实现,以及并行执行的协调。

最佳实践

  • 每个智能体只承担一项工作(单一职责)。
  • 编排者仅负责规划。
  • 对长工作流使用检查点(checkpointing)。
  • 为每个智能体实现熔断器(circuit breakers)。

相关技能

  • ai-agent-basics - 单智能体
  • agent-memory - 共享状态
  • tool-calling - 每个智能体的工具

参考资料

  • LangGraph Multi-Agent
  • Anthropic Multi-Agent

限制

关于该技能的具体收费、价格、平台支持、实际效果及更详细的使用步骤,现有资料暂未提供。