Agent 框架:LangGraph / OpenAI Agents SDK / Google ADK / Claude Agent SDK 怎么选Agent frameworks: how to choose
按流程控制、会话状态、工具执行与部署边界对照四个 SDK;区分框架提供的机制与应用仍需配置的部分。
Compare workflow control, session state, tool execution and deployment boundaries; distinguish SDK mechanisms from application configuration.
先分清两类Choose the level you need
先写清需要控制的部分,再选 SDK。四个项目的抽象层不同,不宜把“低层”解释成能力少,也不能把某一种工具的执行方式推广到整个 SDK。
| 需求 | 对应检查点 |
|---|---|
| 流程步骤与分支由应用明确控制 | 图、状态、节点与中断恢复 |
| 多个 Agent 协作 | 工具、handoff、调度与职责边界 |
| 跨轮保留上下文 | Session 后端、保留范围与恢复方法 |
| 工具接触文件、命令或网络 | 执行进程、权限与隔离方式 |
Write down what your application needs to control before choosing an SDK. Their abstraction levels differ. Low-level does not mean fewer capabilities, and one kind of tool's execution model does not describe the whole SDK.
| Requirement | Inspect |
|---|---|
| Explicit workflow steps and branches | Graph, state, nodes and interruption recovery |
| Collaboration between agents | Tools, handoffs, scheduling and responsibilities |
| Context across turns | Session backend, retained scope and recovery |
| Tools accessing files, commands or networks | Execution process, permissions and isolation |
四行对照Four frameworks
| 项目 | 官方文档提供的机制 | 应用仍需决定 |
|---|---|---|
| LangGraph | 有状态编排、持久执行、流式输出、人在回路 | 状态结构、存储配置、业务分支与工具权限 |
| OpenAI Agents SDK | Agent 循环、工具、handoff、Sessions、人在回路 | 会话后端、工具授权、业务审批与模型适配 |
| Google ADK | Agent、图工作流、顺序/循环/并行工作流、Runtime | 流程设计、状态数据与部署配置 |
| Claude Agent SDK | Claude Code 能力、自定义进程内 MCP 工具、外部 MCP 连接 | CLI 进程与工具的权限、部署隔离、会话生命周期 |
某机制存在不代表已为你的应用配置好;不同语言 SDK 和版本的覆盖也需分别检查。
| Project | Mechanisms in official documentation | Application decisions |
|---|---|---|
| LangGraph | Stateful orchestration, durable execution, streaming, human-in-the-loop | State schema, storage configuration, branches and tool permissions |
| OpenAI Agents SDK | Agent loop, tools, handoffs, Sessions, human-in-the-loop | Session backend, tool authorisation, business approvals and model integration |
| Google ADK | Agents, graph workflows, sequential/loop/parallel workflows and runtime | Workflow design, state data and deployment configuration |
| Claude Agent SDK | Claude Code capabilities, custom in-process MCP tools and external MCP connections | CLI/tool permissions, deployment isolation and session lifecycle |
A mechanism's existence does not mean it is configured for your application. Check language-specific SDK and version coverage separately.
逐个适用条件When each fits
LangGraph:当你需要明确控制图、状态与恢复过程时,对照其持久执行与中断机制。开始前先写一个失败后如何恢复的流程,不只画成功路径。
OpenAI Agents SDK:当你需要 Agent 循环、工具和 handoff 时,对照其运行机制;需要跨轮上下文时检查 Sessions,不能笼统写成“没有状态管理”。模型兼容性按实际工具调用与响应能力确认。
Google ADK:当任务需要图、顺序、循环或并行工作流时,对照对应机制;官方也提供 Agent Runtime,不能把它概括为“只管图、不跑 Agent”。
Claude Agent SDK:当你要将 Claude Code 能力接入应用并定义工具时,对照 Python/TypeScript 版本。create_sdk_mcp_server() 创建的工具服务在 Python 应用进程内;这不表示整个 SDK 没有 CLI 子进程,也不能据此承诺端到端“无 IPC 开销”。
LangGraph: examine durable execution and interruption mechanisms when you need explicit graph, state and recovery control. Describe recovery from failure as well as the success path.
OpenAI Agents SDK: examine its runtime when you need an agent loop, tools and handoffs. For cross-turn context, inspect Sessions rather than describing it as having no state management. Check model compatibility against the tool-call and response capabilities you actually need.
Google ADK: examine graph, sequential, loop or parallel workflows for the appropriate task. Its documentation also provides an Agent Runtime; it is not merely a graph layer that cannot run agents.
Claude Agent SDK: examine the Python or TypeScript version when embedding Claude Code capabilities and custom tools. create_sdk_mcp_server() creates a tool server inside the Python application. That does not mean the whole SDK has no CLI subprocess or guarantee zero end-to-end IPC overhead.
核验事实Verification scope
2026-11-04 复核了四份官方文档中与本页机制对照有关的内容:LangGraph 概览、OpenAI Agents SDK 概览、Google ADK 文档入口与 Claude Agent SDK Python 参考。
重点修正三处边界:OpenAI Agents SDK 有 Sessions 与人在回路机制;ADK 有 Agent Runtime;Claude 的进程内 MCP 工具不等于整个 SDK 单进程。这里没有运行 SDK、做吞吐测试或核验所有版本的兼容性。
On 2026-11-04, this page's mechanism comparison was checked against four official documents: the LangGraph overview, OpenAI Agents SDK introduction, Google ADK documentation and Claude Agent SDK Python reference.
Three boundaries were corrected: OpenAI Agents SDK has Sessions and human-in-the-loop mechanisms; ADK has an Agent Runtime; Claude's in-process MCP tools do not make the entire SDK single-process. No SDK was executed, no throughput was measured, and compatibility across all versions was not verified.
常见误判Common misreads
- 把框架提供持久化机制当成已经完成数据备份;需要核对后端、保留与恢复。
- 把支持多个模型当成无成本替换;提示词、工具 schema 和评估要重新检查。
- 把人在回路当成自动安全;审批点必须覆盖真正会产生影响的动作。
- 把进程内工具当成不用隔离;文件、命令与网络权限仍需明确。
- 只按功能名对照,不检查所用语言、版本与部署环境。
- A persistence mechanism does not establish a working backup; check backend, retention and recovery.
- Multiple-model support does not make substitution free; recheck prompts, tool schemas and evaluations.
- Human-in-the-loop is not automatic safety; approval points must cover consequential actions.
- In-process tools still need explicit file, command and network boundaries.
- Feature names alone are insufficient; check language, version and deployment environment.
出处Sources
| 来源Source | 链接URL |
|---|---|
| LangGraph 官方概览(流程编排与持久化机制,2026-11-04)LangGraph official overview (orchestration and persistence mechanisms; 2026-11-04) | https://docs.langchain.com/oss/python/langgraph/https://docs.langchain.com/oss/python/langgraph/ |
| OpenAI Agents SDK 官方概览(Sessions 与人在回路,2026-11-04)OpenAI Agents SDK introduction (Sessions and human-in-the-loop; 2026-11-04) | https://openai.github.io/openai-agents-python/https://openai.github.io/openai-agents-python/ |
| Google ADK 官方文档(Agent、图工作流与 Runtime,2026-11-04)Google ADK documentation (agents, graph workflows and runtime; 2026-11-04) | https://google.github.io/adk-docs/https://google.github.io/adk-docs/ |
| Claude Agent SDK Python 参考(进程内 MCP 工具与 CLI 子进程边界,2026-11-04)Claude Agent SDK Python reference (in-process MCP tools versus CLI subprocess; 2026-11-04) | https://platform.claude.com/docs/en/agent-sdk/pythonhttps://platform.claude.com/docs/en/agent-sdk/python |
资料快照日期:2026-11-04;单项复核范围与日期见对应正文或来源记录。产品功能与条款可能变化,使用前请核对原始来源。Source snapshot: 2026-11-04; item-specific rechecks and their scope are recorded in the text or source notes. Features and terms may change; check the original sources before use.