🟢 开始节点 与 🔴 结束节点说明(结构化版)
一、开始节点(Start Node)
功能定位
- 是工作流的起始节点 ,用于触发工作流执行。
- 用于定义启动工作流所需的输入信息。
- 只有输入参数,无输出、无逻辑处理。
默认参数
- 默认包含一个输入参数:
input- 含义:用户在本轮对话中输入的原始内容(通常用于对话型智能体)。
自定义参数
- 可按需添加其他输入参数。
- 支持多种数据类型:
String、Number、Boolean、Object、Array等。- Object 类型最多支持 3 层嵌套。
参数配置方式
- 手动添加
- 直接设置参数名称、类型、是否必填、描述等。
- JSON 批量导入
- 点击"导入"图标 → 在弹出面板中输入 JSON 数据 → 点击"同步 JSON 到节点" → 自动解析并创建输入参数。
参数属性说明
| 属性 | 说明 |
|---|---|
| 参数描述 | 帮助大模型理解该参数的语义和用途。 当工作流绑定到智能体时,模型会自动从用户 Query 中提取信息并填充对应参数。 |
| 是否必选 | - 若为必选,且用户未提供,则无法启动工作流 。 - 在智能体场景中,若用户 Query 缺少必选参数,不会触发该工作流。 |
二、结束节点(End Node)
功能定位
- 是工作流的最终节点 ,用于返回执行结果。
- 支持两种返回模式:返回变量 或 返回文本。
模式 1:返回变量(Return Variables)
适用场景
- 工作流作为子流程被调用。
- 工作流结果需用于卡片展示 、后续逻辑处理 或API 输出。
输出格式
- 以 JSON 格式 返回所有配置的输出参数。
数据类型支持
- 支持
String、Number、Boolean、Object、Array等。 - Object 类型最多支持 3 层嵌套。
智能体中的行为
- 若工作流直接绑定到智能体:
- 大模型会自动解析 JSON 结果;
- 并将其转化为自然语言回复给用户(无需手动拼接文本)。
模式 2:返回文本(Return Text)
适用场景
- 希望直接控制最终回复内容。
- 需要定制化话术 或流式输出。
配置项说明
| 配置项 | 说明 |
|---|---|
| 输出变量 | 定义可供外部使用的变量(如用于卡片渲染)。 这些变量可在"回答内容"中被引用。 |
| 回答内容 | - 工作流最终返回给用户的对话文本 。 - 不可为空 。 - 支持引用输出变量,语法为:{``{变量名}}。 例如:文章主题是:{``{topic}} - 支持流式输出(逐字生成回复)。 |
✅ 总结对比
| 特性 | 开始节点 | 结束节点 |
|---|---|---|
| 作用 | 触发工作流,接收输入 | 返回结果,结束流程 |
| 参数方向 | 仅输入 | 仅输出 |
| 默认参数 | input(用户原始输入) |
无默认,需手动配置 |
| 数据类型限制 | Object ≤ 3 层嵌套 | Object ≤ 3 层嵌套 |
| 智能体集成行为 | 自动提取 Query 填参 | 自动总结 JSON 或按模板回复 |
| 配置灵活性 | 支持 JSON 批量导入 | 支持变量引用与文本模板 |
此整理完全保留原始语义,仅优化逻辑结构与排版,适用于技术文档、开发手册或教学材料。如需生成示例 YAML 配置或对比图示,也可继续提出!
以下是根据您提供的 开始节点 与 结束节点 功能说明,生成的 完整示例 YAML 配置,包含两种典型场景:
- ✅ 场景 1:返回变量模式(适用于子流程/卡片)
- ✅ 场景 2:返回文本模式(适用于直接对话回复)
所有配置均符合您之前提供的 DSL 规范(schema_version: 1.0.0),并附带详细中文注释,可直接用于平台导入或文档示例。
📄 示例 1:返回变量模式(Return Variables)
schema_version: 1.0.0
name: workflow_return_variables
description: 示例:使用结束节点返回结构化变量
mode: workflow
icon: plugin_icon/workflow.png
nodes:
# === 开始节点 ===
- id: "100001"
type: start
title: 开始
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg
description: 定义工作流启动所需参数
position:
x: 200
y: 100
parameters:
node_outputs:
# 用户输入的原始内容(默认)
input:
type: string
required: false
description: 用户本轮对话的原始输入
# 自定义必填参数:文章URL
article_url:
type: string
required: true
description: 待处理的文章链接
# 自定义可选参数:摘要长度(整数)
summary_length:
type: integer
required: false
description: 期望的摘要字数,默认200
# 嵌套对象参数(2层)
user_profile:
type: object
required: false
description: 用户偏好设置
properties:
name:
type: string
required: true
preferences:
type: object
required: false
properties:
language:
type: string
required: false
# === 模拟处理节点(此处简化,实际可为 LLM 或插件)===
- id: "200001"
type: llm
title: 模拟处理
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-LLM-v2.jpg
description: 模拟生成结构化结果
position:
x: 600
y: 100
parameters:
llmParam:
- name: systemPrompt
input:
type: string
value: "你是一个助手,根据输入生成结构化输出。"
- name: modelName
input: {type: string, value: "豆包·工具调用"}
node_inputs:
- name: input
input:
value:
ref_node: "100001"
path: "input"
- name: url
input:
value:
ref_node: "100001"
path: "article_url"
node_outputs:
topic: {type: string, description: "文章主题"}
summary: {type: string, description: "摘要内容"}
tags: {type: array, items: {type: string}, description: "标签列表"}
metadata:
type: object
properties:
processed_at: {type: string}
length: {type: integer}
# === 结束节点:返回变量模式 ===
- id: "900001"
type: end
title: 结束
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg
description: 以 JSON 格式返回结果
position:
x: 1000
y: 100
parameters:
node_inputs:
- name: topic
input:
type: string
value:
ref_node: "200001"
path: "topic"
- name: summary
input:
type: string
value:
ref_node: "200001"
path: "summary"
- name: tags
input:
type: array
items: {type: string}
value:
ref_node: "200001"
path: "tags"
- name: metadata
input:
type: object
properties:
processed_at: {type: string}
length: {type: integer}
value:
ref_node: "200001"
path: "metadata"
terminatePlan: returnVariables # 关键:返回变量模式
edges:
- source_node: "100001"
target_node: "200001"
- source_node: "200001"
target_node: "900001"
📄 示例 2:返回文本模式(Return Text)
schema_version: 1.0.0
name: workflow_return_text
description: 示例:使用结束节点返回自然语言文本
mode: workflow
icon: plugin_icon/workflow.png
nodes:
# === 开始节点 ===
- id: "100001"
type: start
title: 开始
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg
description: 接收用户输入
position:
x: 200
y: 100
parameters:
node_outputs:
product_name:
type: string
required: true
description: 商品名称
user_name:
type: string
required: false
description: 用户姓名
# === 处理节点(模拟)===
- id: "200002"
type: llm
title: 生成推荐语
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-LLM-v2.jpg
position:
x: 600
y: 100
parameters:
llmParam:
- name: systemPrompt
input:
type: string
value: "根据商品名生成一句推荐语。"
- name: modelName
input: {type: string, value: "豆包·工具调用"}
node_inputs:
- name: product
input:
value:
ref_node: "100001"
path: "product_name"
node_outputs:
recommendation: {type: string, description: "推荐语"}
# === 结束节点:返回文本模式 ===
- id: "900002"
type: end
title: 结束
icon: https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg
description: 返回自然语言回复
position:
x: 1000
y: 100
parameters:
# 定义输出变量(可用于卡片)
node_inputs:
- name: final_recommendation
input:
type: string
value:
ref_node: "200002"
path: "recommendation"
# 关键:返回文本模式
terminatePlan: returnText
# 回答内容(必须非空,支持变量引用)
responseText: "您好{{user_name}}!我们为您推荐:{{final_recommendation}}。欢迎选购!"
edges:
- source_node: "100001"
target_node: "200002"
- source_node: "200002"
target_node: "900002"
💡 注意:在
responseText中,{``{user_name}}直接引用了开始节点的输入参数 (平台会自动传递上下文),而{``{final_recommendation}}引用了结束节点中定义的输出变量。
🖼️ 对比图示(文字版)
| 项目 | 返回变量模式 | 返回文本模式 |
|---|---|---|
| 结束节点配置 | terminatePlan: returnVariables |
terminatePlan: returnText |
| 输出内容 | JSON 对象(结构化) | 字符串(自然语言) |
| 回答内容字段 | 无 | 必须提供 responseText |
| 变量引用方式 | 在 node_inputs 中映射路径 |
在 responseText 中用 {``{var}} |
| 适用场景 | 子流程、API、卡片渲染 | 直接对话回复、客服话术 |
| 智能体行为 | 自动总结 JSON → 自然语言 | 直接输出 responseText |