微信扫码
添加专属顾问
我要投稿
LangGraph Ultra版本开源,多智能体协同工作能力革命性提升! 核心内容: 1. LangGraph Ultra版本发布,多智能体应用能力大幅提升 2. 核心特性:多智能体协同工作与上下文信息传递 3. 实际应用案例:自动切换订票和订酒店场景的智能体协同演示
就在昨天,langgraph的ultra版本项目开源,命名为langgraph-swarm-py,可以通过 pip install langgraph-swarm
安装。所以swarm ? openai 一脸问号?
他的核心升级是,拓展了多智能体应用,可以让多个具有不同专长的智能体协同工作,并在它们之间传递上下文信息。 其次是内置了智能体之间通信的工具,用户可以根据需求进行定制。
下面的图,是一个系统在订票和订酒店2个场景自动切换的demo。
用readme脚本简单测试了下,Agent切换是通过工具来实现,每个agent会绑定一个handoff_tool到别的agent上。
from langgraph.checkpoint.memory import InMemorySaver
from langgraph.prebuilt import create_react_agent
from langgraph_swarm import create_handoff_tool, create_swarm
model = ZhipuAIChat(provider="zhipuai",
model_name="glm-4-plus",
temperature=0.7)
def add(a: int, b: int) -> int:
"""
add function, return a add b
"""
return a + b
alice = create_react_agent(
model,
[add,
create_handoff_tool(agent_name="Bob")],
prompt="You are Alice, an addition expert.",
name="Alice",
)
bob = create_react_agent(
model,
[create_handoff_tool(agent_name="Alice", description="Transfer to Alice, she can help with math")],
prompt="You are Bob, you speak like a pirate.",
name="Bob",
)
checkpointer = InMemorySaver()
workflow = create_swarm(
[alice, bob],
default_active_agent="Alice"
)
app = workflow.compile(checkpointer=checkpointer)
config = {"configurable": {"thread_id": "1"}}
turn_1 = app.invoke(
{"messages": [{"role": "user", "content": "i'd like to speak to Bob"}]},
config,
)
print(turn_1)
turn_2 = app.invoke(
{"messages": [{"role": "user", "content": "what's 5 + 7?"}]},
config,
)
print(turn_2)
53AI,企业落地大模型首选服务商
产品:场景落地咨询+大模型应用平台+行业解决方案
承诺:免费场景POC验证,效果验证后签署服务协议。零风险落地应用大模型,已交付160+中大型企业
2025-03-05
Agent 最全 Playbook:场景、记忆和交互创新
2025-03-05
基于LangGraph的智能文章生成Agent架构设计思路
2025-03-02
LangGraph全新4大预构建Agents框架登场
2025-03-01
极简LangChain智能体开发入门指南
2025-03-01
释放 Langflow 的力量:使用 Rag 构建多工具代理
2025-02-28
用 LangGraph 构建 Agent 逐步指南
2025-02-25
AI Agent 开发框架巡礼:流行度、案例与理性选择
2025-02-22
手把手教你使用Qwen-Agent开发智能体应用实战教程
2024-10-10
2024-04-08
2024-07-13
2024-06-03
2024-09-04
2024-08-18
2024-04-08
2024-06-24
2024-07-10
2024-03-28
2025-02-05
2024-12-02
2024-11-25
2024-10-30
2024-10-11
2024-08-18
2024-08-16
2024-08-04