跳转至

多智能体框架

TongAgents 基于 tong-cell 多智能体框架,提供强大的多智能体系统构建能力。

核心概念

Actor

Actor 是 Runtime 的基本调度单元,能够处理所接收到的消息。Actor 可以是有智能性的 Agent,也可以是无智能性的单元。

Runtime

Runtime 是 Actor 的容器,负责管理 Actor 的运行,以及 Actor 间的通信。

核心特性

动态编排

  • Actor 由 Runtime 按需动态创建
  • Actor 的生命周期由 Runtime 管理
  • Actor 数量无需提前确定,运行过程中动态变化
  • Actor 的下游由 Actor 自身动态决定

消息驱动

  • Actor 不直接调用其它 Actor
  • 通过消息和 ActorId/TopicId 通信
  • Actor 相互独立不耦合
  • Actor 并发运行,每个 Actor 都有自己的消息循环

多种通信方式

方式 类型 说明
send 异步 点对点异步通信,消息发送后即返回
request 同步 点对点同步通信,等待对方处理完并返回结果
publish 发布订阅 实现 Actor 间解耦

分布式架构支持

  • Actor 寻址:Runtime 自动寻址,消息送达透明
  • 身份对等:不同节点间的通信是双向的
  • 多消息格式:支持 dataclass、pydantic model、protobuf
  • 无痛迁移:LocalRuntime 开发的 Actor 可直接迁移到 NetworkRuntime

平台模式

tong-cell 支持多种平台模式:

  • round_robin_example:轮询模式
  • swarm_example:蜂群模式
  • supervisor_example:Supervisor 模式
  • graph_example:图模式
  • group_example:组合格式
  • hierarchical_example:层级模式
  • human_in_the_loop:人在回路模式

快速开始

coming soon...