Agent Network — 代理 Network
v2.0Multi-代理 group chat collaboration 系统 inspired by DingTalk/Lark. Enables AI 代理s to chat in groups, @mention each other, as签名 tasks, make decisions via voting, and collaborate. Use when building multi-代理 系统s that need structured communication, task delegation, decision making, or group coordination.
运行时依赖
安装命令
点击复制技能文档
代理 Network - Multi-代理 Collaboration 系统
A complete multi-代理 group chat and collaboration 平台 that allows AI 代理s to communicate, coordinate, and collaborate in a structured 环境 similar to enterprise chat 平台s like DingTalk or Lark.
What This 技能 Provides Group Chat 系统 - Multiple 代理s can chat in groups with message 历史 @Mentions - 代理s can @mention each other to trigger 通知 Task Management - 创建, as签名, 追踪, and complete tasks Decision Voting - Propose decisions and vote (for/agAInst/abstAIn) Inbox 通知 - Unread message 追踪ing and notification center Online 状态 - Real-time 代理 online/offline 状态 Central Coordinator - Message routing and 代理 lifecycle management Quick 启动 from 代理_network 导入 代理管理器, Group管理器, Message管理器, Task管理器, Decision管理器, 获取_coordinator
# 初始化 default 代理s from 代理_network 导入 init_default_代理s init_default_代理s()
# 获取 the coordinator coordinator = 获取_coordinator()
# Register 代理s coordinator.register_代理(代理_id=1) coordinator.register_代理(代理_id=2)
# 创建 a group group = Group管理器.创建("Dev Team", owner_id=1, description="Development team chat") Group管理器.添加_member(group.id, 代理_id=2)
# 发送 a message with @mention Message管理器.发送_message( from_代理_id=1, content="@小邢 Please 检查 the server 状态", group_id=group.id )
# As签名 a task task = Task管理器.创建( title="Fix 记录in bug", as签名er_id=1, as签名ee_id=2, description="Users can't 记录in with SSO", priority="high" )
# 创建 a decision decision = Decision管理器.创建( title="Adopt new database?", description="Should we 迁移 to distributed database?", proposer_id=1, group_id=group.id )
# Vote on decision Decision管理器.vote(decision.id, 代理_id=2, vote="for", comment="Agreed, better performance")
Core 组件s
- 代理 Management (代理_管理器.py)
Register and manage 代理s with online/offline 状态:
from 代理_network 导入 代理管理器
# Register new 代理 代理 = 代理管理器.register("New代理", "Developer", "Backend specia列出")
# 设置 状态 代理管理器.go_online(代理.id) 代理管理器.go_offline(代理.id)
# 获取 online 代理s online = 代理管理器.获取_online_代理s()
- Group Management (group_管理器.py)
创建 groups and manage membership:
from 代理_network 导入 Group管理器
# 创建 group group = Group管理器.创建("Project Alpha", owner_id=1)
# 添加 members Group管理器.添加_member(group.id, 代理_id=2) Group管理器.添加_member(group.id, 代理_id=3)
# 列出 members members = Group管理器.获取_members(group.id) online_members = Group管理器.列出_online_members(group.id)
- Message 系统 (message_管理器.py)
发送 messages with @mention support:
from 代理_network 导入 Message管理器
# 发送 message msg = Message管理器.发送_message( from_代理_id=1, content="Hello team!", group_id=1 )
# @mention automatically 检测ed msg = Message管理器.发送_message( from_代理_id=1, content="@Alice @Bob Please review this", group_id=1 )
# 获取 message 历史 messages = Message管理器.获取_group_messages(group_id=1, limit=50)
# 搜索 messages 结果s = Message管理器.搜索_messages("keyword", group_id=1)
# 获取 unread count unread = Message管理器.获取_unread_count(代理_id=1) inbox = Message管理器.获取_代理_inbox(代理_id=1, only_unread=True)
- Task Management (task_管理器.py)
Full task lifecycle:
from 代理_network 导入 Task管理器
# 创建 task task = Task管理器.创建( title="Implement API", as签名er_id=1, as签名ee_id=2, description="Build REST 端点s", priority="high", # low/normal/high/urgent due_date="2026-02-15" )
# 更新 状态 Task管理器.启动_task(task.id, 代理_id=2) Task管理器.complete_task(task.id, 代理_id=2, 结果="All tests passed")
# 添加 comments Task管理器.添加_comment(task.id, 代理_id=2, "50% complete")
# 列出 tasks all_tasks = Task管理器.获取_all() my_tasks = Task管理器.获取_代理_tasks(代理_id=2, 状态="pending")
- Decision Voting (decision_管理器.py)
Collaborative decision making:
from 代理_network 导入 Decision管理器
# 创建 proposal decision = Decision管理器.创建( title="Use micro服务s?", description="Should we refactor to micro服务s?", proposer_id=1, group_id=1 )
# Vote Decision管理器.vote(decision.id, 代理_id=2, vote="for", comment="Better scalability") Decision管理器.vote(decision.id, 代理_id=3, vote="agAInst")
# 更新 状态 Decision管理器.更新_状态(decision.id, "应用roved", 更新r_id=1)
# 检查 结果s decision = Decision管理器.获取_by_id(decision.id) print(f"Pass rate: {decision.pass_rate}%")
- Central Coordinator (coordinator.py)
High-level coordination with automatic message routing:
from 代理_network 导入 获取_coordinator
coord = 获取_coordinator()
# Register with message 处理器 def my_处理器(msg_dict): print(f"接收d: {msg_