メインコンテンツへスキップ
GET /v1/sessions/{session_id}/threads/{thread_id}/stream Server-Sent Events (SSE) で特定の Session スレッドのイベントをリアルタイムに受信します。接続が確立されると、サーバーはそのスレッドの完全なイベント履歴をプッシュし、新しいイベントが発生するたびに継続的にストリーミングします。そのスレッドに属するイベントのみがストリーミングされます。

ヘッダー

ヘッダー必須説明
AuthorizationはいBearer <PAT>
Accept推奨text/event-stream
Last-Event-IDいいえこのイベント ID 以降から再開。ID は現在のスレッドに属している必要があります

パスパラメータ

パラメータ必須説明
session_idstringはいSession ID(sess_ プレフィックス)
thread_idstringはいThread ID(sthr_ プレフィックス)

クエリパラメータ

パラメータ必須説明
typestringいいえイベントタイプでフィルタリング。カンマ区切りの値をサポート
types[]stringいいえtype の配列形式の代替

リクエスト例

curl -N -X GET "https://api.qoder.com/api/v1/cloud/sessions/sess_019f00000000000000000000000000aa/threads/sthr_019f00000000000000000000000002bb/stream" \
  -H "Authorization: Bearer $QODER_PAT" \
  -H "Accept: text/event-stream"

レスポンス例

HTTP 200 OK Content-Type: text/event-stream 各イベントは SSE 標準形式に従います。すべてのイベントには session_thread_id フィールドが含まれます: 子スレッドが作成された:
id: evt_019f0000000000000000000000000100
event: session.thread_created
data: {"id": "evt_019f0000000000000000000000000100", "type": "session.thread_created", "schema_version": "1.0", "session_id": "sess_019f00000000000000000000000000aa", "session_thread_id": "sthr_019f00000000000000000000000002bb", "parent_thread_id": "sthr_019f00000000000000000000000001aa", "agent_id": "agent_019f000000000000000000000000002b", "agent_version": 2, "agent_name": "Research Agent", "role": "child", "created_by_tool_use_id": "toolu_bdrk_01T42NPLcKrBvLJfWgGt3QMt", "created_at": "2026-06-15T08:01:00.000Z"}
スレッドが実行を開始した:
id: evt_019f0000000000000000000000000102
event: session.thread_status_running
data: {"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"}
スレッド間メッセージ送信(coordinator → child):
id: evt_019f0000000000000000000000000101
event: agent.thread_message_sent
data: {"id": "evt_019f0000000000000000000000000101", "type": "agent.thread_message_sent", "schema_version": "1.0", "session_id": "sess_019f00000000000000000000000000aa", "session_thread_id": "sthr_019f00000000000000000000000002bb", "direction": "coordinator_to_child", "content": "请调研竞品动态", "from_session_thread_id": "sthr_019f00000000000000000000000001aa", "to_session_thread_id": "sthr_019f00000000000000000000000002bb", "created_at": "2026-06-15T08:01:00.500Z"}
スレッド間メッセージ受信(child → coordinator):
id: evt_019f0000000000000000000000000110
event: agent.thread_message_received
data: {"id": "evt_019f0000000000000000000000000110", "type": "agent.thread_message_received", "schema_version": "1.0", "session_id": "sess_019f00000000000000000000000000aa", "session_thread_id": "sthr_019f00000000000000000000000001aa", "direction": "child_to_parent", "content": "调研完成,主要发现如下...", "is_error": false, "from_session_thread_id": "sthr_019f00000000000000000000000002bb", "to_session_thread_id": "sthr_019f00000000000000000000000001aa", "created_at": "2026-06-15T08:05:00.000Z"}
スレッドがアイドル状態に(子スレッドの完了):
id: evt_019f0000000000000000000000000111
event: session.thread_status_idle
data: {"id": "evt_019f0000000000000000000000000111", "type": "session.thread_status_idle", "schema_version": "1.0", "session_id": "sess_019f00000000000000000000000000aa", "session_thread_id": "sthr_019f00000000000000000000000002bb", "status": "idle", "stop_reason": {"type": "end_turn"}, "created_at": "2026-06-15T08:05:01.000Z"}

スレッドイベントタイプ

Session レベルのイベントタイプに加えて、以下のスレッド固有イベントタイプが利用可能です:
event (SSE field)説明
session.thread_created新しい子スレッドが作成された。parent_thread_idagent_idagent_versionagent_namerolecreated_by_tool_use_id を含む
session.thread_status_runningスレッドが実行を開始した。agent_namestatus を含む
session.thread_status_idleスレッドがアイドルに戻った。statusstop_reason を含む
session.thread_status_terminatedスレッドがアーカイブまたは終了された。statusstop_reason を含む
agent.thread_message_sentスレッド間メッセージが送信された。directioncontentfrom_session_thread_idto_session_thread_id を含む
agent.thread_message_receivedスレッド間メッセージが受信された。directioncontentis_errorfrom_session_thread_idto_session_thread_id を含む
Managed Agents シナリオでは、すべてのイベントに追加の session_thread_id フィールドが含まれます。Session レベルのイベントストリーム(/sessions/{id}/events/stream)はすべてのスレッドのイベントを含み、スレッドレベルのイベントストリームは指定されたスレッドのイベントのみを含みます。

エラーコード

HTTPtypeトリガー条件
400invalid_request_errorLast-Event-ID がこのスレッドに属していない
401authentication_errorPAT が無効または期限切れ
404not_found_errorSession または Thread が存在しない
完全なエラーエンベロープリファレンスは エラー を参照してください。

関連項目

Managed Agents

Coordinator と子スレッドのイベントモデルを確認します。

スレッドイベント一覧

REST でスレッドイベント履歴をページ単位に取得します。

Session Threads 一覧

Session 内のすべてのスレッドとそのステータスを取得します。

Event オブジェクト

イベントオブジェクトのフィールド定義を参照します。