V1-MultiAgent - 多Agent协作框架,让AI Agents协同工作

0 阅读1分钟

V1-MultiAgent - 多Agent协作框架,让AI Agents协同工作

V1-MultiAgent 是一个轻量级的多 Agent 协作框架,支持 Agent 通信、DAG 任务编排和记忆系统。

🚀 特性

  • 🤖 Agent 通信:同步/异步消息传递、RPC 调用、广播
  • 📊 DAG 编排:任务依赖管理、并行执行、智能重试
  • 🧠 记忆系统:短期记忆、长期记忆、向量检索
  • 🔌 可扩展:模块化设计,易于扩展

📦 安装

pip install v1-multiagent

⚡ 快速开始

Agent 通信

import asyncio
from v1_multiagent import Agent, AgentNetwork, Message


class MyAgent(Agent):
async def process(self, message):
return Message(
sender=self.name,
receiver=message.sender,
content=f"处理: {message.content}"
)




async def main():
network = AgentNetwork()
agent = MyAgent("assistant", network.bus)
network.add_agent(agent)
await network.start()



# RPC 调用
response = await network.call("client", "assistant", "Hello")
print(response.content)




asyncio.run(main())

asyncio.run(main())

DAG 任务编排

from v1_multiagent import WorkflowBuilder, DAGExecutor


async def task1(context):
return {"data": [1, 2, 3]}




async def task2(context):
return {"result": sum(context["results"]["task1"]["data"])}




workflow = (
WorkflowBuilder("pipeline")
.task("fetch", task1)
.task("sum", task2)
.build()
)




executor = DAGExecutor(max_parallel=2)
result = await executor.execute(workflow)
print(result)

executor = DAGExecutor(max_parallel=2) result = await executor.execute(workflow) print(result)

记忆系统

from v1_multiagent import MemorySystem, MemoryType, MemoryImportance


memory = MemorySystem()



存储记忆



await memory.remember("用户问题", MemoryType.EPISODIC, MemoryImportance.HIGH)



检索记忆



results = await memory.recall("用户")
print(results)

results = await memory.recall("用户") print(results)

📊 与主流框架对比

框架通信方式DAG记忆代码量特点
V1-MultiAgentRPC+广播~1000行轻量级
AutoGen对话--~5000行Microsoft
CrewAI任务分解-~3000行结构化
LangChain工具调用~10000行生态丰富

🛠 技术栈

  • Python 3.10+
  • asyncio 异步编程
  • SQLite 本地存储

📄 许可证

MIT License


⭐ Star us on GitHub if you find this useful!
GitHub: github.com/V1MultiAgen…