字段
{
"id": "draft-reply",
"label": "Draft the reply",
"intent": "Draft a reply to the customer message in _watch_payload using the reply-drafting skill.",
"skills": ["reply-drafting"],
"requires_tools": ["mail_message_send"],
"on_error": { "retry": 1, "fallback": "notify_owner" }
} | 字段 | 默认值 | 含义 |
|---|---|---|
id | 必填 | 在工作流内唯一。用于 connections 和数据路径。 |
type | custom | 员工步骤,或 condition、loop、wait、http、command、decide 之一。 |
intent | 无 | 员工应完成的事情。员工步骤需要 intent 或 steps。 |
steps | [] | 当一句话不够时,按顺序列出的指令。 |
label | 无 | 显示给所有者的名称。 |
skills | [] | 要使用的技能。此处列出的市场技能会随员工一起安装。 |
tools | [] | 设置后,此步骤只能使用这些工具。 |
requires_tools | [] | 必须成功执行、步骤才算完成的工具。 |
cmds | [] | 为此步骤指定的插件命令。 |
mcps | [] | 为此步骤指定的 MCP 服务器。 |
model | 无 | 此步骤使用的模型 ID。 |
params | 无 | 类型化活动的参数,以及员工步骤的 maxIterations。 |
min_iterations | 无 | 步骤可以结束前的最少模型轮数。 |
token_budget | 无 | {max}。估计值。 |
on_error | {retry: 1, fallback: notify_owner} | 重试次数,然后是后备处理。重试之后仍然失败,运行就会结束。 |
员工步骤
员工步骤作为员工的一轮运行:员工的角色设定、记忆和连接都会生效,它最多可以进行 50 轮模型交互,或按 params.maxIterations 设定。前面步骤的结果会以 [Activity 'id' result] 块的形式传入。以 emit 列表结束工作流的步骤,会被告知用这些事件调用 emit_event。exit 工具始终可用于结束运行。
数据上下文
类型化活动通过点路径从一个对象中读取值:inputs 包含本次运行的输入,nodes.<id> 包含每个已完成活动的输出(如果是 JSON 则解析为 JSON),item 包含循环中的当前项。不带前缀的路径会先在 inputs 中查找,然后在 nodes 中查找。
condition
{ "id": "large", "type": "condition", "params": { "expression": "inputs.amount >= 500" } } params.expression 是必填的。它的出向连接分别标记为 True 和 False。params.mode 决定如何解读它:
| 模式 | 表达式 |
|---|---|
expression | 默认模式。path op value,运算符为 ==、!=、>=、<=、> 或 <,两边都是数字时按数字比较;或者是一个纯路径,其值为真值时为 true。 |
exists | 一个路径;解析结果为真值时为 true。 |
contains | path contains text,或者与上一步输出进行匹配的纯文本。 |
regex | 与上一步输出进行匹配的模式。 |
loop
{ "id": "each-invoice", "type": "loop", "params": { "source": "nodes.fetch.invoices", "concurrency": 4 } } params.source 是一个列表的路径。标记为 Each item 的连接通向循环体,循环体会针对每一项运行一次,并设置 item;标记为 Done 的连接在所有项完成后运行。除非你设置 concurrency,否则各次迭代会同时开始。也接受 maxIterations 和 batchSize。
"connections": [
{ "from": "__trigger__", "to": "fetch" },
{ "from": "fetch", "to": "each-invoice" },
{ "from": "each-invoice", "to": "check", "label": "Each item" },
{ "from": "each-invoice", "to": "report", "label": "Done" }
] wait、http 和 command
{ "id": "pause", "type": "wait", "params": { "duration": "5m" } }
{ "id": "status", "type": "http", "params": { "url": "https://status.example.com/api", "method": "GET" } }
{ "id": "export", "type": "command", "params": { "command": "date -u" } } | 类型 | 必填 | 行为 |
|---|---|---|
wait | params.duration | 暂停一段时间,单位为 s、m 或 h。没有“等到某时”的功能;要在某个事件发生时恢复,请用该事件触发第二个工作流。 |
http | params.url | 发出请求。method、headers 和 body 为可选。 |
command | params.command | 运行一条 shell 命令。它的 stdout 就是该活动的输出。 |
decide
decide 活动会针对目前为止的工作提出类型化的问题,并记录结构化的答案,供 condition 据此路由。
{
"id": "triage",
"type": "decide",
"params": {
"questions": {
"urgency": { "type": "score", "instructions": "How urgent is this request?", "criteria": ["low", "normal", "high"] },
"refund": { "type": "noul", "instructions": "The customer is asking for money back." }
},
"default": { "urgency": "normal", "refund": false }
}
} | 问题类型 | criteria | 答案 |
|---|---|---|
choice | 选项到描述的对象,包含 2 到 255 个选项。 | choice、confidence 和 probabilities。 |
score | 2 到 10 个有序级别的列表。 | 从 0(第一个级别)往上的 score,以及 confidence。 |
noul | 无。 | noul,即该陈述成立的概率。 |
用 condition 根据答案进行路由,例如 nodes.triage.urgency.score >= 1.5。params.default 为每个问题提供无法作出判断时的安全答案;采用默认值的答案置信度为 0。没有默认值的问题不会得到答案,因此基于它的 condition 会走 False 边。
错误
on_error.retry 设置失败的活动重试几次;默认为 1。最后一次重试后运行结束,在默认的 fallback(即 notify_owner)下会通知所有者。Nebo 会在运行开始时检查每个类型化活动的必填参数,并拒绝指向未知活动的分支。