本页内容
Sommatic 文档
打开控制台

资源文件

每个工作流或知识资源都是一个带 sommatic 头部的 JSON 文件。工作流采用 Studio 导出格式并保持节点 id 稳定;运行时字段从不保存。

以 Markdown 查看
在以下应用中打开

资源文件是一个工作流或一个知识资源的定义,写成便于在 Pull Request 中评审、并能加载到任何安装实例的形式。 它包含说明自身类型的头部、资源字段,以及在所有依赖安装实例的位置上使用的令牌。

头部

每个文件都以 sommatic 对象开头:

JSON
{
  "sommatic": {
    "kind": "workflow",
    "key": "support.triage",
    "schema_version": "1.0"
  }
}
字段说明
kindworkflow 或 knowledge-resource。
key与包清单中该文件的 key 相同。
schema_version固定为 1.0。

JSON Schema 发布在 https://docs.sommatic.ai/schemas/git-sync/resource-header.schema.json。

工作流文件

工作流文件采用 Studio 导出格式(__export_version 为 2.0)再加上头部。除描述性字段(name、slug、 description、tags 等)外,还包含草稿:

  • draft_nodes:节点,每个节点包含 node_id、label、operator_slug、operator_version、config 和 ports。
  • draft_edges:连线,{ from: { node_id, port }, to: { node_id, port } }。
  • editor_state:画布布局,其中 node_positions 以 node_id 为键。

一个小例子:Webhook 接收请求,再用各安装实例各自的大模型提供方对请求分类:

JSON
{
  "__export_version": "2.0",
  "description": "Classifies inbound support requests.",
  "draft_edges": [
    {
      "from": { "node_id": "node-webhook", "port": "out" },
      "id": "edge-webhook-classify",
      "to": { "node_id": "node-classify", "port": "in" }
    }
  ],
  "draft_nodes": [
    {
      "config": { "method": "POST", "response_mode": "immediate" },
      "label": "Webhook Receiver",
      "node_id": "node-webhook",
      "operator_slug": "webhook.trigger",
      "operator_version": "1.0.0",
      "ports": [
        { "is_default": true, "label": "Received", "port_id": "out" },
        { "label": "Error", "port_id": "error" }
      ]
    },
    {
      "config": {
        "invocation_mode": "sync",
        "labels": ["billing", "technical", "other"],
        "llm_provider_id": "@@env.LLM_PROVIDER_ID@@",
        "text": "{{ $json.body.message }}"
      },
      "label": "Classify request",
      "node_id": "node-classify",
      "operator_slug": "ai.classify",
      "operator_version": "1.0.0",
      "ports": [
        { "is_default": true, "label": "Classified", "port_id": "success" },
        { "label": "Error", "port_id": "error" }
      ]
    }
  ],
  "editor_state": {
    "node_positions": {
      "node-classify": { "x": 320, "y": 0 },
      "node-webhook": { "x": 0, "y": 0 }
    }
  },
  "name": "Support triage",
  "slug": "support-triage",
  "sommatic": { "key": "support.triage", "kind": "workflow", "schema_version": "1.0" }
}

每个节点的 config 和 ports 以节点目录中该节点的页面为准,例如 webhook.trigger 和 ai.classify。

保持 node_id 稳定

Sommatic AI 按 node_id 比较节点。编辑节点时请保留它的 id:这样预览会把它报告为“已变更”,以 from: live 声明的密钥会保留原值,布局也不会变化。换成新 id 则意味着删除了一个节点、又新增了一个节点。

知识资源文件

知识资源文件包含资源字段(name、slug、description、resource_type、language、tags、governance、 capabilities、content 等),头部中为 "kind": "knowledge-resource"。

从不保存的内容

运行时字段属于各个安装实例,从不写入文件:id、created、modified、status、execution_state、 latest_version_id 和 version_counter。资源头部 Schema 会拒绝包含其中任一字段的文件。

格式

请按 Sommatic AI 导出的方式书写文件,以保持 diff 简洁:键按字母排序、两个空格缩进、文件末尾保留换行。 获得准确格式最简单的方法,是从 Studio 中的 Export for Git… 开始(参见导出与解除关联)。

下一步

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

仅安装技能包,不会自动更新;需要时重新运行即可。

npx skills add https://docs.sommatic.ai
智能体如何读取本文档