Skip to content

subagents: 为 Direct Subagent 研究可选的结构化结果合同 #155

Description

@tt-a1i

一句话结论

OpenPI Workflow child 已支持调用方提供 schema,并用 terminating structured_output 做运行时校验;Direct Subagent 仍只有 finalText

建议把“可选结构化交付”下沉为共享 child-session boundary 能力,让轻量 delegation 也能请求可验证结果,而不必为了一个 typed result 升级成 Workflow。

固定证据

对比固定在:

  • OpenPI main@2a69d3f32994da4123f1312b7fa84ef3d6119be1
  • OMP main@7623b960540518bb1291808bbae28332065e9dba

OMP 当前:

OpenPI 当前:

为什么值得讨论

Direct Subagent 更适合模型自由做简单 fan-out;Workflow 适合需要持久 run、replay、安全 sandbox、分阶段编排的任务。仅仅为了拿到结构化 findings 就要求 Workflow,会把正交的数据合同和更重的 orchestration lifecycle 绑在一起。

可选 schema 能减少父 Agent 对自然语言报告的脆弱解析,尤其适合:

  • code review findings:{severity,path,line,summary}
  • research evidence:{claim,source,confidence}
  • test matrix:{case,status,evidence}
  • 多 child 汇聚前的统一数据形状

OpenPI 应保留的优势

  • schema 是调用方可选机制,不变成默认工作流;
  • parent model 仍决定 fan-out、schema 和综合策略;
  • child authority 仍是 parent 与 role allowlist 的 fail-closed intersection;
  • 不引入 OMP 的递归 team、全局 hub 或第二套 Session;
  • ordinary delegation 无 schema 时保持当前轻量文本路径。

设计方向

优先抽出 Workflow 已有的 terminating structured-result contract,而不是再造另一种协议:

  • Direct spawn 可选 output_schema(名称需与现有 OpenPI/ Pi vocabulary 最终统一);
  • child 仅在 schema 存在时得到 terminating tool;
  • tool 必须在 child-safe 分类 drift guard 中显式归类;
  • parent 同时得到 bounded text projection 与 typed details;完整原始结果按现有 artifact 合同保存;
  • schema invalid、child 未提交、validation failed、aborted 必须是不同终态;
  • 是否允许纠错重试要有明确上限,不能无限延长 child lifecycle。

非目标

  • 不把所有 Direct Subagent 改成 structured-only;
  • 不要求 Workflow 迁移到 Direct Subagent;
  • 不让 schema 扩大 child tools 或权限;
  • 不在 prompt 中假装校验成功;
  • 不把任意大 JSON 内联进 parent context。

完成条件

  • 先提取 Direct / Workflow 共享的 child result contract,避免两套验证语义
  • 明确 absent schema、valid、invalid schema、missing submission、validation failure、abort/cancel 的终态
  • structured tool 通过 child boundary drift guard,且只在请求 schema 时存在
  • parent projection 有界,完整 artifact 有总字节/depth/node 上限
  • 覆盖 background auto-delivery、explicit wait、resume 与 compact display
  • 至少用 review/research fan-out 比较文本解析与 typed result 的成功率和 token
  • ordinary text-only spawn 的 schema 与 prompt 成本不回退

与现有 Issue 的关系

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions