本文是业务流程中长期运行, 有状态, 多步骤生成式人工智能系统的基于图的工作流程路径的从业者指南。我们没有将 LangGraph, 视为有状态代理, 的低级编排框架,将其视为模型质量基准目标,,而是提出了三个可执行配方 - 具有修复循环的 SQL 分析, 具有证据门控的代理检索增强生成, 以及具有中断和检查点恢复的人在环策略审查 - 以显示类型化状态, 条件路由, 确定性工具, 重试, 中断,检查点, 和迹线配合在一起。 LangGraph 的定位是工作流程复杂性适合, 不是通用默认: 更简单的 ReAct 风格或普通 SDK 循环可能更适合基本工具使用, 用于结构化提取和验证的模式优先工具, 和 DSPy(当提示或程序优化是主要目标时)。每个秘诀都解释了 LangGraph 何时值得额外的结构,以及哪些实现模式使路由, 暂停, 和审计跟踪明确的产品行为而不是隐藏的提示逻辑。
This paper is a practitioner guide to graph-based workflow pathways for long-running, stateful, multi-step generative AI systems in business processes. Rather than treating LangGraph, a low-level orchestration framework for stateful agents, as a model-quality benchmark target, we present three executable recipes -- SQL analytics with repair loops, agentic retrieval-augmented generation with evidence gating, and human-in-the-loop policy review with interrupt and checkpoint recovery -- to show how typed state, conditional routing, deterministic tools, retries, interrupts, checkpoints, and traces fit together. LangGraph is positioned by workflow-complexity fit, not as a universal default: simpler ReAct-style or plain SDK loops may be better for basic tool use, schema-first tools for structured extraction and validation, and DSPy when prompt or program optimization is the main goal. Each recipe explains when LangGraph is worth the extra structure and which implementation patterns make routes, pauses, and audit trails explicit product behavior rather than hidden prompt logic.
科目: 人工智能 (cs.AI); 软件工程 (cs.SE)
Subjects: Artificial Intelligence (cs.AI); Software Engineering (cs.SE)