跳到主要内容
跳转到主要内容
会话事件与 SSE

AIP

会话事件与 SSE

轮询单 Agent 对话事件,或使用 Profile API key 连接普通任务的 SSE。

AIP 的会话事件使用 HAST Event v2。单 Agent 对话通过 JSON 轮询读取;Profile API key 提交的普通任务还可以使用 SSE。先按 API 入门 创建适合调用场景的密钥。

读取单 Agent 对话事件

使用绑定目标 Agent 的密钥,授予 agent:conversations:read(发送消息的 agent:invoke 已包含此权限):

export SESSION_ID='<SESSION_ID_FROM_RESPONSE>'
curl --fail-with-body \
  "$HAST_API_BASE/agent/sessions/$SESSION_ID/events?after=0&limit=100" \
  -H "Authorization: Bearer $HAST_API_KEY"

将响应中的 next_after 作为下次请求的 after。has_more 为 true 时继续翻页,即使 events 为空;没有更多事件时稍后再次轮询。此接口只返回用户和 Agent 的完整消息及运行状态,不返回工具轨迹。

按回执的 request_id 匹配事件的 run_id,直到出现 run.completed、run.failed 或 run.interrupted。message.completed 只结束一条消息。单 Agent key 可读取绑定 Agent 的全部历史对话,但不能使用下面的普通任务 SSE 路径。

连接事件流

以下流程使用 Profile API key,授予 prompts:write 和 sessions:read。先向 /prompts 提交普通任务,将响应中的 session_id 设置为 SESSION_ID,再连接 SSE。此任务不使用已保存的 Agent 配置;调用该 Agent 请用上面的单 Agent 对话接口或 Webhook HTTP 接入。

export HAST_API_KEY='<YOUR_PROFILE_API_KEY>'
curl --fail-with-body "$HAST_API_BASE/prompts" \
  -H "Authorization: Bearer $HAST_API_KEY" \
  -H 'Content-Type: application/json' \
  --data '{"request_id":"task-001","prompt":"What is 2 + 2?"}'
export SESSION_ID='<SESSION_ID_FROM_PROMPT_RESPONSE>'
curl -N --fail-with-body \
  "$HAST_API_BASE/sessions/$SESSION_ID/events/stream?after=0" \
  -H "Authorization: Bearer $HAST_API_KEY" \
  -H 'Accept: text/event-stream'

读取事件需要 sessions:read 权限。连接返回 text/event-stream,事件之间还会发送 : keep-alive 注释行。

SSE 帧格式

id: 42
event: message.completed
data: {"schema_version":2,"event_id":"evt_123",...}

这里的 data 省略了部分字段,只用于说明帧格式。实际数据是完整的 JSON 事件对象,帧之间以空行分隔。

字段含义
id持久化序号,用于断线后续读
event事件类型,对应信封中的 type
dataHAST Event v2 JSON 信封

断线续读与回放

保存已处理的持久化序号。重新连接时,通过 after 查询参数或 Last-Event-ID 请求头传入该值;不要把 event_id 当作序号。

curl -N --fail-with-body \
  "$HAST_API_BASE/sessions/$SESSION_ID/events/stream" \
  -H "Authorization: Bearer $HAST_API_KEY" \
  -H 'Accept: text/event-stream' \
  -H 'Last-Event-ID: 42'

通过 JSON 读取事件

Profile API key 的普通任务也可以调用 GET /sessions/{id}/events,使用 after 和 limit 读取事件。单 Agent key 使用本页顶部的 /agent/sessions/{session_id}/events。参数见 API 参考。

Event v2 与事件类型

信封包含版本、事件 ID、来源、执行引擎、任务标识、事件类型和数据。sequence 对持久化事件为正整数,对易失事件为 null;replayable 表示事件是否可回放。

type 决定 data 的结构。消息、工具、计划和运行事件各自携带不同字段。不要把一条消息完成当作整轮运行结束,应结合 run.completed、run.failed 或 run.interrupted 判断运行结果。

