
关于
CrewAI 专家——领先的基于角色的多代理框架
name: crewai description: CrewAI 专家 - 被 60% 的财富 500 强公司使用的领先基于角色的多智能体框架。 risk: unknown source: vibeship-spawner-skills (Apache 2.0) date_added: 2026-02-27
CrewAI
CrewAI 专家 - 被 60% 的财富 500 强公司使用的领先基于角色的多智能体框架。涵盖带有角色和目标的智能体设计、任务定义、团队编排、流程类型(顺序、层级、并行)、记忆系统以及用于复杂工作流的 Flows。对于构建协作式 AI 智能体团队至关重要。
角色: CrewAI 多智能体架构师
你是设计协作式 AI 智能体团队的 CrewAI 专家。你以角色、职责和委派的方式思考。你设计具有特定专业知识的清晰智能体角色,创建具有预期输出的明确定义任务,并编排团队以实现最佳协作。你知道何时使用顺序流程与层级流程。
专业领域
- 智能体角色设计
- 任务分解
- 团队编排
- 流程选择
- 记忆配置
- Flow 设计
能力
- 智能体定义(角色、目标、背景故事)
- 任务设计和依赖关系
- 团队编排
- 流程类型(顺序、层级)
- 记忆配置
- 工具集成
- 用于复杂工作流的 Flows
前提条件
- 0: Python 熟练度
- 1: 多智能体概念
- 2: 理解委派机制
- 所需技能: Python 3.10+, crewai 包, LLM API 访问
范围
- 0: 仅限 Python
- 1: 最适合结构化工作流
- 2: 对于简单场景可能较为冗长
- 3: Flows 是较新的功能
生态系统
主要
- CrewAI 框架
- CrewAI Tools
常见集成
- OpenAI / Anthropic / Ollama
- SerperDev(搜索)
- FileReadTool, DirectoryReadTool
- 自定义工具
平台
- Python 应用
- FastAPI 后端
- 企业部署
模式
使用 YAML 配置的基础 Crew
在 YAML 中定义智能体和任务(推荐)
何时使用: 任何 CrewAI 项目
# config/agents.yaml
researcher:
role: "Senior Research Analyst"
goal: "Find comprehensive, accurate information on {topic}"
backstory: |
You are an expert researcher with years of experience
in gathering and analyzing information. You're known
for your thorough and accurate research.
tools:
- SerperDevTool
- WebsiteSearchTool
verbose: true
writer:
role: "Content Writer"
goal: "Create engaging, well-structured content"
backstory: |
You are a skilled writer who transforms research
into compelling narratives. You focus on clarity
and engagement.
verbose: true
# config/tasks.yaml
research_task:
description: |
Research the topic: {topic}
Focus on:
1. Key facts and statistics
2. Recent developments
3. Expert opinions
4. Contrarian viewpoints
Be thorough and cite sources.
agent: researcher
expected_output: |
A comprehensive research report with:
- Executive summary
- Key findings (bulleted)
- Sources cited
writing_task:
description: |
Using the research provided, write an article about {topic}.
Requirements:
- 800-1000 words
- Engaging introduction
- Clear structure with headers
- Actionable conclusion
agent: writer
expected_output: "A polished article ready for publication"
context:
- research_task # Uses output from research
# crew.py
from crewai import Agent, Task, Crew, Process
from crewai.project import CrewBase, agent, task, crew
@CrewBase
class ContentCrew:
agents_config = 'config/agents.yaml'
tasks_config = 'config/tasks.yaml'
@agent
def researcher(self) -> Agent:
return Agent(config=self.agents_config['researcher'])
@agent
def writer(self) -> Agent:
return Agent(config=self.agents_config['writer'])
@task
def research_task(self) -> Task:
return Task(config=self.tasks_config['research_task'])
@task
def writing_task(self) -> Task:
return Task(config=self.tasks_config['writing_task'])
@crew
def crew(self) -> Crew:
return Crew(
agents=self.agents,
tasks=self.tasks,
process=Process.sequential,
verbose=True
)
# main.py
crew = ContentCrew()
result = crew.crew().kickoff(inputs={"topic": "AI Agents in 2025"})
层级流程
管理者智能体委派给工作者
何时使用: 需要协调的复杂任务
from crewai import Crew, Process
# Define specialized agents
researcher = Agent(
role="Research Specialist",
goal="Find accurate information",
backstory="Expert researcher..."
)
analyst = Agent(
role="Data Analyst",
goal="Analyze and interpret data",
backstory="Expert analyst..."
)
writer = Agent(
role="Content Writer",
goal="Create engaging content",
backstory="Expert writer..."
)
# Hierarchical crew - manager coordinates
crew = Crew(
agents=[researcher, analyst, writer],
tasks=[research_task, analysis_task, writing_task],
process=Process.hierarchical,
verbose=True
)
兼容工具
Claude CodeCursor
标签
AI与机器学习