文档首页/ 智果(AgentArts)智能体平台/ API参考/ 附录/ 调用工作流/智能体响应事件详细说明
更新时间:2026-10-26 GMT+08:00
分享

调用工作流/智能体响应事件详细说明

本文档面向调用工作流/智能体接口的开发者,详细说明工作流、单智能体、多智能体三种模式下返回的全部事件类型及其数据字段。

响应格式概述

调用工作流/智能体接口采用流式响应,返回格式为SSE(Server-Sent Events)。每个事件以“data: 前缀 + JSON” 分隔:

data: {"event":"start","createdTime":1697000000000}
data: {"event":"message","content":"你好","createdTime":1697000000001}
data: {"event":"end","createdTime":1697000000002}

客户端逐条解析JSON即可获取事件信息。

表1 通用字段说明

字段

类型

说明

event

string

事件类型名称。

createdTime

int

事件创建时间戳(毫秒)。

data

object

事件数据体,不同事件类型携带不同字段。

conversation_id

string

会话ID(部分事件携带)。

executionId

string

执行实例ID(部分事件携带)。

工作流(Workflow)模式事件

工作流模式按节点顺序/分支执行,事件流反映每个节点的执行状态和输出内容。

表2 事件清单

事件类型

说明

workflow_started

工作流开始执行。

node_started

某个节点开始执行。

node_finished

某个节点执行完成。

node_wait

节点等待用户输入(交互节点)。

workflow_node_message

节点详细执行信息(含输入输出)。

message

节点的流式输出内容。

workflow_finished

工作流执行结束。

exception

工作流执行异常。

error

工作流执行报错。

end

流式响应终止标识。

workflow_started:工作流开始

工作流启动时发送的第一个事件。

{
  "event": "workflow_started",
  "data": { "start_time": 1697000000000 },
  "createdTime": 1697000000000
}
表3 data字段

参数

类型

说明

start_time

int

工作流开始时间戳(毫秒)。

node_started:节点开始执行

某个节点开始执行时发送。由workflow_node_message事件拆分而来,反映节点启动状态。

{
  "event": "node_started",
  "data": {
    "node_id": "node_1",
    "node_name": "LLM节点",
    "node_type": "LLM",
    "node_status": "node_started",
    "status": { "code": 0, "desc": "succeeded" },
    "start_time": 1697000000000,
    "end_time": 1697000000000,
    "inputs": { "input1": "value" },
    "outputs": {},
    "execution_id": "exec_001"
  },
  "createdTime": 1697000000000
}
表4 data字段

参数

类型

说明

node_id

string

节点唯一标识。

node_name

string

节点名称。

node_type

string

节点类型(见表5)。

node_status

string

节点状态。

  • node_started:节点开始执行。
  • node_finished:节点执行完成。
  • node_wait:节点等待用户输入。

status

object

执行状态 {code, desc}。

node_started时固定为 {code:0, desc:"succeeded"}。

node_finished、node_wait的取值见node_finished:节点执行完成、node_wait:节点等待用户输入。

start_time

int

节点开始时间戳(毫秒)。

end_time

int

节点结束时间戳(毫秒)。

inputs

object

节点输入参数。

outputs

object

节点输出结果。

execution_id

string

执行实例ID。

agent_id

string

所属智能体ID(多智能体场景)。

parent_node_id

string

父节点ID(子工作流等嵌套场景)。

messages

array

节点内对话消息 [{role, content}]。

metadata

object

节点元数据。

表5 节点类型

类型

说明

类型

说明

Start

开始节点

Loop

循环节点

End

结束节点

LoopInput

循环输入

LLM

大模型节点

LoopOutput

循环输出

Agent

智能体节点

SetVariable

变量赋值

KnowledgeRepo

知识库节点

Mcp

MCP工具节点

Message

消息节点

Http

HTTP请求

Branch

条件分支

QA

问答节点

Code

代码节点

DataQuery

数据查询

IntentDetection

意图识别

Questioner

追问节点

Workflow

子工作流

Input

用户输入

ParamExtraction

参数提取

Aggregation

聚合节点

node_finished:节点执行完成

节点执行结束时发送。node_status为node_finished,status根据执行结果为成功或失败。

