docs: Agent Framework 技术选型与架构设计#47
Conversation
对 8 个 Agent 框架(PydanticAI、LangGraph、PydanticAI+LangGraph、LangChain、Mastra、CrewAI、AutoGen、OpenAI Agents SDK)进行 14 维度分析,给出分阶段推荐方案和完整系统架构设计。 Co-Authored-By: Claude <noreply@anthropic.com>
|
|
||
| > 日期:2026-07-14 | ||
| > 定位:AI DM 系统的 Agent Framework 选型分析、运行时架构设计与完整系统方案 | ||
| > 前置:agent-module-design.md / 数据模型设计.md / COC_ENGINE_RULE_REQUIREMENTS.md |
There was a problem hiding this comment.
This document declares agent-module-design.md, 数据模型设计.md, and COC_ENGINE_RULE_REQUIREMENTS.md as prerequisites, and later also relies on agent-implementation-team-plan.md, but none of those files are present in this repository or this PR. A reader cannot verify the architecture assumptions, A/B/C/D mechanism, or schema references this document builds on. Please include/link the prerequisite docs, or remove the hard dependency and inline the required assumptions here.
|
|
||
| planner = Agent( | ||
| model="claude-sonnet-5", | ||
| result_type=ActionPlan, # ← 输出强制为此 Pydantic Model |
There was a problem hiding this comment.
The current PydanticAI API documents structured outputs as Agent(..., output_type=ActionPlan), not result_type=... (see https://pydantic.dev/docs/ai/core-concepts/output/). This same result_type pattern appears throughout the document and in the dependency section, so implementers following the snippets against current pydantic-ai will hit stale API examples. Please update the examples/text to output_type or pin and document an older PydanticAI version that still supports result_type.
| confirmed_outcome: dict | None | ||
| narration: Narration | None # ← Pydantic Model,非 dict | ||
|
|
||
| def intent_node(state: TurnState) -> TurnState: |
There was a problem hiding this comment.
This example uses await inside a plain def, so the code block is syntactically invalid as written. Since this is presented as the LangGraph integration pattern, the node functions that await planner.run(...)/narrator.run(...) should be declared async def or rewritten to avoid await.
| | 维度 | 评分 | 分析 | | ||
| |------|------|------| | ||
| | 学习成本 | ★★★★★ | 极低。Agent + Tool + Runner 三个概念。10 分钟上手。 | | ||
| | 开发效率 | ★★★★☆ | 简单场景极快。但缺少结构化输出约束(没有 `result_type` 等价物)。需要自己解析和校验 LLM 输出。 | |
There was a problem hiding this comment.
This claim is inaccurate for the OpenAI Agents SDK: it supports structured outputs through Agent(output_type=...) with Pydantic models (see https://openai.github.io/openai-agents-python/agents/). If the recommendation is still to avoid the SDK, the comparison should focus on the remaining concerns such as provider coupling and workflow/handoff semantics, not on missing structured-output support.
内容
对 8 个 Agent 框架进行 系统分析,给出针对 TRPG AI DM 项目的技术选型推荐。
分析的框架
核心结论
同时覆盖了两个 Agent 系统的框架分析
🤖 Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com