跳转到主要内容
GET /v1/sessions/{session_id}/threads/{thread_id}/events 获取指定 Session Thread 中的事件列表,按时间正序排列。仅返回属于该线程的事件,不包含其他线程的事件。支持游标分页。 如果请求 Accept 头包含 text/event-stream,同一路由会切换到 SSE 流式返回。需要列表响应时,请使用 Accept: application/json 或不要带 SSE media type。

请求头

头部必选说明
AuthorizationBearer <PAT>

路径参数

参数类型必选说明
session_idstringSession ID(sess_ 前缀)
thread_idstringThread ID(sthr_ 前缀)

查询参数

参数类型必选说明
limitinteger返回数量上限,默认 20
after_idstring游标分页:返回该事件 ID 之后的记录
before_idstring游标分页:返回该事件 ID 之前的记录
orderstring排序方向:asc(默认)或 desc
typestring按事件类型过滤。支持逗号分隔多值
types[]stringtype 的数组写法替代方案
完整分页规范详见 分页

示例请求

curl -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019f00000000000000000000000000aa/threads/sthr_019f00000000000000000000000002bb/events?limit=10" \
  -H "Authorization: Bearer $QODER_PAT"

示例响应

HTTP 200 OK
{
  "data": [
    {
      "id": "evt_019f0000000000000000000000000101",
      "type": "agent.thread_message_sent",
      "schema_version": "1.0",
      "session_id": "sess_019f00000000000000000000000000aa",
      "session_thread_id": "sthr_019f00000000000000000000000002bb",
      "turn_id": "turn_019f0000000000000000000000000010",
      "direction": "coordinator_to_child",
      "content": "请调研 Cloud Agents API 的最新竞品动态。",
      "from_session_thread_id": "sthr_019f00000000000000000000000001aa",
      "to_session_thread_id": "sthr_019f00000000000000000000000002bb",
      "created_at": "2026-06-15T08:01:00.000Z",
      "processed_at": "2026-06-15T08:01:00.000Z"
    },
    {
      "id": "evt_019f0000000000000000000000000102",
      "type": "session.thread_status_running",
      "schema_version": "1.0",
      "session_id": "sess_019f00000000000000000000000000aa",
      "session_thread_id": "sthr_019f00000000000000000000000002bb",
      "agent_name": "Research Agent",
      "status": "running",
      "created_at": "2026-06-15T08:01:01.000Z",
      "processed_at": "2026-06-15T08:01:01.000Z"
    }
  ],
  "first_id": "evt_019f0000000000000000000000000101",
  "last_id": "evt_019f0000000000000000000000000102",
  "has_more": true
}

响应字段

字段类型说明
dataEvent 对象 数组该线程的事件列表。所有事件都包含 session_thread_id 字段
first_idstring | null当前页第一条记录的 ID
last_idstring | null当前页最后一条记录的 ID
has_moreboolean是否还有更多记录

错误码

HTTPtype触发条件
401authentication_errorPAT 无效或过期
404not_found_errorSession 或 Thread 不存在
完整错误信封说明详见 错误参考

相关

Managed Agents

了解线程事件在多 Agent 协作中的语义。

线程事件流 (SSE)

通过 Server-Sent Events 实时接收线程事件。

列出 Session Threads

查看 Session 中的所有线程。