DSPy vs LangGraph vs CrewAI:相同的管道,三种哲学
从业者对三种AI代理框架的比较——不是来自文档,而是来自构建 同一生产管道 在所有三个。
管道: 公司研究代理搜索网络,提取结构化事实,撰写分析师摘要,与法学硕士法官一起审查,如果质量不够好,则返回。
管道结构
Input: "Apple"
│
▼
web_search(mock) ──▶ Researcher ──▶ Writer ──▶ structural_check()
CompanyFacts Summary │
fail │ pass
┌──────┤
│ ▼
│ Reviewer (LLM judge)
│ │
│ approved? ──yes──▶ Output
│ │ no
│ ▼
└── Rewriter (with feedback)
(max 3 iterations)两阶段评估: structural_check() 免费捕获明显的失败(字数、缺失字段)——LLM判断仅在结构检查通过时运行。判断根据来源验证声明,检查方面覆盖率,并对简洁性进行评分。没有模糊的0-10分。
是什么让它与众不同:
- MCP集成 --每个框架都连接到真实的MCP服务器,包括 mcp python repl
- 代理技能 --使用结构化代理功能 代理技能 规范,包括脚本、引用和多文件导航
- 法学硕士作为法官 --分解评估:索赔验证、方面覆盖、源接地精度
- DSPy GEPA优化 --可以提示优化解决技能触发可靠性问题 Vercel已确定?
博客系列
| 部分 | 标题 | 状态 |
|---|---|---|
| 1 | 同一管道,三种哲学 | ✅ 已发布 |
| 2 | 构建同一条管道,三种方式 | 🚧 进行中 |
| 3 | MCP、代理技能和依赖性审计 | ⬜ 计划中 |
| 4 | 评估、优化和判决 | ⬜ 计划中 |
项目结构
├── common/ # Shared across all frameworks
│ ├── models.py # Pydantic models (CompanyFacts, AnalystSummary, ReviewResult)
│ ├── tools.py # Web search (mock → MCP in Part 3)
│ └── skills/ # Agent Skills (SKILL.md + scripts + references)
│ └── company-researcher/
│
├── dspy_impl/ # DSPy: "Define what, not how"
│ ├── signatures.py # Typed input/output contracts
│ ├── pipeline.py # Modules + review loop
│ └── run.py # Entry point
│
├── langgraph_impl/ # LangGraph: "Draw your workflow"
│ ├── state.py
│ ├── nodes.py
│ ├── graph.py
│ └── run.py
│
└── crewai_impl/ # CrewAI: "Describe your team"
├── agents.yaml
├── tasks.yaml
├── crew.py
└── run.py快速开始
git clone https://github.com/aazizisoufiane/dspy-langgraph-crewai-comparison.git
cd dspy-langgraph-crewai-comparison
cp .env.example .env # add your API key
uv sync # install dependencies
# Run any implementation
just dspy "Apple"
just langgraph "Apple"
just crewai "Apple"
just all "Apple" # run all three主要发现(预览)
| Aspect | DSPy | LangGraph | CrewAI |
|---|---|---|---|
| 哲学 | 编译与优化 | 工程与控制 | 配置与编排 |
| MCP集成 | 手动包装器 | 生态系统适配器 | 本地 |
| 技能触发可靠性 | 可优化(GEPA) | 手动提示调整 | 手动背景故事调整 |
| LLM作为评判者 | 一级模块 | 手动节点+提示 | 具有审阅者角色的代理 |
| 快速优化 | 内置 | 无 | 无 |
全面分析 博客系列.
作者
Soufiane Aazizi --首席人工智能工程师| 动物AI
在定量金融和人工智能工程领域拥有12年以上的经验。在制药、银行和审计领域建立生产LLM系统。
许可证
麻省理工学院