{
  "event": "node_finished",
  "data": {
    "node_id": "node_1",
    "node_name": "LLM节点",
    "node_type": "LLM",
    "node_status": "node_finished",
    "status": { "code": 0, "desc": "succeeded" },
    "start_time": 1697000000000,
    "end_time": 1697000001000,
    "inputs": { "query": "你好" },
    "outputs": { "result": "你好,有什么可以帮助你?" },
    "execution_id": "exec_001"
  },
  "createdTime": 1697000001000
}

数据结构与node_started完全相同(见表4),区别如下:

  • outputs:已填充节点最终输出结果。
  • end_time:已填充节点结束时间。
  • status:为最终执行结果。
    • 成功
       {code:0, desc:"succeeded"} 
    • 失败
      {code:2, desc:"failed"}

node_wait:节点等待用户输入

交互节点(追问、用户输入、问答)执行到等待用户输入时发送。status固定为{code:1, desc:"waiting"},工作流暂停执行,等待下一次对话输入后恢复。

{
  "event": "node_wait",
  "data": {
    "node_id": "node_3",
    "node_name": "追问节点",
    "node_type": "Questioner",
    "node_status": "node_wait",
    "status": { "code": 1, "desc": "waiting" }
  },
  "createdTime": 1697000000000
}

workflow_node_message:节点详细执行信息

节点的完整执行信息,包含输入输出数据、执行时间、内部对话记录等。此事件为原始事件透传,同时会拆分出node_started、node_finished状态事件。

{
  "event": "workflow_node_message",
  "data": {
    "componentId": "node_1",
    "componentName": "LLM节点",
    "componentType": "LLM",
    "status": "finish",
    "startTime": "2026-10-14T10:00:00.000+0800",
    "endTime": "2026-10-14T10:00:01.000+0800",
    "inputs": { "query": "你好" },
    "outputs": { "result": "你好,有什么可以帮助你?" },
    "onInvokeData": [{ "user": "你好", "assistant": "你好,有什么可以帮助你?" }],
    "metaData": {}
  },
  "createdTime": 1697000000000
}
表6 data字段

参数

类型

说明

componentId

string

节点ID。

componentName

string

节点名称。

componentType

string

节点原始类型标识。

status

string

原始状态。

  • start:开始。
  • finish:结束。
  • running:运行中。
  • error:报错。

startTime

string

节点开始时间(ISO格式)。

endTime

string

节点结束时间(ISO格式)。

inputs

object

节点输入参数。

outputs

object

节点输出结果。

onInvokeData

array

节点内部对话记录。

metaData

object

节点元数据。

agentId

string

智能体ID。

parentNodeId

string

父节点ID。

agentParentInvokeId

string

父工作流调用ID。

traceId

string

执行追踪ID。

message:节点流式输出

节点(主要是LLM节点)在执行过程中流式输出内容时发送。一个节点的完整输出会被拆分为多个message事件。

流式输出阶段:

{
  "event": "message",
  "data": {
    "text": "回答片段",
    "reasoning_content": "思考过程片段",
    "node_id": "node_1",
    "node_type": "LLM",
    "node_name": "LLM节点",
    "workflow_id": "wf_001",
    "workflow_name": "我的工作流",
    "index": 0,
    "enable_history": true,
    "createdTime": 1697000000000
  },
  "createdTime": 1697000000000
}

节点输出完成阶段(is_finished: true):

{
  "event": "message",
  "data": {
    "summary": "节点完整回答",
    "origin": "节点原始回答",
    "node_id": "node_1",
    "node_type": "LLM",
    "node_name": "LLM节点",
    "is_finished": true,
    "enable_history": true
  },
  "createdTime": 1697000000000
}
表7 data字段

参数

类型

说明

text

string

流式输出文本片段。

reasoning_content

string

思维链/推理过程内容。

summary

string

节点完整汇总回答(输出完成时)。

origin

string

节点原始回答(未经后处理)。

node_id

string

输出内容的节点ID。

node_type

string

节点类型。

node_name

string

节点名称。

workflow_id

string

所属工作流ID。

workflow_name

string

所属工作流名称。

index

int

并行节点索引(多节点并行输出时区分来源)。

is_finished

bool

是否为该节点输出的最后一片(完成标记)。

enable_history

bool

是否写入会话历史。

