scenario-workflow-authoring

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Scenario Workflow Authoring

Scenario 工作流创作

Overview

概述

A workflow has two representations:
editor_info
(the editable node graph:
nodes
,
edges
,
inputKeys
) and
flow
(the compiled runnable form). Authoring through MCP means writing the whole
editor_info
document: there are no per-node editing tools; every change is a read, modify, write of the full graph through
workflow_create
or
workflow_update
. Never hand-write
flow
:
workflow_publish
compiles
editor_info
into it and flips status to
ready
. Editing a ready workflow's
editor_info
leaves the stale
flow
running until you publish again.
Read references/editor-info.md before writing any graph: it holds the node type vocabulary, the node choice doctrine (when an
llm
node is legitimate), the edge direction rule, per-node data contracts, and a validated minimal example. Create, update, publish, copy and delete live in the tool catalog (
scenario_tools_search
plus the matching executor, see the
scenario
skill).
workflows_list
,
workflow_get
and
workflow_run
are direct tools: scope and
dry_run
go in their top-level arguments, never an executor wrapper. Running and pricing: the
scenario-workflows
skill. If a sibling skill named here is missing from your available skills, ask the user to install it (
npx skills add scenario-labs/skills --skill <name>
); unattended, proceed from tool schemas and flag the gap.
工作流有两种表现形式:
editor_info
(可编辑的节点图,包含
nodes
、
edges
、
inputKeys
)和
flow
(编译后的可运行形式)。通过MCP进行创作意味着编写完整的
editor_info
文档:没有单节点编辑工具;每次修改都是通过
workflow_create
或
workflow_update
对完整图进行读取、修改、写入的操作。切勿手动编写
flow
:
workflow_publish
会将
editor_info
编译为
flow
并将状态切换为
ready
。编辑已就绪工作流的
editor_info
后,旧的
flow
仍会继续运行,直到你重新发布。
在编写任何图之前,请先阅读references/editor-info.md:该文档包含节点类型词汇表、节点选择原则(何时使用
llm
节点是合理的)、边的方向规则、各节点的数据契约,以及一个经过验证的最小示例。创建、更新、发布、复制和删除操作位于工具目录中(
scenario_tools_search
加上对应的执行器,参见
scenario
技能)。
workflows_list
、
workflow_get
和
workflow_run
是直接工具:scope和
dry_run
放在它们的顶层参数中,切勿使用执行器包装。运行和定价相关内容请参考
scenario-workflows
技能。如果你的可用技能中缺少此处提到的同级技能,请让用户安装(命令:
npx skills add scenario-labs/skills --skill <name>
);如果处于无人值守模式,请根据工具模式继续操作并标记缺失的技能。

Quick reference

快速参考

StepCallNotes
1. Study a graph
workflow_get
on a working workflow
Copy the shape, never ids
2. Model contract
model_schema_get
Handle names and required inputs
3. Author
editor_info
+
inputs_definition
Per the reference file
4. Create
workflow_create
Non-atomic, see below
5. Publish
workflow_publish
Compiles
flow
, needs input+output pins
6. Validate
workflow_run
with
dry_run=true
Prices and runs the real validator
workflow_create
is two calls under the hood: a failed create may still have created a draft whose id is in the error. Recover with
workflow_update
on that id; re-creating duplicates. Seed step 1 with
workflow_get
: it returns the full graph of any workflow whose id you have, public ones included (an id or app URL the user supplies, or your own team's from
workflows_list
). To find a public template, use
search
with
target="workflows"
,
public=true
, a keyword
query
,
limit=3
, and your scope; for example,
query="image"
with raw
filter: 'status = "ready"'
. Read ids from
workflows
, then fetch the chosen graph with
workflow_get
; search hits are summaries, not graph documents. Workflow search supports keyword text and filters only, so omit image and semantic options. Use
workflows_list
for browsing your saved workflows. scripts/fetch_workflow_examples.py bulk-exports trimmed featured-workflow graphs for maintainers (setup in its header).
步骤调用方式说明
1. 研究参考图对可用工作流调用
workflow_get
复制结构,切勿复制ID
2. 模型契约
model_schema_get
处理名称和必填输入
3. 创作
editor_info
+
inputs_definition
遵循参考文档要求
4. 创建
workflow_create
非原子操作,见下文
5. 发布
workflow_publish
编译
flow
,需要输入+输出引脚
6. 验证带
dry_run=true
的
workflow_run
调用
进行定价并运行真实验证器
workflow_create
底层实际上是两次调用:创建失败时可能已经生成了一个草稿,其ID会包含在错误信息中。请使用该ID调用
workflow_update
来恢复;重复创建会产生重复项。第一步可以从调用
workflow_get
开始:只要你有工作流的ID,它就能返回完整的图,包括公开的工作流(用户提供的ID或应用URL,或者你自己团队在
workflows_list
中的工作流)。要查找公开模板,请使用
search
,设置
target="workflows"
、
public=true
、关键词
query
、
limit=3
以及你的scope;例如,
query="image"
加上原始过滤条件
filter: 'status = "ready"'
。从
workflows
中读取ID,然后用
workflow_get
获取选中的图;搜索结果是摘要,不是完整的图文档。工作流搜索仅支持关键词文本和过滤,因此请省略图像和语义选项。使用
workflows_list
浏览你保存的工作流。scripts/fetch_workflow_examples.py 用于为维护人员批量导出精简后的精选工作流图(配置说明在文件头部)。

