Skip to main content
Sessions

订阅 Thread Event SSE

通过 SSE 订阅单个 Thread 的事件流。

请求头

Header是否必填说明
AuthorizationBearer <PAT>
Accepttext/event-stream
Last-Event-ID从该 Thread Event ID 之后恢复订阅。

路径参数

参数类型是否必填说明
session_idstringSession ID。
thread_idstringThread ID。

查询参数

参数类型是否必填默认值说明
typestring-按 Event 类型过滤,支持逗号分隔。
types[]string-数组形式的 Event 类型过滤。
include_tool_callsbooleantrue是否包含工具调用类事件。
include_thinkingbooleantrue是否包含思考过程事件。

示例请求

curl -s -X GET 'https://api.qoder.com.cn/api/v1/forward/sessions/sess_xxx/threads/sthr_child_xxx/stream' \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Accept: text/event-stream"

示例响应

HTTP 200 OK
id: evt_xxx
event: agent.thread_message_received
data: {"id":"evt_xxx","type":"agent.thread_message_received","session_id":"sess_xxx","session_thread_id":"sthr_child_xxx","content":"Task received","processed_at":"2026-06-22T11:05:00Z"}

响应字段

字段类型说明
idstringSSE event ID,等于 Event ID。
eventstringEvent 类型。
dataobject该 Thread 的过滤后 Forward Event JSON。

错误

HTTPTypeCode触发条件
400invalid_request_errorinvalid_event_cursorLast-Event-ID 不属于当前 Thread。
404not_found_errorsession_not_foundSession 不存在。
404not_found_errorthread_not_foundThread 不存在。
401authentication_errorauthentication_requiredPAT 无效或已过期。

备注

  • Thread SSE 使用与 Session SSE 相同的字段级过滤策略。
  • 未知 Event 类型可用时会降级为 envelope-only 事件。

相关