text和reasoning_content可同时存在(深度思考模型先输出推理过程再输出回答),也可单独存在。

workflow_finished:工作流执行结束

工作流执行完毕时发送,携带最终输出结果和执行状态。

{
  "event": "workflow_finished",
  "data": {
    "status": { "code": 1, "desc": "succeeded" },
    "outputs": {
      "responseContent": "最终输出内容",
      "user_fields": { "key": "value" }
    },
    "metadata": { "enable_history": true },
    "start_time": 1697000000000,
    "end_time": 1697000001000,
    "execution_id": "exec_001",
    "error_code": null,
    "error_message": null
  },
  "createdTime": 1697000001000
}
表8 data字段

参数

类型

说明

status

object

执行状态。

  • 成功
    {code:1, desc:"succeeded"}
  • 等待
    {code:1, desc:"waiting"}
  • 失败
    {code:2, desc:"failed"}

outputs

object

最终输出结果,包含responseContent(最终回答)和user_fields(用户自定义字段)。

metadata

object

元数据(如是否写入历史等)。

start_time

int

工作流开始时间戳(毫秒)。

end_time

int

工作流结束时间戳(毫秒)。

execution_id

string

执行实例ID。

error_code

int

错误码(成功时为空)。

error_message

string

错误信息(成功时为空)。

exception:工作流异常

工作流执行过程中发生异常时发送。

{
  "event": "exception",
  "data": { "node_id": "node_1", "message": "异常信息" },
  "createdTime": 1697000000000
}
表9 data字段

参数

类型

说明

node_id

string

异常节点ID。

message

string

异常信息。

error:工作流报错

工作流执行报错时发送,同时会伴随一个workflow_finished事件(status为failed)。

{
  "event": "error",
  "data": {
    "node_id": "node_1",
    "node_name": "LLM节点",
    "node_type": "LLM",
    "code": 500,
    "message": "节点执行失败",
    "workflow_id": "wf_001",
    "workflow_name": "我的工作流",
    "error_code": "AgentArts.500",
    "error_msg": "节点执行失败",
    "error_reason": "模型调用超时",
    "error_suggestion": "请检查模型配置和网络连接"
  },
  "createdTime": 1697000000000
}
表10 data字段

参数

类型

说明

code

int

错误码。

message

string

错误消息。

node_id

string

出错节点ID。

node_name

string

出错节点名称。

node_type

string

出错节点类型。

workflow_id

string

工作流ID。

workflow_name

string

工作流名称。

error_code

string

错误码(如AgentArts.500)。

error_msg

string

错误描述。

error_reason

string

错误原因说明。

error_suggestion

string

修复建议。

end:流式终止

流式响应的最后一个事件,标识本次响应流结束。

{ "event": "end", "createdTime": 1697000001000 }

工作流典型事件序列

正常执行:

workflow_started
  → node_started(节点1)
    → workflow_node_message(节点1详细信息)
    → message × N(节点1流式输出)
    → message(is_finished=true,节点1输出完成)
  → node_finished(节点1)
  → node_started(节点2) → ... → node_finished(节点2)
  → ...
workflow_finished
  → end

交互场景(含追问节点):

workflow_started → node_started → message → node_wait
  ↑ 工作流暂停,等待用户输入,下一轮对话后继续

错误场景:

workflow_started → node_started → error → workflow_finished(failed) → end

单智能体(Agent)模式事件

单智能体(ReAct)模式下,智能体通过“推理-行动”循环完成任务,事件流反映智能体的思考过程、工具调用过程和最终回答。

表11 事件清单

事件类型

说明

start

对话开始。

message

流式回复内容(含思维链)。

plugin_start

工具调用开始。

plugin_end

工具调用返回结果。

statistic_data

执行统计信息。

summary_response

结果汇总(完整回答)。

error

执行报错。

end

流式终止。

start:对话开始

{ "event": "start", "createdTime": 1697000000000 }

message:流式回复

智能体的大模型回答内容,按token流式输出。每个事件携带一个文本片段。

{
  "event": "message",
  "content": "你好,我是智能助手",
  "reasoning_content": "用户在打招呼,我应该礼貌回应",
  "createdTime": 1697000000000
}
表12 字段

参数

类型

说明

content

string

回答正文片段。

reasoning_content

string

思维链/推理过程片段(仅深度思考模型输出)。

