跳到正文
掘金· 李溪白·· 24 天前精选AI 评分71

用 LangGraph 的 Swarm 模式与 Handoff 实现多智能体互相转接

RAG 进阶:Agentic RAG 与多智能体协作(系列三·第3篇):Swarm 模式与 Handoff 实战

AI 导读

文章用 LangGraph 的 langgraph-swarm 从零搭了一个旅行规划 Swarm,两个专家 Agent 通过 create_handoff_tool 生成的移交工具互相转接,无需中央主管调度。

借鉴点

能拿走 create_handoff_tool 自定义版只传 task_description 不传全量历史,换掉默认 handoff 的 token 膨胀;代价是要自己校验 agent_name 并设 recursion_limit 防互转死循环。

来源:掘金 · juejin.cn