Skip to content

Thread / Run / Artifact

Takos の AI 実行面では、ThreadRun が中心です。

Thread

Thread は継続する対話や作業コンテキストです。メッセージ列、summary、関連 artifact などが thread に紐づきます。

Thread の主要フィールド

fielddescription
idthread ID
space_id所属する space
titlethread タイトル
statusactive / archived / deleted
localeja / en など
key_pointsthread の要点
retrieval_index検索インデックス用テキスト
context_windowコンテキストウィンドウ設定

Message

Thread 内の個々のメッセージは次を持ちます。

fielddescription
roleuser / assistant / system / tool
contentメッセージ本文
tool_callsassistant が呼び出した tool の配列
tool_call_idtool role のメッセージが応答する tool call ID
sequencethread 内の順序
metadata追加メタデータ

Run

Run は thread 上で発生する 1 回の実行です。

Run status

Run は次の状態遷移を持ちます。

text
pending -> queued -> running -> completed
                            \-> failed
                            \-> cancelled
status説明
pending作成直後。queue 投入待ち
queuedRUN_QUEUE に投入済み。実行待ち
running実行中。heartbeat で監視される
completed正常完了
failedエラーで終了
cancelledユーザーまたはシステムによるキャンセル

Run の主要フィールド

fielddescription
idrun ID
thread_id所属する thread
space_id所属する space
status上記の status 値
agent_type使用する agent type
parent_run_id親 run (入れ子実行の場合)
root_run_idroot run ID
root_thread_idroot thread ID
child_thread_id子 thread (sub-thread を作成した場合)
session_id実行セッション ID
error失敗時のエラー情報
usageトークン使用量など
started_at / completed_at実行時刻

Run の階層構造

Run は親子関係を持てます。

  • parent_run_id — 親 run を指す。入れ子の agent 実行を表現する
  • root_run_id — 最上位の run を指す。深い入れ子でも root を追跡できる
  • child_thread_id — sub-thread を作成した場合、その thread を指す

イベントストリーミング

Run の進行はリアルタイムで購読できます。

  • SSE: GET /api/runs/:id/sse — Server-Sent Events で run イベントを購読
  • WebSocket: follow verb で WebSocket 購読(CLI: takos run follow RUN_ID --transport ws

通知全般は GET /api/notifications/sse で購読できます。

Agent Task

Agent Task は agent が計画・実行するタスク単位です。Thread / Run と紐づきます。

fielddescription
statusplanned / in_progress / blocked / completed / cancelled
priorityタスクの優先度
planタスクの実行計画
thread_id / run_id紐づく thread と run

Artifact

Artifact は run の結果物です。

fielddescription
idartifact ID
run_id生成元の run
space_id所属する space
typecode / config / doc / patch / report / other
file_idspace storage 上のファイルへのリンク (任意)
metadata追加メタデータ

Memory / Reminder

Thread / Run と並んで、Takos の AI 実行面には Memory と Reminder があります。

  • Memory — agent の記憶単位。episode / semantic / procedural の型を持ち、importance scoring と semantic search の対象になる
  • Remindertime / condition / context の trigger 型を持つ。priority 付きで agent に通知される

CLI では takos context list /spaces/SPACE_ID/memories で一覧できます。

何が独自か

Takos は repo deploy と app runtime だけでなく、AI 実行の履歴も platform に含めます。 そのため、Thread / Run / Artifact のモデルは app deploy や worker model と並ぶ重要な surface です。