content和reasoning_content可同时存在(深度思考模型先输出推理过程再输出回答),也可单独存在。

plugin_start:工具调用开始

智能体决定调用工具、插件、MCP时发送,携带工具调用信息。

{
  "event": "plugin_start",
  "type": "plugin",
  "plugin": {
    "name": "weather_api",
    "arguments": { "city": "北京" }
  },
  "latency": { "overall": 1.5, "model": 0.8 },
  "createdTime": 1697000000000
}
表13 字段

参数

类型

说明

type

string

工具类型。

  • plugin:普通插件。
  • mcp:MCP工具。
  • workflow:工作流工具。

plugin

object

工具调用详情(函数名、参数等)。

latency

object

耗时统计,单位:秒。

  • overall:总耗时。
  • model:模型耗时。

plugin_end:工具调用返回

工具执行完成,返回结果时发送。

{
  "event": "plugin_end",
  "content": { "result": "北京今天晴,25℃" },
  "role": "function",
  "latency": { "overall": 1.5, "plugin": 0.7 },
  "createdTime": 1697000000000
}
表14 字段

参数

类型

说明

content

object

工具执行返回的结果内容。

role

string

角色标识,固定为function,即为工具执行。

latency

object

耗时统计,单位:秒。

  • overall:总耗时。
  • plugin:工具耗时。

statistic_data:执行统计

智能体执行结束时的统计数据,包含各阶段耗时。

{
  "event": "statistic_data",
  "latency": { "overall": 3.2, "model": 2.0, "plugin": 1.2 },
  "createdTime": 1697000000000
}
表15 字段

参数

类型

说明

latency.overall

float

总耗时(秒)。

latency.model

float

大模型推理总耗时(秒)。

latency.plugin

float

工具调用总耗时(秒)。

summary_response:结果汇总

智能体执行结束后的完整回答汇总,将所有流式片段拼接为完整字符串。

{
  "event": "summary_response",
  "content": "你好,我是智能助手。今天北京天气晴朗,温度25℃。",
  "role": "assistant",
  "executionId": "exec_001",
  "createdTime": 1697000000000
}
表16 字段

参数

类型

说明

content

string

完整回答文本(所有流式片段拼接)。

role

string

角色标识,固定为assistant,即智能体回复。

executionId

string

执行实例ID。

error:执行报错

智能体执行报错时发送,同时伴随一个statistic_data事件。

{
  "event": "error",
  "data": {
    "code": 500,
    "message": "模型调用失败",
    "error_code": "AgentArts.500",
    "error_msg": "模型调用失败",
    "error_reason": "API 超时",
    "error_suggestion": "请稍后重试"
  },
  "createdTime": 1697000000000
}
表17 data字段

参数

类型

说明

code

int

错误码(默认999999)。

message

string

错误消息。

error_code

string

错误码(如AgentArts.500)。

error_msg

string

错误描述。

error_reason

string

错误原因。

error_suggestion

string

修复建议。

end:流式终止

{ "event": "end", "createdTime": 1697000001000 }

单智能体典型事件序列

无工具调用:

start → message × N → statistic_data → summary_response → end

有工具调用(单次):

start
  → message × N(初步回答/决定调用工具)
  → plugin_start(调用天气工具)
  → plugin_end(返回天气结果)
  → message × N(基于工具结果继续回答)
  → statistic_data
  → summary_response
  → end

有工具调用(多次循环):

start
  → message × N(推理,决定调用工具A)
  → plugin_start → plugin_end(工具A调用)
  → message × N(基于工具A结果推理,决定调用工具B)
  → plugin_start → plugin_end(工具B调用)
  → message × N(综合回答)
  → statistic_data
  → summary_response
  → end

多智能体(MultiAgents)模式事件

多智能体模式由控制器(Controller)协调多个子智能体协作完成任务。事件流反映控制器的任务调度和各子智能体的执行过程。

表18 事件清单

事件类型

说明

task_start

控制器任务开始。

message

子智能体流式回复。

workflow_node_message

子智能体节点详细信息。

node_started

子智能体节点开始(由workflow_node_message拆分)。

node_finished

子智能体节点完成(由workflow_node_message拆分)。

task_end

控制器任务结束。

workflow_start

子工作流开始(透传)。