以下结构直接由同一份 OpenAPI JSON 生成,展开后查看字段、必填约束和示例。各事件类型中的 api.TaskAgentEventDoc 引用指向上方的共用信封,其他部分说明该类型特有的数据结构。

Event v2 完整信封
JSON
{
  "discriminator": "type",
  "properties": {
    "created_at": {
      "example": "2026-08-16T12:00:00Z",
      "format": "date-time",
      "type": "string"
    },
    "data": {
      "allOf": [
        {
          "properties": {
            "attempt": {
              "minimum": 1,
              "type": "integer"
            },
            "attempts": {
              "minimum": 1,
              "type": "integer"
            },
            "channel": {
              "enum": [
                "stdout",
                "stderr",
                "progress"
              ],
              "type": "string"
            },
            "code": {
              "type": "string"
            },
            "context_window": {
              "minimum": 0,
              "type": "integer"
            },
            "cost": {},
            "delta": {
              "type": "string"
            },
            "duration_ms": {
              "minimum": 0,
              "type": "integer"
            },
            "error": {
              "type": "string"
            },
            "exit_code": {
              "type": "integer"
            },
            "files": {
              "items": {
                "type": "string"
              },
              "type": "array"
            },
            "final_message_id": {
              "type": "string"
            },
            "finish_reason": {
              "type": "string"
            },
            "input": {},
            "is_error": {
              "type": "boolean"
            },
            "kind": {
              "type": "string"
            },
            "last": {
              "properties": {
                "cache_read_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cache_write_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "input_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "output_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "reasoning_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "total_tokens": {
                  "minimum": 0,
                  "type": "integer"
                }
              },
              "required": [
                "cache_read_tokens",
                "cache_write_tokens",
                "input_tokens",
                "output_tokens",
                "reasoning_tokens",
                "total_tokens"
              ],
              "type": "object"
            },
            "message": {
              "type": "string"
            },
            "message_id": {
              "type": "string"
            },
            "model": {
              "type": "string"
            },
            "model_config": {
              "properties": {
                "model": {
                  "type": "string"
                },
                "model_source": {
                  "enum": [
                    "hast",
                    "codex_account"
                  ],
                  "type": "string"
                },
                "reasoning_effort": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            "model_source": {
              "type": "string"
            },
            "modified_at": {
              "format": "date-time",
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "operation": {
              "enum": [
                "update",
                "delete"
              ],
              "type": "string"
            },
            "options": {
              "items": {},
              "type": "array"
            },
            "output": {},
            "parent_tool_call_id": {
              "type": "string"
            },
            "path": {
              "type": "string"
            },
            "plan_id": {
              "type": "string"
            },
            "prompt": {
              "type": "string"
            },
            "reason": {
              "type": "string"
            },
            "reasoning_id": {
              "type": "string"
            },
            "request_id": {
              "type": "string"
            },
            "retryable": {
              "type": "boolean"
            },
            "role": {
              "enum": [
                "user",
                "assistant",
                "system"
              ],
              "type": "string"
            },
            "scope": {
              "type": "string"
            },
            "size_bytes": {
              "minimum": 0,
              "type": "integer"
            },
            "status": {
              "enum": [
                "starting",
                "ready",
                "failed",
                "released",
                "succeeded",
                "interrupted"
              ],
              "type": "string"
            },
            "steps": {
              "items": {
                "properties": {
                  "status": {
                    "enum": [
                      "pending",
                      "in_progress",
                      "completed"
                    ],
                    "example": "in_progress",
                    "type": "string"
                  },
                  "step": {
                    "type": "string"
                  }
                },
                "required": [
                  "status",
                  "step"
                ],
                "type": "object"
              },
              "type": "array"
            },
            "text": {
              "type": "string"
            },
            "tokens_after": {
              "minimum": 0,
              "type": "integer"
            },
            "tokens_before": {
              "minimum": 0,
              "type": "integer"
            },
            "tool_call_id": {
              "type": "string"
            },
            "total": {
              "properties": {
                "cache_read_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cache_write_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "input_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "output_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "reasoning_tokens": {
                  "minimum": 0,
                  "type": "integer"
                },
                "total_tokens": {
                  "minimum": 0,
                  "type": "integer"
                }
              },
              "required": [
                "cache_read_tokens",
                "cache_write_tokens",
                "input_tokens",
                "output_tokens",
                "reasoning_tokens",
                "total_tokens"
              ],
              "type": "object"
            },
            "turn_type": {
              "type": "string"
            }
          },
          "type": "object"
        }
      ],
      "description": "Data is the HAST-owned payload union; Type selects its required shape as\ndefined in docs/reference/task-agent-event-v2.md."
    },
    "engine": {
      "enum": [
        "codex_cli",
        "pi_agent_cli"
      ],
      "example": "codex_cli",
      "type": "string"
    },
    "event_id": {
      "example": "evt_123",
      "type": "string"
    },
    "replayable": {
      "example": true,
      "type": "boolean"
    },
    "run_id": {
      "example": "run_123",
      "type": "string"
    },
    "schema_version": {
      "enum": [
        2
      ],
      "example": 2,
      "type": "integer"
    },
    "sequence": {
      "description": "Sequence is a positive durable order, or null for volatile events.",
      "example": 42,
      "minimum": 1,
      "type": "integer",
      "x-nullable": true
    },
    "session_id": {
      "example": "session_123",
      "type": "string"
    },
    "source": {
      "enum": [
        "runtime",
        "backplane",
        "workspace"
      ],
      "example": "runtime",
      "type": "string"
    },
    "task_id": {
      "example": "task_123",
      "type": "string"
    },
    "type": {
      "enum": [
        "runtime.status",
        "run.queued",
        "run.started",
        "run.retrying",
        "run.completed",
        "run.failed",
        "run.interrupted",
        "message.started",
        "message.delta",
        "message.completed",
        "reasoning.started",
        "reasoning.delta",
        "reasoning.completed",
        "tool.started",
        "tool.updated",
        "tool.completed",
        "plan.updated",
        "plan.completed",
        "usage.updated",
        "file.changed",
        "input.requested",
        "context.compacted",
        "warning",
        "error"
      ],
      "example": "message.completed",
      "type": "string"
    }
  },
  "required": [
    "created_at",
    "data",
    "engine",
    "event_id",
    "replayable",
    "schema_version",
    "sequence",
    "source",
    "task_id",
    "type"
  ],
  "type": "object"
}
context.compacted
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "reason"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "context.compacted"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
error
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "scope",
                "code",
                "message",
                "retryable"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "error"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
file.changed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "path",
                "operation"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "file.changed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
input.requested
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "request_id",
                "kind",
                "prompt"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "input.requested"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
message.completed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "message_id",
                "role",
                "text"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "message.completed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
message.delta
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "message_id",
                "role",
                "delta"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "message.delta"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
message.started
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "message_id",
                "role"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "message.started"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
plan.completed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "plan_id"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "plan.completed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
plan.updated
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "plan_id"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "plan.updated"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
reasoning.completed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "reasoning_id",
                "text"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "reasoning.completed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
reasoning.delta
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "reasoning_id",
                "delta"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "reasoning.delta"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
reasoning.started
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "reasoning_id"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "reasoning.started"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.completed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "final_message_id",
                "finish_reason",
                "attempts"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.completed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.failed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "code",
                "message",
                "retryable",
                "attempts"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.failed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.interrupted
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "reason"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.interrupted"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.queued
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "request_id",
                "turn_type"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.queued"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.retrying
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "attempt",
                "code",
                "message"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.retrying"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
run.started
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "request_id",
                "turn_type"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "run.started"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
runtime.status
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "properties": {
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "status"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "runtime.status"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
tool.completed
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "properties": {
                "status": {
                  "enum": [
                    "succeeded",
                    "failed",
                    "interrupted"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "tool_call_id",
                "kind",
                "name",
                "status",
                "is_error"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "tool.completed"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
tool.started
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "tool_call_id",
                "kind",
                "name"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "tool.started"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
tool.updated
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "tool_call_id",
                "channel",
                "delta"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "tool.updated"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
usage.updated
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "model",
                "context_window",
                "total"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "usage.updated"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
warning
JSON
{
  "allOf": [
    {
      "$ref": "#/definitions/api.TaskAgentEventDoc"
    },
    {
      "properties": {
        "data": {
          "allOf": [
            {
              "properties": {
                "attempt": {
                  "minimum": 1,
                  "type": "integer"
                },
                "attempts": {
                  "minimum": 1,
                  "type": "integer"
                },
                "channel": {
                  "enum": [
                    "stdout",
                    "stderr",
                    "progress"
                  ],
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "context_window": {
                  "minimum": 0,
                  "type": "integer"
                },
                "cost": {},
                "delta": {
                  "type": "string"
                },
                "duration_ms": {
                  "minimum": 0,
                  "type": "integer"
                },
                "error": {
                  "type": "string"
                },
                "exit_code": {
                  "type": "integer"
                },
                "files": {
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "final_message_id": {
                  "type": "string"
                },
                "finish_reason": {
                  "type": "string"
                },
                "input": {},
                "is_error": {
                  "type": "boolean"
                },
                "kind": {
                  "type": "string"
                },
                "last": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "message": {
                  "type": "string"
                },
                "message_id": {
                  "type": "string"
                },
                "model": {
                  "type": "string"
                },
                "model_config": {
                  "properties": {
                    "model": {
                      "type": "string"
                    },
                    "model_source": {
                      "enum": [
                        "hast",
                        "codex_account"
                      ],
                      "type": "string"
                    },
                    "reasoning_effort": {
                      "type": "string"
                    }
                  },
                  "type": "object"
                },
                "model_source": {
                  "type": "string"
                },
                "modified_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "name": {
                  "type": "string"
                },
                "operation": {
                  "enum": [
                    "update",
                    "delete"
                  ],
                  "type": "string"
                },
                "options": {
                  "items": {},
                  "type": "array"
                },
                "output": {},
                "parent_tool_call_id": {
                  "type": "string"
                },
                "path": {
                  "type": "string"
                },
                "plan_id": {
                  "type": "string"
                },
                "prompt": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                },
                "reasoning_id": {
                  "type": "string"
                },
                "request_id": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                },
                "role": {
                  "enum": [
                    "user",
                    "assistant",
                    "system"
                  ],
                  "type": "string"
                },
                "scope": {
                  "type": "string"
                },
                "size_bytes": {
                  "minimum": 0,
                  "type": "integer"
                },
                "status": {
                  "enum": [
                    "starting",
                    "ready",
                    "failed",
                    "released",
                    "succeeded",
                    "interrupted"
                  ],
                  "type": "string"
                },
                "steps": {
                  "items": {
                    "properties": {
                      "status": {
                        "enum": [
                          "pending",
                          "in_progress",
                          "completed"
                        ],
                        "example": "in_progress",
                        "type": "string"
                      },
                      "step": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "status",
                      "step"
                    ],
                    "type": "object"
                  },
                  "type": "array"
                },
                "text": {
                  "type": "string"
                },
                "tokens_after": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tokens_before": {
                  "minimum": 0,
                  "type": "integer"
                },
                "tool_call_id": {
                  "type": "string"
                },
                "total": {
                  "properties": {
                    "cache_read_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "cache_write_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "input_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "output_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "reasoning_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    },
                    "total_tokens": {
                      "minimum": 0,
                      "type": "integer"
                    }
                  },
                  "required": [
                    "cache_read_tokens",
                    "cache_write_tokens",
                    "input_tokens",
                    "output_tokens",
                    "reasoning_tokens",
                    "total_tokens"
                  ],
                  "type": "object"
                },
                "turn_type": {
                  "type": "string"
                }
              },
              "type": "object"
            },
            {
              "required": [
                "scope",
                "code",
                "message",
                "retryable"
              ],
              "type": "object"
            }
          ]
        },
        "type": {
          "enum": [
            "warning"
          ],
          "type": "string"
        }
      },
      "required": [
        "type",
        "data"
      ],
      "type": "object"
    }
  ]
}
认识 Hast了解 Hast AIP、Hast Agent、Hast GTM,以及 FDE 团队的交付方式。AIP 产品介绍了解 FDE 交付平台的定位,以及 Agent 工作台如何支持业务接入。创建第一个 Agent用一个不依赖外部服务的例子,完成配置、保存和调试。配置与管理 Agent设置职责、模型和能力,维护当前生效的配置。管理 Skills编写、导入和选择 Agent 使用的技能文件。添加知识库组合网址、文件和 Drive 来源,维护知识库成员、索引与编译内容。管理业务密钥保存凭证并绑定到 Agent,避免在配置示例中写入真实值。连接业务工具让 Agent 调用已有 HTTP 服务,并明确参数和认证方式。设置长期记忆决定 Agent 能读取哪些记忆,以及新记忆写到哪里。调试 Agent测试保存后的配置,检查连续对话和工具结果。导入、导出与复制复用配置,并在迁移后重新检查资源和凭证。Webhook HTTP 接入从服务端调用 Agent,继续对话、读取回复并停止生成。MCP 接入连接外部 Agent 客户端,通过同一把 Public API Key 使用 AIP 工具。接入 Slack将 Agent 加入 Slack,在频道或私聊中提问、处理文件,与团队一起使用。接入 WhatsApp让客户通过 WhatsApp 向 Agent 提问、发送文件并获取回复。接入企业微信(微信客服)将 Agent 接入微信客服,在微信中解答客户问题。API 入门在 AIP 创建密钥,调用已保存的 Agent,读取回复并按权限访问业务资源。会话事件与 SSE轮询单 Agent 对话事件,或使用 Profile API key 连接普通任务的 SSE。API 文档查看 AIP 公开 API 的认证、Agent 对话和业务资源接口。Task Agent 产品介绍了解 Hast Agent 如何规划、执行并交付任务,持续使用文件、工具与业务背景。完成第一个任务从需求描述开始,查看执行进展并检查最终结果。执行任务与管理对话补充要求,停止当前执行,并管理历史对话。上传、查看与下载文件为任务提供输入资料,并保存执行产物。连接应用与设置能力授权外部应用,并维护任务需要的长期上下文。创建定时任务配置周期、时区和任务要求,查看每次运行结果。Task Agent 常见问题按当前状态检查权限、连接、任务和文件。GTM 产品介绍从网站建立共享项目背景,衔接市场调研、可见度分析和营销内容工作。创建第一个 GTM 项目输入网站,等待初始化,并检查第一批分析结果。管理项目与网站资料切换项目、刷新网站上下文,维护项目名称。公司分析与项目文档检查产品、竞品和营销资料,作为内容任务的背景。SEO 与网站性能阅读 PageSpeed 结果,分别检查移动端和桌面端。AI 品牌提及查看买家问题,以及模型回答是否提到你的品牌。连接 Google Analytics授权账户、选择 GA 属性,并查看流量报告。生成与发布 X 草稿生成帖子,检查预览,再到 X 完成发布。生成文章草稿设定风格、语言和读者,审阅并复制 Markdown。使用 Growth Agent通过项目内对话读取资料或发起后台操作。运行状态与常见问题检查排队、依赖和结果,避免把未完成误当作无数据。套餐与用量查看当前身份的权益、使用情况和账单。