页面加载中...
单 Agent 能力有限,多 Agent 协作才是解决复杂问题的关键。本教程对比 CrewAI、Fast-Agent、OpenClaw 三种编排方案,手把手实现一个「研究→写作→审核」三 Agent 工作流。
单 Agent 面对复杂任务时容易「顾此失彼」——又要调研、又要写稿、还要审核,角色混杂导致输出质量不稳定。多 Agent 的核心思想是分而治之:每个 Agent 专注一个角色,通过编排机制协作完成目标。
| 特性 | CrewAI | Fast-Agent | OpenClaw |
|---|---|---|---|
| 编排方式 | Crew + Task | 装饰器 + Chain | SOUL + AGENTS.md |
| 通信 | 委托 | MCP 工具调用 | 会话消息 |
| 模型支持 | 多模型 | 多模型 | 多模型 |
| MCP 支持 | 有限 | 原生 | 原生 |
from fast_agent import FastAgent fast = FastAgent("Research-Write-Review") @fast.agent( "researcher", instruction="You are a research specialist. Find comprehensive information on the given topic. Return structured notes.", servers=["fetch"] ) @fast.agent( "writer", instruction="You are a professional writer. Take research notes and write a polished article. Focus on clarity and engagement." ) @fast.agent( "reviewer", instruction="You are an editor. Review the article for accuracy, style, and completeness. Suggest specific improvements." ) @fast.chain( name="publish_pipeline", sequence=["researcher", "writer", "reviewer"] ) async def main(): async with fast.run() as agent: result = await agent.publish_pipeline( "The impact of AI agents on software development in 2026" ) print(result)
from crewai import Agent, Task, Crew, Process researcher = Agent( role="Research Specialist", goal="Find comprehensive and accurate information", backstory="Expert researcher with 10 years of experience", allow_delegation=False ) writer = Agent( role="Professional Writer", goal="Transform research into engaging articles", backstory="Award-winning tech journalist", allow_delegation=False ) reviewer = Agent( role="Senior Editor", goal="Ensure article quality and accuracy", backstory="Editor at a major tech publication", allow_delegation=True ) research_task = Task(description="Research: {topic}", agent=researcher) write_task = Task(description="Write article from research", agent=writer) review_task = Task(description="Review and improve article", agent=reviewer) crew = Crew( agents=[researcher, writer, reviewer], tasks=[research_task, write_task, review_task], process=Process.sequential ) result = crew.kickoff(inputs={"topic": "AI agents in 2026"})
当任务需要动态路由而非固定流水线时,使用 Agents as Tools:
@fast.agent("researcher", instruction="...", servers=["fetch"]) @fast.agent("writer", instruction="...") @fast.agent( "orchestrator", instruction="Route tasks to the right specialist. Research → researcher, Writing → writer. Aggregate results.", default=True, agents=["researcher", "writer"] ) async def main(): async with fast.run() as agent: await agent("Write a comparison of React vs Vue in 2026")
Agent 站点首选部署平台,零配置部署 Next.js,全球 CDN
立即体验 →