1 EntityModel
shaotao edited this page 2026-06-11 07:26:04 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

实体模型

毕织流模板系统的核心概念模板、节点、Role、Tool。

四层结构

模板(协作模式)
  └── 定义节点之间的协作关系(骨架),如:对偶机、链式、分段审议
        │
        └── 节点(可执行单元)
              ├── 复合节点(子树):自身是一个完整的状态机 DSL
              │     └── 可递归展开,内部仍可包含子节点
              └── 叶子节点
                    ├── Role状态机 DSL + prompt + 动作函数(最小独立执行单元)
                    └── Tool单个动作函数最细粒度如 MCP 工具)

模板 Template

定义多个节点之间的协作关系。不关心节点内部实现。

{
  "name": "对偶机",
  "description": "两个互相影响的独立状态机系统",
  "slots": [
    {"name": "left", "accepts": ["node", "role"], "description": "输出方"},
    {"name": "right", "accepts": ["node", "role"], "description": "反馈方"}
  ],
  "event_mapping": {
    "left_output": {"target": "right", "event": "INPUT"},
    "right_feedback": {"target": "left", "event": "FEEDBACK"}
  }
}

节点 Node

可执行单元。可以是复合节点子树或叶子节点Role/Tool

{
  "name": "ScannerAgent",
  "type": "composite",  // 或 "role" 或 "tool"
  "dsl": { ... },       // 状态机 DSL 定义
  "actions": { ... },   // 动作函数映射
  "prompt": "",         // Role 的 system prompt
  "slots": []           // 如果是复合节点,可继续定义子槽位
}

Role

带 prompt 的最小独立执行单元。不能再拆分。

Tool

最细粒度的可执行单元,单一动作函数。

关系总结

  • 模板 ≠ 节点:模板描述"怎么协作",节点描述"怎么做事"
  • 复合节点 = 子树:可继续展开
  • Role = 叶子节点:带 prompt 的独立执行者
  • Tool = 叶子节点:单一工具函数

相关 Issue