workflow_end

子工作流结束(透传)。

workflow_blocked

子工作流执行到交互节点,阻塞等待用户回复(透传)。

workflow_resume

用户回复后子工作流恢复执行(透传)。

task_terminated

任务终止。

end

流式终止。

task_start:任务开始

控制器开始执行任务时发送,携带执行实例ID。

{
  "event": "task_start",
  "conversation_id": "conv_001",
  "data": { "executionId": "exec_001" },
  "createdTime": 1697000000000
}
表19 字段

参数

类型

说明

conversation_id

string

会话ID。

data.executionId

string

执行实例ID。

message:子智能体流式回复

控制器分派的子智能体在执行过程中流式输出内容。携带节点信息以区分是哪个子智能体的输出。

{
  "event": "message",
  "data": {
    "text": "正在查询相关资料",
    "reasoning_content": "需要先搜索相关文档",
    "index": 0,
    "node_id": "agent_1",
    "node_type": "Agent",
    "node_name": "搜索助手",
    "workflow_id": "wf_001",
    "workflow_name": "研究团队"
  },
  "createdTime": 1697000000000
}
表20 data字段

参数

类型

说明

text

string

流式输出文本片段。

reasoning_content

string

思维链、推理过程。

index

int

子智能体索引(多个子智能体并行时区分来源)。

node_id

string

子智能体、节点ID。

node_type

string

节点类型(见表5)。

node_name

string

节点、智能体名称。

workflow_id

string

工作流ID。

workflow_name

string

工作流名称。

workflow_node_message:子智能体节点信息

子智能体执行节点的详细信息(输入输出、执行时间等),此事件为原始数据透传。同时会拆分出node_started、node_finished状态事件。

{
  "event": "workflow_node_message",
  "data": {
    "componentId": "agent_1",
    "componentName": "搜索助手",
    "componentType": "Agent",
    "status": "finish",
    "startTime": "2026-10-14T10:00:00.000+0800",
    "endTime": "2026-10-14T10:00:02.000+0800",
    "inputs": { "query": "搜索AI相关论文" },
    "outputs": { "result": "找到5篇相关论文" },
    "onInvokeData": [{ "user": "搜索AI相关论文", "assistant": "找到5篇相关论文" }]
  },
  "createdTime": 1697000000000
}

node_started、node_finished的数据结构同工作流模式,详见node_started:节点开始执行、node_finished:节点执行完成。

task_end:任务结束

控制器任务执行结束时发送。如果前一个事件不是task_start(中间有其他执行过程),会补充executionId。

{
  "event": "task_end",
  "conversation_id": "conv_001",
  "data": { "executionId": "exec_001" },
  "createdTime": 1697000001000
}
表21 字段

参数

类型

说明

conversation_id

string

会话ID。

data.executionId

string

执行实例ID。

透传事件

以下事件由控制器底层直接透传,携带conversation_id,格式统一:

{ "event": "事件类型", "conversation_id": "conv_001", "data": {...}, "createdTime": ... }
表22 透传事件说明

事件

说明

workflow_start

子工作流开始执行。

workflow_end

子工作流执行结束。

workflow_blocked

子工作流执行到交互节点(提问器、用户输入等),阻塞等待用户回复。

workflow_resume

用户回复后,子工作流恢复执行。

task_terminated

任务被终止。

当子工作流执行到交互型节点(提问器Questioner、用户输入Input、子工作流SubWorkflow、智能体Agent)且节点判定需要用户输入时,工作流中断阻塞,发送 workflow_blocked,用户再次输入回复后,发送workflow_resume恢复执行。

与工作流模式的区别:同样的“等待用户输入”语义。

end — 流式终止

{ "event": "end", "createdTime": 1697000001000 }

多智能体典型事件序列

task_start
  → workflow_start(子工作流开始)
  → node_started(子智能体A开始)
  → message × N(子智能体A回复)
  → workflow_node_message(子智能体A节点信息)
  → node_finished(子智能体A完成)
  → node_started(子智能体B开始)
  → message × N(子智能体B回复)
  → workflow_node_message(子智能体B节点信息)
  → node_finished(子智能体B完成)
  → workflow_end(子工作流结束)
  → [可能阻塞:workflow_blocked → workflow_resume]
task_end
  → end

相关文档