Skip to main content
GET
Get Assistant Message Events

获取助手消息事件

URL: /v1/agent/conversations/{conversation_id}/messages/{assistant_message_id} 方法: GET 描述: 获取指定助手消息的所有事件,支持从指定的 offset 开始批量获取,可选择流式(SSE)或非流式(JSON)响应模式。

使用场景

  • 断点续传:当客户端断开连接后,可以从上次接收到的 offset 继续获取事件
  • 历史回放:获取已完成对话的完整事件历史
  • 事件查询:查询特定消息的所有事件,用于调试或分析

路径参数

查询参数

响应参数

流式响应(stream=true)

返回 text/event-stream 格式的 SSE 流,每个事件的结构与 智能体对话聊天接口 相同。

非流式响应(stream=false)

返回 JSON 格式的事件数组:

示例代码

cURL 示例(流式响应)

cURL 示例(非流式响应)

Python 示例(流式响应)

Python 示例(非流式响应)

响应示例

非流式响应示例

注意事项

  • assistant_message_id 可从对话聊天接口(stream=true)的 HTTP 响应头 X-REPORTIFY-ASSISTANT-MESSAGE-ID 中获取
  • from_offset 参数用于指定从哪个偏移量开始获取事件,可以用于断点续传
  • 流式模式下,事件会实时推送;非流式模式下,会一次性返回所有事件
  • 建议在需要实时更新时使用流式模式,在需要批量处理历史数据时使用非流式模式

Authorizations

Authorization
string
header
required

Enter your Bearer token

Path Parameters

conversation_id
integer
required

对话 ID

assistant_message_id
string
required

助手消息 ID(从 chat 接口响应头 X-REPORTIFY-ASSISTANT-MESSAGE-ID 获取)

Query Parameters

stream
boolean
default:true

是否使用流式响应(SSE) Stream events via SSE when true

timeout
integer
default:1800

流式模式的超时时间(秒) Timeout in seconds for streaming mode

from_offset
integer
default:0

从指定偏移量开始获取事件 Start streaming from specific offset

Required range: x >= 0

Response

Successful Response (Server-Sent Events stream or JSON array)

工作流流式事件对象

event_id
string
required

唯一事件标识符

Example:

"019b24ef23a1f4da18256b402868fae31764"

event_type
enum<string>
required

事件类型

Available options:
init,
workflow_start,
workflow_end,
node_start,
node_end,
agent_start,
agent_end,
tool_start,
tool_end,
stream_start,
streaming,
stream_end,
usage,
cancel,
error
Example:

"init"

timestamp
integer
required

事件时间戳(毫秒)

Example:

1765851210657

response_id
string
required

响应标识符,用于分组事件

Example:

"019b24ef238cc97730971a9a0080c99c"

workflow_id
string

工作流标识符

Example:

"11887655289749510"

execution_id
string

执行标识符

Example:

"1dfccd9d-c365-4b7a-adae-aa9123684ec4"

run_id
string

运行标识符,用于关联一组 start 和 end 事件(如 workflow_start 和 workflow_end、tool_start 和 tool_end),用于分组相关的开始/结束事件对

Example:

""

node_id
string

节点标识符

node_name
string

节点显示名称

node_type
string

节点类型(start, tool, agent, end)

agent_id
string

智能体标识符

agent_name
string

智能体显示名称

agent_type
string

智能体类型(builtin_agent, react_agent 等)

tool_id
string

工具标识符

tool_name
string

工具显示名称

input
Input · object

组件的输入数据

Example:
output
Output · object

组件的输出数据。

  • 对于 tool_end 事件:包含 content 字段(JSON 字符串格式)
  • 对于 agent_end 事件:包含 content 字段(Markdown 格式)
  • 对于 node_end 事件:包含 content、filetype、filename、filepath 字段
  • 对于 workflow_end 事件:字典的 key 为最后一个 node 的 node_id,value 包含 title、filetype、content、filename、filepath 字段
Example:
content
string

事件内容(用于思考/流式输出)

Example:

""

error
Error · object

错误信息(如果事件类型为 error)

offset
integer

事件偏移量

Example:

9195