Worked example: a text-to-image app

示例:文本生成图像应用

  1. recommend
    with
    capability: "txt2img"
    and the user's brief as
    prompt
    , following the
    scenario
    skill's
    next_step
    discipline, then
    model_schema_get
    : its input names become the model node's handle names, and its
    required
    flag marks what must be wired. Use
    search
    instead when the user names a model.
  2. Author
    editor_info
    :
    text1
    with
    data.isInput: true
    ,
    model1
    with
    type: "model"
    ,
    data.modelId
    and
    data.isOutput: true
    , one edge from
    model1
    's input to
    text1
    's output (edges name the downstream node as
    source
    , see the reference),
    inputKeys: ["text1"]
    .
  3. workflow_create
    with
    name
    ,
    editor_info
    , and
    inputs_definition
    naming
    text1
    as a string input. The published input key is the node id, which is why run inputs have names like
    text1
    .
  4. workflow_publish
    , then
    workflow_run
    with
    dry_run=true
    to validate and price. Fix the graph and re-publish if validation fails.
  1. 调用
    recommend
    ,设置
    capability: "txt2img"
    ,将用户的需求简报作为
    prompt
    ,遵循
    scenario
    技能的
    next_step
    规范,然后调用
    model_schema_get
    :它的输入名称将成为模型节点的句柄名称,其
    required
    标记会标明哪些必须连接。如果用户指定了模型名称,则改用
    search
    。
  2. 编写
    editor_info
    :
    text1
    节点设置
    data.isInput: true
    ,
    model1
    节点设置
    type: "model"
    、
    data.modelId
    和
    data.isOutput: true
    ,添加一条从
    model1
    的输入到
    text1
    的输出的边(边将下游节点记为
    source
    ,参见参考文档),设置
    inputKeys: ["text1"]
    。
  3. 调用
    workflow_create
    ,传入
    name
    、
    editor_info
    ,以及将
    text1
    列为字符串输入的
    inputs_definition
    。发布后的输入键就是节点ID,这就是运行时输入名称类似
    text1
    的原因。
  4. 调用
    workflow_publish
    ,然后使用
    dry_run=true
    调用
    workflow_run
    进行验证和定价。如果验证失败,请修复图并重新发布。

Migrating a graph from another node tool

从其他节点工具迁移图

A pipeline exported by Weavy, ComfyUI, or another node editor does not import: only Scenario's own export round-trips. It is translated node by node, then created, published, and dry-run as above. The mapping table, member resolution, and the report the user gets are in references/foreign-graph-import.md; read it before touching such an export, since its first rule is to reduce the file to a table locally rather than paste it into the conversation.
Weavy、ComfyUI或其他节点编辑器导出的流水线无法直接导入:只有Scenario自身的导出格式支持往返导入。需要逐节点进行转换,然后按照上述步骤创建、发布并试运行。映射表、成员解析以及用户会收到的报告都在references/foreign-graph-import.md中;在处理此类导出文件之前请先阅读该文档,因为它的第一条规则是先在本地将文件整理为表格,而不是直接粘贴到对话中。

Common mistakes

常见错误

  • Writing UI palette names as node types: persisted types are the camelCase vocabulary in the reference, and every generator is
    type: "model"
    .
  • Wiring edges producer to consumer: persisted edges point the other way.
  • Expecting an
    editor_info
    update to change a live app without re-publishing.
  • Retrying a failed
    workflow_create
    with a second create instead of
    workflow_update
    on the id from the error.
  • Publishing with no pins: at least one
    data.isInput
    node listed in
    inputKeys
    and one
    data.isOutput
    node.
  • Gating a text node in front of a builder or model: a branch skips only the node wired to its handle, so the consumer stays pending and the job never completes. Gate the node that does the work, or use a CEL ternary for conditional prompt text, per the reference's
    ifElse
    section.
  • Double-quoted CEL literals: they evaluate but corrupt the canvas editor, single quotes only.
  • Sending
    workflow_id
    to
    workflow_copy
    : get, update, publish, run and delete take
    workflow_id
    , but copy takes
    source_workflow_id
    ; the copy inherits everything verbatim and needs its own publish.
  • 将UI面板名称当作节点类型:持久化的类型是参考文档中的驼峰命名词汇,所有生成器的类型都是
    type: "model"
    。
  • 错误地将边从生产者连接到消费者:持久化存储的边方向相反。
  • 以为更新
    editor_info
    就能修改已上线的应用,而不需要重新发布。
  • 失败的
    workflow_create
    重试时再次调用创建接口,而不是使用错误信息中的ID调用
    workflow_update
    。
  • 发布时没有引脚:至少需要有一个列在
    inputKeys
    中的
    data.isInput
    节点,以及一个
    data.isOutput
    节点。
  • 在构建器或模型前面的文本节点上设置门控:分支只会跳过连接到其句柄的节点,因此消费者会一直处于待处理状态,任务永远不会完成。应该在执行实际工作的节点上设置门控,或者根据参考文档的
    ifElse
    部分,使用CEL三元表达式实现提示词文本的条件判断。
  • CEL字面量使用双引号:双引号虽然能正常求值,但会损坏画布编辑器,请仅使用单引号。
  • 向
    workflow_copy
    传入
    workflow_id
    :获取、更新、发布、运行和删除操作使用
    workflow_id
    ,但复制操作使用的是
    source_workflow_id
    ;副本会原样继承所有内容,需要单独发布。",