feat: !include YAML tag for external file references in workflow definitions #582

Closed
opened 2026-05-31 04:04:31 +00:00 by xiaomo · 0 comments
Owner

Summary

Workflow YAML 定义中支持 !include 自定义 tag,加载时将其替换为引用文件的内容。

Motivation

YAML 原生不支持跨文件引用。当 system prompt 或 schema 较长时,内联在 YAML 中可读性差、难以复用。

Proposed Solution

在 uwf 引擎层实现 !include tag 预处理:

roles:
  analyst:
    system: !include roles/analyst.md
    outputSchema: !include schemas/analyst.json

引擎加载 YAML 时解析 !include tag,将其替换为目标文件的内容。路径相对于 workflow YAML 文件所在目录解析。

这是业界常见做法(Docker Compose、Ansible 等都有类似机制)。

Implementation Notes

  • yaml npm 包支持自定义 tag(customTags)
  • .md 文件读取为 string
  • .json / .yaml / .yml 文件解析为对应数据结构
  • 路径相对于 workflow YAML 所在目录
  • 不支持递归 include(防止循环引用)
## Summary Workflow YAML 定义中支持 `!include` 自定义 tag,加载时将其替换为引用文件的内容。 ## Motivation YAML 原生不支持跨文件引用。当 system prompt 或 schema 较长时,内联在 YAML 中可读性差、难以复用。 ## Proposed Solution 在 uwf 引擎层实现 `!include` tag 预处理: ```yaml roles: analyst: system: !include roles/analyst.md outputSchema: !include schemas/analyst.json ``` 引擎加载 YAML 时解析 `!include` tag,将其替换为目标文件的内容。路径相对于 workflow YAML 文件所在目录解析。 这是业界常见做法(Docker Compose、Ansible 等都有类似机制)。 ## Implementation Notes - `yaml` npm 包支持自定义 tag(customTags) - `.md` 文件读取为 string - `.json` / `.yaml` / `.yml` 文件解析为对应数据结构 - 路径相对于 workflow YAML 所在目录 - 不支持递归 include(防止循环引用)
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/workflow#582