Task Agent API

API documentation

Build Task Agent workflows with personal API keys, sessions, knowledge bases, skills, memory, files, and connectors.

MCP — specifically for Agents

Use the same Public API key and permissions. Connect over Streamable HTTP with an Authorization header; configure the key in your client credential store. The JSON below is a common configuration shape; adapt it to your client. No separate Hast MCP key is needed.

{
  "mcpServers": {
    "hast": {
      "url": "https://backend.hast.so/api/public/v1/mcp",
      "headers": {
        "Authorization": "Bearer <YOUR_EXISTING_PUBLIC_API_KEY>"
      }
    }
  }
}

Read hast://guides/overview to discover platform features. Use the relevant guides when creating Agents or working with WhatsApp, channels, knowledge bases, CRM and Connectors. Clients without resources can call get_guides_topic.

Quickstart

Send your first Task Agent prompt.

curl --request POST \
  --url https://backend.hast.so/api/public/v1/prompts \
  --header 'Authorization: Bearer hast_pk_...' \
  --header 'Content-Type: application/json' \
  --data '{"request_id":"req_123","prompt":"Summarize the latest workspace files."}'

Authentication

Send your personal API key as a Bearer token with every public API request.

Authorization: Bearer hast_pk_...

Keep keys server-side. A key has access to your Task Agent resources and should never be exposed in browser code.

Event streaming (SSE)

Session progress is delivered as HAST Event v2 over Server-Sent Events. Each durable event uses the same JSON envelope as GET /sessions/{id}/events.

SSE frame format

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

The id field is the durable sequence. Reconnect with after or Last-Event-ID to replay persisted events. Volatile deltas are not replayed.

Stream example

curl -N "https://backend.hast.so/api/public/v1/sessions/$SESSION_ID/events/stream?after=0" \
  -H "Authorization: Bearer hast_pk_..." \
  -H "Accept: text/event-stream"

The stream also sends : keep-alive comments between events.

Event v2 envelope
{
  "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"
}

Event types

Each type narrows the data object. Consumers should tolerate future event names.

context.compacted
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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
[
  {
    "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",
    "x-hast-event-variants": {
      "context.compacted": {
        "$ref": "#/definitions/context.compacted"
      },
      "error": {
        "$ref": "#/definitions/error"
      },
      "file.changed": {
        "$ref": "#/definitions/file.changed"
      },
      "input.requested": {
        "$ref": "#/definitions/input.requested"
      },
      "message.completed": {
        "$ref": "#/definitions/message.completed"
      },
      "message.delta": {
        "$ref": "#/definitions/message.delta"
      },
      "message.started": {
        "$ref": "#/definitions/message.started"
      },
      "plan.completed": {
        "$ref": "#/definitions/plan.completed"
      },
      "plan.updated": {
        "$ref": "#/definitions/plan.updated"
      },
      "reasoning.completed": {
        "$ref": "#/definitions/reasoning.completed"
      },
      "reasoning.delta": {
        "$ref": "#/definitions/reasoning.delta"
      },
      "reasoning.started": {
        "$ref": "#/definitions/reasoning.started"
      },
      "run.completed": {
        "$ref": "#/definitions/run.completed"
      },
      "run.failed": {
        "$ref": "#/definitions/run.failed"
      },
      "run.interrupted": {
        "$ref": "#/definitions/run.interrupted"
      },
      "run.queued": {
        "$ref": "#/definitions/run.queued"
      },
      "run.retrying": {
        "$ref": "#/definitions/run.retrying"
      },
      "run.started": {
        "$ref": "#/definitions/run.started"
      },
      "runtime.status": {
        "$ref": "#/definitions/runtime.status"
      },
      "tool.completed": {
        "$ref": "#/definitions/tool.completed"
      },
      "tool.started": {
        "$ref": "#/definitions/tool.started"
      },
      "tool.updated": {
        "$ref": "#/definitions/tool.updated"
      },
      "usage.updated": {
        "$ref": "#/definitions/usage.updated"
      },
      "warning": {
        "$ref": "#/definitions/warning"
      }
    }
  },
  {
    "properties": {
      "data": [
        {
          "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"
  }
]

API reference

115 endpoints from the current Backplane OpenAPI specification.

OpenAPI JSON

Prompts

POST/api/public/v1/promptsSubmit a public Task Agent promptapplication/json

Creates a normal conversational Task Agent session when session_id is omitted, or appends a turn to an existing session. request_id is idempotent.

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicTaskAgentPromptRequestDocPublic prompt request
Request schema
{
  "properties": {
    "dynamic_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "files": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "model": {
      "example": "hast/auto",
      "type": "string"
    },
    "prompt": {
      "example": "Summarize the release notes.",
      "type": "string"
    },
    "reasoning_effort": {
      "example": "medium",
      "type": "string"
    },
    "request_id": {
      "example": "client-turn-1",
      "type": "string"
    },
    "secret_bindings": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "session_id": {
      "example": "sess_abc123",
      "type": "string"
    },
    "skill_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "system_prompt": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

202

Accepted

Response schema
{
  "properties": {
    "request_id": {
      "example": "client-turn-1",
      "type": "string"
    },
    "session_id": {
      "example": "sess_abc123",
      "type": "string"
    },
    "status": {
      "example": "dispatch_pending",
      "type": "string"
    }
  },
  "type": "object"
}
401

Unauthorized

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
409

Conflict

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
413

Request Entity Too Large

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}

Sessions and events

GET/api/public/v1/sessionsList public Task Agent sessionsapplication/json

Parameters

ParameterLocationTypeDescription
limitqueryintegerPage size (1-100, default 50)
cursorquerystringOpaque cursor returned by the previous page

Responses

200

OK

Response schema
{
  "properties": {
    "has_more": {
      "type": "boolean"
    },
    "next_cursor": {
      "type": "string"
    },
    "sessions": {
      "items": {
        "properties": {
          "event_cursor": {
            "type": "integer"
          },
          "mode": {
            "type": "string"
          },
          "runtime_provider": {
            "type": "string"
          },
          "session_id": {
            "example": "sess_abc123",
            "type": "string"
          },
          "status": {
            "example": "running",
            "type": "string"
          },
          "task_origin": {
            "example": "session",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
GET/api/public/v1/sessions/{id}Read a public Task Agent sessionapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID

Responses

200

OK

Response schema
{
  "properties": {
    "session": {
      "properties": {
        "event_cursor": {
          "type": "integer"
        },
        "mode": {
          "type": "string"
        },
        "runtime_provider": {
          "type": "string"
        },
        "session_id": {
          "example": "sess_abc123",
          "type": "string"
        },
        "status": {
          "example": "running",
          "type": "string"
        },
        "task_origin": {
          "example": "session",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/sessions/{id}Delete a public Task Agent sessionapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID

Responses

200

OK

Response schema
{
  "properties": {
    "task": {
      "properties": {
        "client_id": {
          "example": "client-main-user-123",
          "type": "string"
        },
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "created_at": {
          "type": "string"
        },
        "event_cursor": {
          "example": 42,
          "type": "integer"
        },
        "id": {
          "example": "task-agent-123",
          "type": "string"
        },
        "mode": {
          "example": "agent_run",
          "type": "string"
        },
        "profile_id": {
          "example": "user_123",
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "runtime_provider": {
          "example": "cubesandbox",
          "type": "string"
        },
        "sandbox_id": {
          "example": "sandbox-main-user-123",
          "type": "string"
        },
        "sandbox_scope": {
          "example": "main",
          "type": "string"
        },
        "status": {
          "example": "needs_input",
          "type": "string"
        },
        "task_origin": {
          "example": "session",
          "type": "string"
        },
        "title": {
          "example": "Release validation",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "workspace_object_prefix": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
POST/api/public/v1/sessions/{id}/cancelCancel a public Task Agent sessionapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID

Responses

200

OK

Response schema
{
  "properties": {
    "task": {
      "properties": {
        "client_id": {
          "example": "client-main-user-123",
          "type": "string"
        },
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "created_at": {
          "type": "string"
        },
        "event_cursor": {
          "example": 42,
          "type": "integer"
        },
        "id": {
          "example": "task-agent-123",
          "type": "string"
        },
        "mode": {
          "example": "agent_run",
          "type": "string"
        },
        "profile_id": {
          "example": "user_123",
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "runtime_provider": {
          "example": "cubesandbox",
          "type": "string"
        },
        "sandbox_id": {
          "example": "sandbox-main-user-123",
          "type": "string"
        },
        "sandbox_scope": {
          "example": "main",
          "type": "string"
        },
        "status": {
          "example": "needs_input",
          "type": "string"
        },
        "task_origin": {
          "example": "session",
          "type": "string"
        },
        "title": {
          "example": "Release validation",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "workspace_object_prefix": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/sessions/{id}/eventsList public Task Agent Event v2 eventsapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID
afterqueryintegerReturn persisted events after this sequence
limitqueryintegerEvent page size, maximum 200

Responses

200

OK

Response schema
{
  "properties": {
    "events": {
      "items": {
        "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",
        "x-hast-event-variants": {
          "context.compacted": {
            "$ref": "#/definitions/context.compacted"
          },
          "error": {
            "$ref": "#/definitions/error"
          },
          "file.changed": {
            "$ref": "#/definitions/file.changed"
          },
          "input.requested": {
            "$ref": "#/definitions/input.requested"
          },
          "message.completed": {
            "$ref": "#/definitions/message.completed"
          },
          "message.delta": {
            "$ref": "#/definitions/message.delta"
          },
          "message.started": {
            "$ref": "#/definitions/message.started"
          },
          "plan.completed": {
            "$ref": "#/definitions/plan.completed"
          },
          "plan.updated": {
            "$ref": "#/definitions/plan.updated"
          },
          "reasoning.completed": {
            "$ref": "#/definitions/reasoning.completed"
          },
          "reasoning.delta": {
            "$ref": "#/definitions/reasoning.delta"
          },
          "reasoning.started": {
            "$ref": "#/definitions/reasoning.started"
          },
          "run.completed": {
            "$ref": "#/definitions/run.completed"
          },
          "run.failed": {
            "$ref": "#/definitions/run.failed"
          },
          "run.interrupted": {
            "$ref": "#/definitions/run.interrupted"
          },
          "run.queued": {
            "$ref": "#/definitions/run.queued"
          },
          "run.retrying": {
            "$ref": "#/definitions/run.retrying"
          },
          "run.started": {
            "$ref": "#/definitions/run.started"
          },
          "runtime.status": {
            "$ref": "#/definitions/runtime.status"
          },
          "tool.completed": {
            "$ref": "#/definitions/tool.completed"
          },
          "tool.started": {
            "$ref": "#/definitions/tool.started"
          },
          "tool.updated": {
            "$ref": "#/definitions/tool.updated"
          },
          "usage.updated": {
            "$ref": "#/definitions/usage.updated"
          },
          "warning": {
            "$ref": "#/definitions/warning"
          }
        }
      },
      "type": "array"
    },
    "has_more": {
      "example": true,
      "type": "boolean"
    },
    "next_after": {
      "example": 42,
      "format": "int64",
      "type": "integer",
      "x-nullable": true
    }
  },
  "type": "object"
}
GET/api/public/v1/sessions/{id}/events/streamStream public Task Agent eventstext/event-stream

Event v2 SSE supports after and Last-Event-ID replay.

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID
afterqueryintegerReturn persisted events after this sequence

SSE payload

Each data line contains one Event v2 JSON object. The event field matches the envelope type.

Event v2 envelope
{
  "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"
}

Responses

200

SSE stream

POST/api/public/v1/sessions/{id}/interruptInterrupt a public Task Agent turnapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringSession ID

Responses

200

OK

Response schema
{
  "properties": {
    "request_id": {
      "example": "task-agent-turn-1710000000000000000",
      "type": "string"
    },
    "status": {
      "example": "queued",
      "type": "string"
    }
  },
  "type": "object"
}
202

Accepted

Response schema
{
  "properties": {
    "request_id": {
      "example": "task-agent-turn-1710000000000000000",
      "type": "string"
    },
    "status": {
      "example": "queued",
      "type": "string"
    }
  },
  "type": "object"
}

Knowledge bases

GET/api/public/v1/knowledge-basesList public Task Agent Knowledge Basesapplication/json

Parameters

ParameterLocationTypeDescription
pagequeryintegerPage number, default 1
page_sizequeryintegerPage size, default 20 and max 100

Responses

200

OK

Response schema
{
  "properties": {
    "knowledge_bases": {
      "items": {
        "properties": {
          "cloudflare_instance_id": {
            "example": "hast-kb-product-docs",
            "type": "string"
          },
          "cloudflare_mcp_url": {
            "example": "https://hast-kb-product-docs.search.ai.cloudflare.com/mcp",
            "type": "string"
          },
          "cloudflare_public_endpoint_id": {
            "example": "hast-kb-product-docs",
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "error_message": {
            "type": "string"
          },
          "id": {
            "example": "kb_123",
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "name": {
            "example": "Product docs",
            "type": "string"
          },
          "source_content_type": {
            "example": "text/markdown",
            "type": "string"
          },
          "source_filename": {
            "example": "docs.md",
            "type": "string"
          },
          "source_type": {
            "example": "url",
            "type": "string"
          },
          "source_uri": {
            "example": "https://example.com/docs.md",
            "type": "string"
          },
          "status": {
            "example": "indexed",
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "pagination": {
      "properties": {
        "has_more": {
          "example": false,
          "type": "boolean"
        },
        "limit": {
          "example": 20,
          "type": "integer"
        },
        "offset": {
          "example": 0,
          "type": "integer"
        },
        "page": {
          "example": 1,
          "type": "integer"
        },
        "page_size": {
          "example": 20,
          "type": "integer"
        },
        "total": {
          "example": 1,
          "type": "integer"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
POST/api/public/v1/knowledge-basesCreate a public Task Agent Knowledge Baseapplication/json

Creates a URL Knowledge Base with JSON or a file Knowledge Base with multipart/form-data. Indexing continues asynchronously.

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentKnowledgeBaseCreateRequestDocURL Knowledge Base request
Request schema
{
  "properties": {
    "description": {
      "example": "Public product documentation",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "Product docs",
      "type": "string"
    },
    "source_type": {
      "example": "url",
      "type": "string"
    },
    "url": {
      "example": "https://example.com/docs.md",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

201

Created

Response schema
{
  "properties": {
    "knowledge_base": {
      "properties": {
        "cloudflare_instance_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "cloudflare_mcp_url": {
          "example": "https://hast-kb-product-docs.search.ai.cloudflare.com/mcp",
          "type": "string"
        },
        "cloudflare_public_endpoint_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "error_message": {
          "type": "string"
        },
        "id": {
          "example": "kb_123",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "example": "Product docs",
          "type": "string"
        },
        "source_content_type": {
          "example": "text/markdown",
          "type": "string"
        },
        "source_filename": {
          "example": "docs.md",
          "type": "string"
        },
        "source_type": {
          "example": "url",
          "type": "string"
        },
        "source_uri": {
          "example": "https://example.com/docs.md",
          "type": "string"
        },
        "status": {
          "example": "indexed",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
400

Bad Request

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/knowledge-bases/{id}Read a public Task Agent Knowledge Baseapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringKnowledge Base ID

Responses

200

OK

Response schema
{
  "properties": {
    "knowledge_base": {
      "properties": {
        "cloudflare_instance_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "cloudflare_mcp_url": {
          "example": "https://hast-kb-product-docs.search.ai.cloudflare.com/mcp",
          "type": "string"
        },
        "cloudflare_public_endpoint_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "error_message": {
          "type": "string"
        },
        "id": {
          "example": "kb_123",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "example": "Product docs",
          "type": "string"
        },
        "source_content_type": {
          "example": "text/markdown",
          "type": "string"
        },
        "source_filename": {
          "example": "docs.md",
          "type": "string"
        },
        "source_type": {
          "example": "url",
          "type": "string"
        },
        "source_uri": {
          "example": "https://example.com/docs.md",
          "type": "string"
        },
        "status": {
          "example": "indexed",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
PUT/api/public/v1/knowledge-bases/{id}Update a public Task Agent Knowledge Baseapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringKnowledge Base ID
request*bodyapi.TaskAgentKnowledgeBaseUpdateRequestDocKnowledge Base update request
Request schema
{
  "properties": {
    "description": {
      "example": "Updated description",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "Updated product docs",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "knowledge_base": {
      "properties": {
        "cloudflare_instance_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "cloudflare_mcp_url": {
          "example": "https://hast-kb-product-docs.search.ai.cloudflare.com/mcp",
          "type": "string"
        },
        "cloudflare_public_endpoint_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "error_message": {
          "type": "string"
        },
        "id": {
          "example": "kb_123",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "example": "Product docs",
          "type": "string"
        },
        "source_content_type": {
          "example": "text/markdown",
          "type": "string"
        },
        "source_filename": {
          "example": "docs.md",
          "type": "string"
        },
        "source_type": {
          "example": "url",
          "type": "string"
        },
        "source_uri": {
          "example": "https://example.com/docs.md",
          "type": "string"
        },
        "status": {
          "example": "indexed",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/knowledge-bases/{id}Update a public Task Agent Knowledge Baseapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringKnowledge Base ID
request*bodyapi.TaskAgentKnowledgeBaseUpdateRequestDocKnowledge Base update request
Request schema
{
  "properties": {
    "description": {
      "example": "Updated description",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "Updated product docs",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "knowledge_base": {
      "properties": {
        "cloudflare_instance_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "cloudflare_mcp_url": {
          "example": "https://hast-kb-product-docs.search.ai.cloudflare.com/mcp",
          "type": "string"
        },
        "cloudflare_public_endpoint_id": {
          "example": "hast-kb-product-docs",
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "error_message": {
          "type": "string"
        },
        "id": {
          "example": "kb_123",
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "example": "Product docs",
          "type": "string"
        },
        "source_content_type": {
          "example": "text/markdown",
          "type": "string"
        },
        "source_filename": {
          "example": "docs.md",
          "type": "string"
        },
        "source_type": {
          "example": "url",
          "type": "string"
        },
        "source_uri": {
          "example": "https://example.com/docs.md",
          "type": "string"
        },
        "status": {
          "example": "indexed",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/knowledge-bases/{id}Delete a public Task Agent Knowledge Baseapplication/json

Deletes the Cloudflare AI Search instance first when one exists, then deletes the local row.

Parameters

ParameterLocationTypeDescription
id*pathstringKnowledge Base ID

Responses

204

No Content

404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
502

Bad Gateway

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}

Skills

GET/api/public/v1/skillsList public Task Agent skillsapplication/json

Responses

200

OK

Response schema
{
  "properties": {
    "skills": {
      "items": {
        "properties": {
          "capability_id": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "directory_name": {
            "example": "e2e-summary",
            "type": "string"
          },
          "display_name": {
            "type": "string"
          },
          "enabled": {
            "type": "boolean"
          },
          "entrypoint_path": {
            "example": "SKILL.md",
            "type": "string"
          },
          "files": {
            "items": {
              "properties": {
                "content": {
                  "type": "string"
                },
                "path": {
                  "example": "SKILL.md",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "hash": {
            "example": "sha256:abc123",
            "type": "string"
          },
          "skill_id": {
            "example": "e2e-summary",
            "type": "string"
          },
          "source": {
            "example": "user",
            "type": "string"
          },
          "status": {
            "example": "active",
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
POST/api/public/v1/skillsCreate a public Task Agent skillapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentUserSkillRequestDocSkill request
Request schema
{
  "properties": {
    "description": {
      "type": "string"
    },
    "directory_name": {
      "example": "e2e-summary",
      "type": "string"
    },
    "display_name": {
      "example": "E2E Summary",
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "entrypoint_path": {
      "example": "SKILL.md",
      "type": "string"
    },
    "expected_checksum_sha256": {
      "type": "string"
    },
    "files": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "path": {
            "example": "SKILL.md",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skill_id": {
      "example": "e2e-summary",
      "type": "string"
    },
    "source_type": {
      "example": "upload",
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "skill": {
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "directory_name": {
          "example": "e2e-summary",
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "entrypoint_path": {
          "example": "SKILL.md",
          "type": "string"
        },
        "files": {
          "items": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "example": "SKILL.md",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "hash": {
          "example": "sha256:abc123",
          "type": "string"
        },
        "skill_id": {
          "example": "e2e-summary",
          "type": "string"
        },
        "source": {
          "example": "user",
          "type": "string"
        },
        "status": {
          "example": "active",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/skills/{skillID}Read, update, or delete a public Task Agent skillapplication/json

Parameters

ParameterLocationTypeDescription
skillID*pathstringSkill ID
requestbodyapi.TaskAgentUserSkillRequestDocSkill request
Request schema
{
  "properties": {
    "description": {
      "type": "string"
    },
    "directory_name": {
      "example": "e2e-summary",
      "type": "string"
    },
    "display_name": {
      "example": "E2E Summary",
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "entrypoint_path": {
      "example": "SKILL.md",
      "type": "string"
    },
    "expected_checksum_sha256": {
      "type": "string"
    },
    "files": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "path": {
            "example": "SKILL.md",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skill_id": {
      "example": "e2e-summary",
      "type": "string"
    },
    "source_type": {
      "example": "upload",
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "skill": {
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "directory_name": {
          "example": "e2e-summary",
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "entrypoint_path": {
          "example": "SKILL.md",
          "type": "string"
        },
        "files": {
          "items": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "example": "SKILL.md",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "hash": {
          "example": "sha256:abc123",
          "type": "string"
        },
        "skill_id": {
          "example": "e2e-summary",
          "type": "string"
        },
        "source": {
          "example": "user",
          "type": "string"
        },
        "status": {
          "example": "active",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PUT/api/public/v1/skills/{skillID}Read, update, or delete a public Task Agent skillapplication/json

Parameters

ParameterLocationTypeDescription
skillID*pathstringSkill ID
requestbodyapi.TaskAgentUserSkillRequestDocSkill request
Request schema
{
  "properties": {
    "description": {
      "type": "string"
    },
    "directory_name": {
      "example": "e2e-summary",
      "type": "string"
    },
    "display_name": {
      "example": "E2E Summary",
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "entrypoint_path": {
      "example": "SKILL.md",
      "type": "string"
    },
    "expected_checksum_sha256": {
      "type": "string"
    },
    "files": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "path": {
            "example": "SKILL.md",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skill_id": {
      "example": "e2e-summary",
      "type": "string"
    },
    "source_type": {
      "example": "upload",
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "skill": {
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "directory_name": {
          "example": "e2e-summary",
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "entrypoint_path": {
          "example": "SKILL.md",
          "type": "string"
        },
        "files": {
          "items": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "example": "SKILL.md",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "hash": {
          "example": "sha256:abc123",
          "type": "string"
        },
        "skill_id": {
          "example": "e2e-summary",
          "type": "string"
        },
        "source": {
          "example": "user",
          "type": "string"
        },
        "status": {
          "example": "active",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/skills/{skillID}Read, update, or delete a public Task Agent skillapplication/json

Parameters

ParameterLocationTypeDescription
skillID*pathstringSkill ID
requestbodyapi.TaskAgentUserSkillRequestDocSkill request
Request schema
{
  "properties": {
    "description": {
      "type": "string"
    },
    "directory_name": {
      "example": "e2e-summary",
      "type": "string"
    },
    "display_name": {
      "example": "E2E Summary",
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "entrypoint_path": {
      "example": "SKILL.md",
      "type": "string"
    },
    "expected_checksum_sha256": {
      "type": "string"
    },
    "files": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "path": {
            "example": "SKILL.md",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skill_id": {
      "example": "e2e-summary",
      "type": "string"
    },
    "source_type": {
      "example": "upload",
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "skill": {
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "directory_name": {
          "example": "e2e-summary",
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "entrypoint_path": {
          "example": "SKILL.md",
          "type": "string"
        },
        "files": {
          "items": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "example": "SKILL.md",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "hash": {
          "example": "sha256:abc123",
          "type": "string"
        },
        "skill_id": {
          "example": "e2e-summary",
          "type": "string"
        },
        "source": {
          "example": "user",
          "type": "string"
        },
        "status": {
          "example": "active",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/skills/{skillID}Read, update, or delete a public Task Agent skillapplication/json

Parameters

ParameterLocationTypeDescription
skillID*pathstringSkill ID
requestbodyapi.TaskAgentUserSkillRequestDocSkill request
Request schema
{
  "properties": {
    "description": {
      "type": "string"
    },
    "directory_name": {
      "example": "e2e-summary",
      "type": "string"
    },
    "display_name": {
      "example": "E2E Summary",
      "type": "string"
    },
    "enabled": {
      "type": "boolean"
    },
    "entrypoint_path": {
      "example": "SKILL.md",
      "type": "string"
    },
    "expected_checksum_sha256": {
      "type": "string"
    },
    "files": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "path": {
            "example": "SKILL.md",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "skill_id": {
      "example": "e2e-summary",
      "type": "string"
    },
    "source_type": {
      "example": "upload",
      "type": "string"
    },
    "url": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "skill": {
      "properties": {
        "capability_id": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "directory_name": {
          "example": "e2e-summary",
          "type": "string"
        },
        "display_name": {
          "type": "string"
        },
        "enabled": {
          "type": "boolean"
        },
        "entrypoint_path": {
          "example": "SKILL.md",
          "type": "string"
        },
        "files": {
          "items": {
            "properties": {
              "content": {
                "type": "string"
              },
              "path": {
                "example": "SKILL.md",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "hash": {
          "example": "sha256:abc123",
          "type": "string"
        },
        "skill_id": {
          "example": "e2e-summary",
          "type": "string"
        },
        "source": {
          "example": "user",
          "type": "string"
        },
        "status": {
          "example": "active",
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}

Memory

GET/api/public/v1/memoriesList public Task Agent memoriesapplication/json

Parameters

ParameterLocationTypeDescription
scope_typequerystringFilter memory category
scope_idquerystringWebhook ID; empty selects shared, omitted selects all in the category

Responses

200

OK

Response schema
{
  "properties": {
    "memories": {
      "items": {
        "properties": {
          "content": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "name": {
            "type": "string"
          },
          "scope_id": {
            "example": "",
            "type": "string"
          },
          "scope_type": {
            "enum": [
              "task_agent",
              "webhook"
            ],
            "example": "task_agent",
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
POST/api/public/v1/memoriesCreate a public Task Agent memoryapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentMemoryRequestDocMemory request
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/memories/{name}Read, update, or delete a public Task Agent memoryapplication/json

Parameters

ParameterLocationTypeDescription
name*pathstringMemory name
requestbodyapi.TaskAgentMemoryRequestDocMemory request
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PUT/api/public/v1/memories/{name}Read, update, or delete a public Task Agent memoryapplication/json

Parameters

ParameterLocationTypeDescription
name*pathstringMemory name
requestbodyapi.TaskAgentMemoryRequestDocMemory request
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/memories/{name}Read, update, or delete a public Task Agent memoryapplication/json

Parameters

ParameterLocationTypeDescription
name*pathstringMemory name
requestbodyapi.TaskAgentMemoryRequestDocMemory request
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/memories/{name}Read, update, or delete a public Task Agent memoryapplication/json

Parameters

ParameterLocationTypeDescription
name*pathstringMemory name
requestbodyapi.TaskAgentMemoryRequestDocMemory request
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/memories/by-id/{memoryID}Read a memory by ID within the authenticated userapplication/json

Parameters

ParameterLocationTypeDescription
memoryID*pathstringMemory ID

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PUT/api/public/v1/memories/by-id/{memoryID}Update a memory by ID, optionally moving its scopeapplication/json

Parameters

ParameterLocationTypeDescription
memoryID*pathstringMemory ID
request*bodyapi.TaskAgentMemoryRequestDocMemory update
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/memories/by-id/{memoryID}Update a memory by ID, optionally moving its scopeapplication/json

Parameters

ParameterLocationTypeDescription
memoryID*pathstringMemory ID
request*bodyapi.TaskAgentMemoryRequestDocMemory update
Request schema
{
  "properties": {
    "content": {
      "example": "Prefer concise validation notes.",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "name": {
      "example": "project-preferences",
      "type": "string"
    },
    "scope_id": {
      "example": "",
      "type": "string"
    },
    "scope_type": {
      "enum": [
        "task_agent",
        "webhook"
      ],
      "example": "task_agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "memory": {
      "properties": {
        "content": {
          "type": "string"
        },
        "created_at": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "name": {
          "type": "string"
        },
        "scope_id": {
          "example": "",
          "type": "string"
        },
        "scope_type": {
          "enum": [
            "task_agent",
            "webhook"
          ],
          "example": "task_agent",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/memories/by-id/{memoryID}Delete a memory by ID within the authenticated userapplication/json

Parameters

ParameterLocationTypeDescription
memoryID*pathstringMemory ID

Responses

200

OK

Response schema
{
  "properties": {
    "ok": {
      "example": true,
      "type": "boolean"
    }
  },
  "type": "object"
}

Files

GET/api/public/v1/filesList, download, or delete public workspace filesapplication/json

Parameters

ParameterLocationTypeDescription
session_idquerystringSession ID
pathquerystringWorkspace directory path
scopequerystringWorkspace scope

Responses

200

OK

Response schema
{
  "properties": {
    "has_more": {
      "type": "boolean"
    },
    "items": {
      "items": {
        "properties": {
          "file_id": {
            "example": "opaque-file-id",
            "type": "string"
          },
          "id": {
            "example": "opaque-file-id",
            "type": "string"
          },
          "name": {
            "example": "report.csv",
            "type": "string"
          },
          "path": {
            "example": "uploads/upload-id/report.csv",
            "type": "string"
          },
          "relative_path": {
            "example": "uploads/upload-id/report.csv",
            "type": "string"
          },
          "session_id": {
            "type": "string"
          },
          "size_bytes": {
            "example": 1024,
            "type": "integer"
          },
          "type": {
            "example": "file",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "next_cursor": {
      "type": "string"
    }
  },
  "type": "object"
}
POST/api/public/v1/filesUpload a public Task Agent fileapplication/json

Parameters

ParameterLocationTypeDescription
file*formDatafileFile

Responses

201

Created

Response schema
{
  "properties": {
    "file": {
      "properties": {
        "file_id": {
          "example": "opaque-file-id",
          "type": "string"
        },
        "id": {
          "example": "opaque-file-id",
          "type": "string"
        },
        "name": {
          "example": "report.csv",
          "type": "string"
        },
        "path": {
          "example": "uploads/upload-id/report.csv",
          "type": "string"
        },
        "relative_path": {
          "example": "uploads/upload-id/report.csv",
          "type": "string"
        },
        "session_id": {
          "type": "string"
        },
        "size_bytes": {
          "example": 1024,
          "type": "integer"
        },
        "type": {
          "example": "file",
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/files/{relativePath}Download or delete a public workspace fileapplication/octet-stream

Parameters

ParameterLocationTypeDescription
relativePath*pathstringWorkspace relative path
session_idquerystringSession ID
file_id*querystringOpaque file ID
scopequerystringWorkspace scope

Responses

200

Workspace file

Response schema
{
  "type": "file"
}
DELETE/api/public/v1/files/{relativePath}Download or delete a public workspace fileapplication/octet-stream

Parameters

ParameterLocationTypeDescription
relativePath*pathstringWorkspace relative path
session_idquerystringSession ID
file_id*querystringOpaque file ID
scopequerystringWorkspace scope

Responses

200

Workspace file

Response schema
{
  "type": "file"
}

Connectors

POST/api/public/v1/connectors/{provider}/oauth/authorizeStart public connector OAuth authorizationapplication/json

Parameters

ParameterLocationTypeDescription
provider*pathstringConnector provider

Responses

200

OK

Response schema
{
  "properties": {
    "auth_url": {
      "type": "string"
    },
    "connected_account_id": {
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/connectors/accountsList public connector accountsapplication/json

Responses

200

OK

Response schema
{
  "properties": {
    "connector_accounts": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
GET/api/public/v1/connectors/accounts/{id}Read, update, or delete a public connector accountapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringConnector account ID
requestbodyapi.TaskAgentConnectorAccountRequestDocConnector account request
Request schema
{
  "properties": {
    "external_account_ref": {
      "example": "connected-account-id",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "provider": {
      "example": "github",
      "type": "string"
    },
    "status": {
      "example": "connected",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "connector_account": {
      "additionalProperties": {},
      "type": "object"
    }
  },
  "type": "object"
}
PUT/api/public/v1/connectors/accounts/{id}Read, update, or delete a public connector accountapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringConnector account ID
requestbodyapi.TaskAgentConnectorAccountRequestDocConnector account request
Request schema
{
  "properties": {
    "external_account_ref": {
      "example": "connected-account-id",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "provider": {
      "example": "github",
      "type": "string"
    },
    "status": {
      "example": "connected",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "connector_account": {
      "additionalProperties": {},
      "type": "object"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/connectors/accounts/{id}Read, update, or delete a public connector accountapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringConnector account ID
requestbodyapi.TaskAgentConnectorAccountRequestDocConnector account request
Request schema
{
  "properties": {
    "external_account_ref": {
      "example": "connected-account-id",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "provider": {
      "example": "github",
      "type": "string"
    },
    "status": {
      "example": "connected",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "connector_account": {
      "additionalProperties": {},
      "type": "object"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/connectors/accounts/{id}Read, update, or delete a public connector accountapplication/json

Parameters

ParameterLocationTypeDescription
id*pathstringConnector account ID
requestbodyapi.TaskAgentConnectorAccountRequestDocConnector account request
Request schema
{
  "properties": {
    "external_account_ref": {
      "example": "connected-account-id",
      "type": "string"
    },
    "metadata": {
      "additionalProperties": {},
      "type": "object"
    },
    "provider": {
      "example": "github",
      "type": "string"
    },
    "status": {
      "example": "connected",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "connector_account": {
      "additionalProperties": {},
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/connectors/catalogList public connector catalogapplication/json

Parameters

ParameterLocationTypeDescription
searchquerystringSearch toolkits
cursorquerystringNext cursor
limitqueryintegerPage size, maximum 100

Responses

200

OK

Response schema
{
  "properties": {
    "agent_id": {
      "type": "string"
    },
    "connection_scope": {
      "type": "string"
    },
    "connectors": {
      "items": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "label": {
            "example": "GitHub",
            "type": "string"
          },
          "logo": {
            "type": "string"
          },
          "provider": {
            "example": "github",
            "type": "string"
          },
          "runtime_provider": {
            "example": "composio",
            "type": "string"
          },
          "start_url": {
            "type": "string"
          },
          "status": {
            "example": "connected",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "has_more": {
      "type": "boolean"
    },
    "limit": {
      "example": 20,
      "type": "integer"
    },
    "next_cursor": {
      "type": "string"
    },
    "profile_id": {
      "type": "string"
    },
    "search": {
      "example": "github",
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/connectors/statusList public connector statusapplication/json

Parameters

ParameterLocationTypeDescription
searchquerystringSearch connector catalog
cursorquerystringNext cursor
limitqueryintegerPage size, maximum 100

Responses

200

OK

Response schema
{
  "properties": {
    "agent_id": {
      "type": "string"
    },
    "connection_scope": {
      "type": "string"
    },
    "connectors": {
      "items": {
        "properties": {
          "account_label": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "label": {
            "example": "GitHub",
            "type": "string"
          },
          "logo": {
            "type": "string"
          },
          "provider": {
            "example": "github",
            "type": "string"
          },
          "runtime_provider": {
            "example": "composio",
            "type": "string"
          },
          "start_url": {
            "type": "string"
          },
          "status": {
            "example": "connected",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "has_more": {
      "type": "boolean"
    },
    "limit": {
      "example": 20,
      "type": "integer"
    },
    "next_cursor": {
      "type": "string"
    },
    "profile_id": {
      "type": "string"
    },
    "search": {
      "example": "github",
      "type": "string"
    }
  },
  "type": "object"
}

Other

GET/api/public/v1/business-resourcesList CRM and customer communication knowledge basesapplication/json

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}Browse CRM records or communication knowledge source documentsapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
objectquerystringCRM object (default people); use CRM schema for supported objects
cursorquerystringCRM next-page cursor
queryquerystringCommunication knowledge search (maximum 2000 bytes); omit to browse sources
beforequerystringCommunication document pagination cursor

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
DELETE/api/public/v1/business-resources/{resource_id}Delete an unused channel resource configurationapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/crm/{object}Search CRM recordsapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
queryquerystringSearch (maximum 300 bytes, no quotes or line breaks)
cursorquerystringProvider cursor returned by the previous page

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/business-resources/{resource_id}/crm/{object}Create a CRM recordapplication/json

Discover objects and writable fields using the CRM schema endpoint before writing. Read back on uncertain errors before retrying.

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
request*bodyapi.PublicCRMWriteDocCreate a CRM record request
Request schema
{
  "properties": {
    "request_id": {
      "description": "Stable UUID required on create. Reuse it only for the identical create request.",
      "type": "string"
    },
    "updated_at": {
      "description": "Required on update; use updatedAt from the last record readback.",
      "type": "string"
    },
    "values": {
      "additionalProperties": {},
      "description": "Only writable fields from GET /business-resources/{resource_id}/crm/schema.",
      "type": "object"
    }
  },
  "required": [
    "values"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/crm/{object}/{record_id}Read CRM record detailsapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
record_id*pathstringrecord_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
PATCH/api/public/v1/business-resources/{resource_id}/crm/{object}/{record_id}Update a CRM recordapplication/json

Discover objects and writable fields using the CRM schema endpoint before writing. Read back on uncertain errors before retrying.

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
record_id*pathstringrecord_id
request*bodyapi.PublicCRMWriteDocUpdate a CRM record request
Request schema
{
  "properties": {
    "request_id": {
      "description": "Stable UUID required on create. Reuse it only for the identical create request.",
      "type": "string"
    },
    "updated_at": {
      "description": "Required on update; use updatedAt from the last record readback.",
      "type": "string"
    },
    "values": {
      "additionalProperties": {},
      "description": "Only writable fields from GET /business-resources/{resource_id}/crm/schema.",
      "type": "object"
    }
  },
  "required": [
    "values"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
DELETE/api/public/v1/business-resources/{resource_id}/crm/{object}/{record_id}Delete a CRM recordapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
record_id*pathstringrecord_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/crm/{object}/{record_id}/files/{field}/{file_id}Download a file attached to a CRM recordapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
record_id*pathstringrecord_id
field*pathstringfield
file_id*pathstringfile_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/crm/{object}/{record_id}/relations/{field}Browse related CRM recordsapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id
object*pathstringobject
record_id*pathstringrecord_id
field*pathstringfield
cursorquerystringProvider cursor returned by the previous page

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/crm/schemaRead CRM business objects and field schemaapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/business-resources/{resource_id}/membersList CRM member identities for owner and assignee fieldsapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringOwned CRM resource ID
cursorquerystringNext cursor from the previous member page

Responses

200

OK

Response schema
{
  "properties": {
    "has_more": {
      "type": "boolean"
    },
    "members": {
      "items": {
        "properties": {
          "email": {
            "type": "string"
          },
          "first_name": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "last_name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "next_cursor": {
      "type": "string"
    }
  },
  "type": "object"
}
POST/api/public/v1/business-resources/{resource_id}/membersCreate or reuse a CRM member without retaining a passwordapplication/json

Uses the selected managed workspace's existing registration flow. No invitation is sent. Generated passwords are discarded. Does not reset accounts outside this CRM; provider email-verification settings still apply.

Parameters

ParameterLocationTypeDescription
resource_id*pathstringOwned platform-managed CRM resource ID
request*bodychannel.CRMMemberInputActual email and name; never a password
Request schema
{
  "properties": {
    "email": {
      "type": "string"
    },
    "first_name": {
      "type": "string"
    },
    "last_name": {
      "type": "string"
    }
  },
  "required": [
    "email",
    "first_name"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "email": {
      "type": "string"
    },
    "first_name": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "last_name": {
      "type": "string"
    }
  },
  "type": "object"
}
POST/api/public/v1/business-resources/{resource_id}/provisionRetry an incomplete CRM provisioning operationapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringresource_id

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/business-resources/communication-knowledgeCreate a customer communication knowledge baseapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.channelCRMCreateRequestCreate a customer communication knowledge base request
Request schema
{
  "properties": {
    "name": {
      "type": "string"
    },
    "request_id": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/business-resources/crmCreate an optional Twenty workspaceapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.channelCRMCreateRequestCreate an optional Twenty workspace request
Request schema
{
  "properties": {
    "name": {
      "type": "string"
    },
    "request_id": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/channelsList user channel connectionsapplication/json
POST/api/public/v1/channelsConnect a verified existing Chatwoot message inboxapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicChannelConnectionDocRequest body
Request schema
{
  "properties": {
    "inbox_id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    }
  },
  "required": [
    "inbox_id",
    "name"
  ],
  "type": "object"
}
DELETE/api/public/v1/channels/{connection_id}Disconnect a user channelapplication/json

Parameters

ParameterLocationTypeDescription
connection_id*pathstringConnection ID
PUT/api/public/v1/channels/{connection_id}/bindingAtomically rebind a channelapplication/json

Parameters

ParameterLocationTypeDescription
connection_id*pathstringChannel connection ID
body*bodyapi.taskAgentChannelBindingRequestExpected and target Webhook IDs; empty target releases binding
Request schema
{
  "properties": {
    "expected_binding_version": {
      "type": "integer"
    },
    "expected_hook_id": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    },
    "target_hook_id": {
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/channels/{connection_id}/installationRead channel installation information

WeChat installation includes wechat_trusted_ips, the configured public egress IP list. An empty array means the deployment has not configured it; other platforms omit this field. Slack installation includes slack_trigger_rules and the callback URL. Use the returned rules to preserve existing exceptions when updating a Slack channel.

PATCH/api/public/v1/channels/{connection_id}/slackSet Slack mention requirements and automatic reply exceptionsapplication/json

Replace the complete Slack trigger rules. Mentions, exempt channel IDs and exempt user or bot IDs independently trigger replies. Both ID arrays support multiple values (up to 100 unique IDs each). Direct messages trigger normally and own-bot echoes are ignored. Requires an owned Slack channel; read /channels/{connection_id}/installation before editing and after saving.

Parameters

ParameterLocationTypeDescription
connection_id*pathstringChannel ID
request*bodychannel.SlackTriggerRulesComplete Slack trigger rules
Request schema
{
  "properties": {
    "auto_reply_channel_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "auto_reply_sender_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "require_mention": {
      "type": "boolean"
    }
  },
  "required": [
    "require_mention"
  ],
  "type": "object"
}
PATCH/api/public/v1/channels/{connection_id}/wechat-kfComplete WeChat customer service setupapplication/json

Parameters

ParameterLocationTypeDescription
connection_id*pathstringconnection_id
request*bodyapi.PublicWeChatCompleteDocComplete WeChat customer service setup request
Request schema
{
  "properties": {
    "corp_secret": {
      "type": "string"
    },
    "open_kfid": {
      "type": "string"
    }
  },
  "required": [
    "corp_secret",
    "open_kfid"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/{connection_id}/wechat-kf/domain-verificationUpload a WeCom domain verification fileapplication/json

Parameters

ParameterLocationTypeDescription
connection_id*pathstringconnection_id
request*bodyapi.PublicDomainVerificationDocUpload a WeCom domain verification file request
Request schema
{
  "properties": {
    "content": {
      "type": "string"
    },
    "filename": {
      "type": "string"
    }
  },
  "required": [
    "content",
    "filename"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
PATCH/api/public/v1/channels/{connection_id}/whatsappReauthorize an official WhatsApp Cloud connectionapplication/json

Parameters

ParameterLocationTypeDescription
connection_id*pathstringconnection_id
request*bodyapi.reauthorizeWhatsAppChannelRequestReauthorize an official WhatsApp Cloud connection request
Request schema
{
  "properties": {
    "app_secret_id": {
      "type": "string"
    },
    "business_account_id": {
      "type": "string"
    },
    "phone_number_id": {
      "type": "string"
    },
    "token_secret_id": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/accountInitialize a user channel accountapplication/json
GET/api/public/v1/channels/agentsList Agents available for channel assignmentapplication/json

Parameters

ParameterLocationTypeDescription
pagequeryintegerPage number
page_sizequeryintegerPage size, maximum 100

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/authorizations/{provider}Begin channel authorizationapplication/json

Parameters

ParameterLocationTypeDescription
provider*pathstringprovider

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/authorizations/{provider}/completeComplete channel authorizationapplication/json

Parameters

ParameterLocationTypeDescription
provider*pathstringprovider
request*bodyapi.PublicChannelAuthorizationDocComplete channel authorization request
Request schema
{
  "properties": {
    "code": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    },
    "state": {
      "type": "string"
    }
  },
  "required": [
    "code",
    "state"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/facebookConnect a Facebook pageapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicFacebookConnectDocConnect a Facebook page request
Request schema
{
  "properties": {
    "page_id": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    },
    "token": {
      "type": "string"
    }
  },
  "required": [
    "page_id",
    "token"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/facebook/pagesList authorized Facebook pagesapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicFacebookPagesDocList authorized Facebook pages request
Request schema
{
  "properties": {
    "token": {
      "type": "string"
    }
  },
  "required": [
    "token"
  ],
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/channels/inboxesList available Chatwoot message inboxesapplication/json
GET/api/public/v1/channels/resourcesList channel resources and operationsapplication/json
POST/api/public/v1/channels/resourcesRegister an independently bindable channel resourceapplication/json

Parameters

ParameterLocationTypeDescription
body*bodyrepository.ChannelResourceResource reference
Request schema
{
  "properties": {
    "base_url": {
      "type": "string"
    },
    "created_at": {
      "type": "string"
    },
    "credential_expires_at": {
      "type": "string"
    },
    "id": {
      "type": "string"
    },
    "kind": {
      "enum": [
        "hast_memory",
        "cloudflare",
        "hindsight",
        "twenty",
        "tool",
        "schedule"
      ],
      "type": "string",
      "x-enum-varnames": [
        "ChannelResourceMemory",
        "ChannelResourceKnowledge",
        "ChannelResourceFacts",
        "ChannelResourceCRM",
        "ChannelResourceTool",
        "ChannelResourceSchedule"
      ]
    },
    "managed": {
      "type": "boolean"
    },
    "name": {
      "type": "string"
    },
    "reference_id": {
      "type": "string"
    },
    "scope_type": {
      "type": "string"
    },
    "secret_id": {
      "type": "string"
    },
    "status": {
      "type": "string"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/channels/resources/{resource_id}Delete an unused channel resource configurationapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringResource ID
POST/api/public/v1/channels/resources/{resource_id}/provisionRetry an incomplete CRM provisioning operationapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringCRM resource ID
PUT/api/public/v1/channels/resources/{resource_id}/statusDisable or reverify a CRM resourceapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringCRM resource ID
request*bodyapi.PublicChannelStatusDocRequest body
Request schema
{
  "properties": {
    "status": {
      "type": "string"
    }
  },
  "required": [
    "status"
  ],
  "type": "object"
}
POST/api/public/v1/channels/resources/{resource_id}/verifyVerify a Twenty resource credential and workspaceapplication/json

Parameters

ParameterLocationTypeDescription
resource_id*pathstringCRM resource ID
POST/api/public/v1/channels/resources/crmCreate an optional Twenty workspaceapplication/json

Parameters

ParameterLocationTypeDescription
body*bodyapi.channelCRMCreateRequestCRM name and stable request ID
Request schema
{
  "properties": {
    "name": {
      "type": "string"
    },
    "request_id": {
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/channels/schedule_sourcesList verified Webhook Schedule destinationsapplication/json
GET/api/public/v1/channels/sendsList user channel sends and provider statusesapplication/json
GET/api/public/v1/channels/setupRead channel setup configurationapplication/json

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
POST/api/public/v1/channels/setupCreate a message channelapplication/json

Slack accepts optional slack_trigger_rules with require_mention, auto_reply_channel_ids and auto_reply_sender_ids. Omit it for mention-required defaults. Channel and sender exceptions are OR conditions; obtain actual IDs from the authorized Slack workspace.

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicMessageChannelDocRequest body
Request schema
{
  "properties": {
    "account_id": {
      "type": "string"
    },
    "account_sid": {
      "type": "string"
    },
    "api_key": {
      "type": "string"
    },
    "api_secret": {
      "type": "string"
    },
    "application_id": {
      "type": "string"
    },
    "auth_token": {
      "type": "string"
    },
    "bot_token": {
      "type": "string"
    },
    "callback_token": {
      "type": "string"
    },
    "corp_id": {
      "type": "string"
    },
    "corp_secret": {
      "type": "string"
    },
    "email": {
      "type": "string"
    },
    "encoding_aes_key": {
      "type": "string"
    },
    "imap_address": {
      "type": "string"
    },
    "imap_login": {
      "type": "string"
    },
    "imap_password": {
      "type": "string"
    },
    "line_channel_id": {
      "type": "string"
    },
    "line_channel_secret": {
      "type": "string"
    },
    "line_channel_token": {
      "type": "string"
    },
    "medium": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "open_kfid": {
      "type": "string"
    },
    "phone_number": {
      "type": "string"
    },
    "platform": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    },
    "signing_secret": {
      "type": "string"
    },
    "slack_trigger_rules": {
      "properties": {
        "auto_reply_channel_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "auto_reply_sender_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "require_mention": {
          "type": "boolean"
        }
      },
      "required": [
        "require_mention"
      ],
      "type": "object"
    },
    "smtp_address": {
      "type": "string"
    },
    "smtp_login": {
      "type": "string"
    },
    "smtp_password": {
      "type": "string"
    },
    "website_url": {
      "type": "string"
    }
  },
  "type": "object"
}
POST/api/public/v1/channels/whatsappCreate an official WhatsApp Cloud connectionapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.createWhatsAppChannelRequestCreate an official WhatsApp Cloud connection request
Request schema
{
  "properties": {
    "app_secret_id": {
      "type": "string"
    },
    "business_account_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "phone_number": {
      "type": "string"
    },
    "phone_number_id": {
      "type": "string"
    },
    "require_admission": {
      "type": "boolean"
    },
    "token_secret_id": {
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/chat_memory_projectsList user chat memory projectsapplication/json
POST/api/public/v1/chat_memory_projectsCreate a user chat memory projectapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.PublicChatMemoryProjectDocRequest body
Request schema
{
  "properties": {
    "customer_connection_id": {
      "type": "string"
    },
    "customer_id": {
      "type": "integer"
    },
    "name": {
      "type": "string"
    }
  },
  "required": [
    "name"
  ],
  "type": "object"
}
GET/api/public/v1/chat_memory_projects/writesList user chat memory indexing operationsapplication/json
GET/api/public/v1/files.zipDownload a public workspace ZIPapplication/zip

Parameters

ParameterLocationTypeDescription
session_idquerystringSession ID
scopequerystringWorkspace scope

Responses

200

Workspace ZIP

Response schema
{
  "type": "file"
}
GET/api/public/v1/guidesDiscover Agent-facing Hast AIP guidesapplication/json

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/guides/{topic}Read a detailed Hast AIP guide for Agentsapplication/json

Parameters

ParameterLocationTypeDescription
topic*pathstringTopic from GET /guides

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/modelsList Task Agent Modelsapplication/json

Responses

200

OK

Response schema
{
  "additionalProperties": true,
  "type": "object"
}
GET/api/public/v1/schedulesList Task Agent schedulesapplication/json

Parameters

ParameterLocationTypeDescription
limitqueryintegerSchedule page size

Responses

200

OK

Response schema
{
  "properties": {
    "schedules": {
      "items": {
        "properties": {
          "config": {
            "additionalProperties": {},
            "type": "object"
          },
          "cron_spec": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "last_run_at": {
            "type": "string"
          },
          "last_task_id": {
            "type": "string"
          },
          "mode": {
            "type": "string"
          },
          "next_run_at": {
            "type": "string"
          },
          "prompt": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "timezone": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
POST/api/public/v1/schedulesCreate Task Agent scheduleapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentScheduleRequestDocSchedule request
Request schema
{
  "properties": {
    "config": {
      "additionalProperties": {},
      "type": "object"
    },
    "cron_spec": {
      "example": "0 15 * * 1",
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "mode": {
      "example": "direct_execute",
      "type": "string"
    },
    "next_run_at": {
      "example": "2026-09-15T01:00:00Z",
      "type": "string"
    },
    "prompt": {
      "example": "Summarize the workspace.",
      "type": "string"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "timezone": {
      "example": "Asia/Shanghai",
      "type": "string"
    },
    "title": {
      "example": "Weekly workspace report",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "schedule": {
      "properties": {
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "cron_spec": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "last_run_at": {
          "type": "string"
        },
        "last_task_id": {
          "type": "string"
        },
        "mode": {
          "type": "string"
        },
        "next_run_at": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "title": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
GET/api/public/v1/schedules/{scheduleID}Get Task Agent scheduleapplication/json

Parameters

ParameterLocationTypeDescription
scheduleID*pathstringSchedule ID

Responses

200

OK

Response schema
{
  "properties": {
    "schedule": {
      "properties": {
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "cron_spec": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "last_run_at": {
          "type": "string"
        },
        "last_task_id": {
          "type": "string"
        },
        "mode": {
          "type": "string"
        },
        "next_run_at": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "title": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PUT/api/public/v1/schedules/{scheduleID}Update Task Agent scheduleapplication/json

Parameters

ParameterLocationTypeDescription
scheduleID*pathstringSchedule ID
request*bodyapi.TaskAgentScheduleRequestDocSchedule request
Request schema
{
  "properties": {
    "config": {
      "additionalProperties": {},
      "type": "object"
    },
    "cron_spec": {
      "example": "0 15 * * 1",
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "mode": {
      "example": "direct_execute",
      "type": "string"
    },
    "next_run_at": {
      "example": "2026-09-15T01:00:00Z",
      "type": "string"
    },
    "prompt": {
      "example": "Summarize the workspace.",
      "type": "string"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "timezone": {
      "example": "Asia/Shanghai",
      "type": "string"
    },
    "title": {
      "example": "Weekly workspace report",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "schedule": {
      "properties": {
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "cron_spec": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "last_run_at": {
          "type": "string"
        },
        "last_task_id": {
          "type": "string"
        },
        "mode": {
          "type": "string"
        },
        "next_run_at": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "title": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/schedules/{scheduleID}Update Task Agent scheduleapplication/json

Parameters

ParameterLocationTypeDescription
scheduleID*pathstringSchedule ID
request*bodyapi.TaskAgentScheduleRequestDocSchedule request
Request schema
{
  "properties": {
    "config": {
      "additionalProperties": {},
      "type": "object"
    },
    "cron_spec": {
      "example": "0 15 * * 1",
      "type": "string"
    },
    "interval_seconds": {
      "type": "integer"
    },
    "mode": {
      "example": "direct_execute",
      "type": "string"
    },
    "next_run_at": {
      "example": "2026-09-15T01:00:00Z",
      "type": "string"
    },
    "prompt": {
      "example": "Summarize the workspace.",
      "type": "string"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "timezone": {
      "example": "Asia/Shanghai",
      "type": "string"
    },
    "title": {
      "example": "Weekly workspace report",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "schedule": {
      "properties": {
        "config": {
          "additionalProperties": {},
          "type": "object"
        },
        "cron_spec": {
          "type": "string"
        },
        "id": {
          "type": "string"
        },
        "last_run_at": {
          "type": "string"
        },
        "last_task_id": {
          "type": "string"
        },
        "mode": {
          "type": "string"
        },
        "next_run_at": {
          "type": "string"
        },
        "prompt": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "title": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/schedules/{scheduleID}Delete Task Agent scheduleapplication/json

Parameters

ParameterLocationTypeDescription
scheduleID*pathstringSchedule ID

Responses

200

OK

Response schema
{
  "properties": {
    "ok": {
      "example": true,
      "type": "boolean"
    }
  },
  "type": "object"
}
GET/api/public/v1/schedules/{scheduleID}/runsList Task Agent schedule runsapplication/json

Parameters

ParameterLocationTypeDescription
scheduleID*pathstringSchedule ID
limitqueryintegerRun page size

Responses

200

OK

Response schema
{
  "properties": {
    "runs": {
      "items": {
        "properties": {
          "id": {
            "type": "string"
          },
          "metadata": {
            "additionalProperties": {},
            "type": "object"
          },
          "run_at": {
            "type": "string"
          },
          "schedule_id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "task_id": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
GET/api/public/v1/secretsList User Secretsapplication/json

Lists owned User Secret metadata. Secret values are write-only and are never returned.

Responses

200

OK

Response schema
{
  "properties": {
    "secrets": {
      "items": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "id": {
            "example": "sec_123",
            "type": "string"
          },
          "name": {
            "example": "kubeconfig",
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
POST/api/public/v1/secretsCreate a User Secretapplication/json

Creates a write-only User Secret. The response returns metadata only.

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentUserSecretCreateRequestDocSecret request
Request schema
{
  "properties": {
    "name": {
      "example": "kubeconfig",
      "type": "string"
    },
    "value": {
      "example": "write-only",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

201

Created

Response schema
{
  "properties": {
    "secret": {
      "properties": {
        "created_at": {
          "type": "string"
        },
        "id": {
          "example": "sec_123",
          "type": "string"
        },
        "name": {
          "example": "kubeconfig",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/secrets/{secretID}Update a User Secret valueapplication/json

Replaces the write-only Secret value. The response returns metadata only.

Parameters

ParameterLocationTypeDescription
secretID*pathstringSecret ID
request*bodyapi.TaskAgentUserSecretUpdateRequestDocSecret request
Request schema
{
  "properties": {
    "value": {
      "example": "write-only",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "secret": {
      "properties": {
        "created_at": {
          "type": "string"
        },
        "id": {
          "example": "sec_123",
          "type": "string"
        },
        "name": {
          "example": "kubeconfig",
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/secrets/{secretID}Delete a User Secretapplication/json

Parameters

ParameterLocationTypeDescription
secretID*pathstringSecret ID

Responses

204

No Content

404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
409

Conflict

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/webhooksList public Task Agent Webhooksapplication/json

Responses

200

OK

Response schema
{
  "properties": {
    "hooks": {
      "items": {
        "properties": {
          "communication_knowledge_base_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "created_at": {
            "type": "string"
          },
          "crm_ids": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "dynamic_tools": {
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": "array"
          },
          "hook_id": {
            "example": "hook_123",
            "type": "string"
          },
          "knowledge_base_list": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "memory": {
            "properties": {
              "read_scope": {
                "enum": [
                  "self",
                  "webhook",
                  "all"
                ],
                "example": "self",
                "type": "string"
              },
              "write_scope": {
                "enum": [
                  "self",
                  "shared"
                ],
                "example": "self",
                "type": "string"
              }
            },
            "type": "object"
          },
          "model": {
            "type": "string"
          },
          "model_source": {
            "type": "string"
          },
          "policies": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "reasoning_effort": {
            "type": "string"
          },
          "runtime_tools": {
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": "array"
          },
          "sandbox_mode": {
            "type": "string"
          },
          "secret_bindings": {
            "items": {
              "additionalProperties": {},
              "type": "object"
            },
            "type": "array"
          },
          "secrets": {
            "items": {
              "properties": {
                "name": {
                  "example": "CRM_TOKEN",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "selected_skills": {
            "items": {
              "properties": {
                "enabled": {
                  "type": "boolean"
                },
                "skill_id": {
                  "example": "usr_123",
                  "type": "string"
                },
                "source": {
                  "example": "user",
                  "type": "string"
                }
              },
              "type": "object"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "system_prompt": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "url": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "pagination": {
      "additionalProperties": {},
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
POST/api/public/v1/webhooksCreate a public Task Agent Webhookapplication/json

Parameters

ParameterLocationTypeDescription
request*bodyapi.TaskAgentWebhookRequestDocWebhook request
Request schema
{
  "properties": {
    "communication_knowledge_base_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "crm_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "description": {
      "type": "string"
    },
    "dynamic_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "hook_id": {
      "example": "hook_123",
      "type": "string"
    },
    "http_request": {
      "additionalProperties": {},
      "type": "object"
    },
    "knowledge_base_list": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "memory": {
      "properties": {
        "read_scope": {
          "enum": [
            "self",
            "webhook",
            "all"
          ],
          "example": "self",
          "type": "string"
        },
        "write_scope": {
          "enum": [
            "self",
            "shared"
          ],
          "example": "self",
          "type": "string"
        }
      },
      "type": "object"
    },
    "model": {
      "example": "hast/auto",
      "type": "string"
    },
    "model_source": {
      "type": "string"
    },
    "policies": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "reasoning_effort": {
      "example": "medium",
      "type": "string"
    },
    "runtime_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "sandbox_mode": {
      "example": "read_only",
      "type": "string"
    },
    "secret_bindings": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "secrets": {
      "items": {
        "properties": {
          "name": {
            "example": "CRM_TOKEN",
            "type": "string"
          },
          "value": {
            "example": "write-only",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "selected_skills": {
      "items": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "skill_id": {
            "example": "usr_123",
            "type": "string"
          },
          "source": {
            "example": "user",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "system_prompt": {
      "type": "string"
    },
    "title": {
      "example": "Support Agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

201

Created

Response schema
{
  "properties": {
    "hook": {
      "properties": {
        "communication_knowledge_base_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "type": "string"
        },
        "crm_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "dynamic_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "hook_id": {
          "example": "hook_123",
          "type": "string"
        },
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "memory": {
          "properties": {
            "read_scope": {
              "enum": [
                "self",
                "webhook",
                "all"
              ],
              "example": "self",
              "type": "string"
            },
            "write_scope": {
              "enum": [
                "self",
                "shared"
              ],
              "example": "self",
              "type": "string"
            }
          },
          "type": "object"
        },
        "model": {
          "type": "string"
        },
        "model_source": {
          "type": "string"
        },
        "policies": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reasoning_effort": {
          "type": "string"
        },
        "runtime_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "sandbox_mode": {
          "type": "string"
        },
        "secret_bindings": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "secrets": {
          "items": {
            "properties": {
              "name": {
                "example": "CRM_TOKEN",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "selected_skills": {
          "items": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "skill_id": {
                "example": "usr_123",
                "type": "string"
              },
              "source": {
                "example": "user",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
GET/api/public/v1/webhooks/{hook_id}Read a public Task Agent Webhookapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID

Responses

200

OK

Response schema
{
  "properties": {
    "hook": {
      "properties": {
        "communication_knowledge_base_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "type": "string"
        },
        "crm_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "dynamic_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "hook_id": {
          "example": "hook_123",
          "type": "string"
        },
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "memory": {
          "properties": {
            "read_scope": {
              "enum": [
                "self",
                "webhook",
                "all"
              ],
              "example": "self",
              "type": "string"
            },
            "write_scope": {
              "enum": [
                "self",
                "shared"
              ],
              "example": "self",
              "type": "string"
            }
          },
          "type": "object"
        },
        "model": {
          "type": "string"
        },
        "model_source": {
          "type": "string"
        },
        "policies": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reasoning_effort": {
          "type": "string"
        },
        "runtime_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "sandbox_mode": {
          "type": "string"
        },
        "secret_bindings": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "secrets": {
          "items": {
            "properties": {
              "name": {
                "example": "CRM_TOKEN",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "selected_skills": {
          "items": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "skill_id": {
                "example": "usr_123",
                "type": "string"
              },
              "source": {
                "example": "user",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
PUT/api/public/v1/webhooks/{hook_id}Update a public Task Agent Webhookapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID
request*bodyapi.TaskAgentWebhookRequestDocWebhook request
Request schema
{
  "properties": {
    "communication_knowledge_base_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "crm_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "description": {
      "type": "string"
    },
    "dynamic_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "hook_id": {
      "example": "hook_123",
      "type": "string"
    },
    "http_request": {
      "additionalProperties": {},
      "type": "object"
    },
    "knowledge_base_list": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "memory": {
      "properties": {
        "read_scope": {
          "enum": [
            "self",
            "webhook",
            "all"
          ],
          "example": "self",
          "type": "string"
        },
        "write_scope": {
          "enum": [
            "self",
            "shared"
          ],
          "example": "self",
          "type": "string"
        }
      },
      "type": "object"
    },
    "model": {
      "example": "hast/auto",
      "type": "string"
    },
    "model_source": {
      "type": "string"
    },
    "policies": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "reasoning_effort": {
      "example": "medium",
      "type": "string"
    },
    "runtime_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "sandbox_mode": {
      "example": "read_only",
      "type": "string"
    },
    "secret_bindings": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "secrets": {
      "items": {
        "properties": {
          "name": {
            "example": "CRM_TOKEN",
            "type": "string"
          },
          "value": {
            "example": "write-only",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "selected_skills": {
      "items": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "skill_id": {
            "example": "usr_123",
            "type": "string"
          },
          "source": {
            "example": "user",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "system_prompt": {
      "type": "string"
    },
    "title": {
      "example": "Support Agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "hook": {
      "properties": {
        "communication_knowledge_base_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "type": "string"
        },
        "crm_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "dynamic_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "hook_id": {
          "example": "hook_123",
          "type": "string"
        },
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "memory": {
          "properties": {
            "read_scope": {
              "enum": [
                "self",
                "webhook",
                "all"
              ],
              "example": "self",
              "type": "string"
            },
            "write_scope": {
              "enum": [
                "self",
                "shared"
              ],
              "example": "self",
              "type": "string"
            }
          },
          "type": "object"
        },
        "model": {
          "type": "string"
        },
        "model_source": {
          "type": "string"
        },
        "policies": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reasoning_effort": {
          "type": "string"
        },
        "runtime_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "sandbox_mode": {
          "type": "string"
        },
        "secret_bindings": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "secrets": {
          "items": {
            "properties": {
              "name": {
                "example": "CRM_TOKEN",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "selected_skills": {
          "items": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "skill_id": {
                "example": "usr_123",
                "type": "string"
              },
              "source": {
                "example": "user",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/webhooks/{hook_id}Update a public Task Agent Webhookapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID
request*bodyapi.TaskAgentWebhookRequestDocWebhook request
Request schema
{
  "properties": {
    "communication_knowledge_base_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "crm_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "description": {
      "type": "string"
    },
    "dynamic_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "hook_id": {
      "example": "hook_123",
      "type": "string"
    },
    "http_request": {
      "additionalProperties": {},
      "type": "object"
    },
    "knowledge_base_list": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "memory": {
      "properties": {
        "read_scope": {
          "enum": [
            "self",
            "webhook",
            "all"
          ],
          "example": "self",
          "type": "string"
        },
        "write_scope": {
          "enum": [
            "self",
            "shared"
          ],
          "example": "self",
          "type": "string"
        }
      },
      "type": "object"
    },
    "model": {
      "example": "hast/auto",
      "type": "string"
    },
    "model_source": {
      "type": "string"
    },
    "policies": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "reasoning_effort": {
      "example": "medium",
      "type": "string"
    },
    "runtime_tools": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "sandbox_mode": {
      "example": "read_only",
      "type": "string"
    },
    "secret_bindings": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    },
    "secrets": {
      "items": {
        "properties": {
          "name": {
            "example": "CRM_TOKEN",
            "type": "string"
          },
          "value": {
            "example": "write-only",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "selected_skills": {
      "items": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "skill_id": {
            "example": "usr_123",
            "type": "string"
          },
          "source": {
            "example": "user",
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "array"
    },
    "status": {
      "example": "active",
      "type": "string"
    },
    "system_prompt": {
      "type": "string"
    },
    "title": {
      "example": "Support Agent",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "hook": {
      "properties": {
        "communication_knowledge_base_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "type": "string"
        },
        "crm_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "dynamic_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "hook_id": {
          "example": "hook_123",
          "type": "string"
        },
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "memory": {
          "properties": {
            "read_scope": {
              "enum": [
                "self",
                "webhook",
                "all"
              ],
              "example": "self",
              "type": "string"
            },
            "write_scope": {
              "enum": [
                "self",
                "shared"
              ],
              "example": "self",
              "type": "string"
            }
          },
          "type": "object"
        },
        "model": {
          "type": "string"
        },
        "model_source": {
          "type": "string"
        },
        "policies": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reasoning_effort": {
          "type": "string"
        },
        "runtime_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "sandbox_mode": {
          "type": "string"
        },
        "secret_bindings": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "secrets": {
          "items": {
            "properties": {
              "name": {
                "example": "CRM_TOKEN",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "selected_skills": {
          "items": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "skill_id": {
                "example": "usr_123",
                "type": "string"
              },
              "source": {
                "example": "user",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
DELETE/api/public/v1/webhooks/{hook_id}Delete a public Task Agent Webhookapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID

Responses

204

No Content

GET/api/public/v1/webhooks/{hook_id}/channelsRead Webhook channels and final reply configurationapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID
PUT/api/public/v1/webhooks/{hook_id}/channelsReplace Webhook channels and final reply configurationapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID
body*bodyapi.taskAgentHookChannelConfigRequestBindings and final reply policy
Request schema
{
  "properties": {
    "connection_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "memory_project_ids": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "reply_to_origin": {
      "type": "boolean"
    }
  },
  "type": "object"
}
POST/api/public/v1/webhooks/{hook_id}/invokeRun or continue a saved AIP Agentapplication/json

action=created starts a session; prompted continues or stops it. Poll the session events endpoint for completion. A 202 response means accepted, not completed.

Parameters

ParameterLocationTypeDescription
hook_id*pathstringOwned Agent Hook ID
request*bodyapi.PublicWebhookInvocationDocAgent invocation
Request schema
{
  "properties": {
    "action": {
      "enum": [
        "created",
        "prompted"
      ],
      "type": "string"
    },
    "payload": {
      "properties": {
        "after_event_id": {
          "type": "integer"
        },
        "context": {},
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "metadata": {
          "additionalProperties": {},
          "type": "object"
        },
        "model_config": {
          "additionalProperties": {},
          "type": "object"
        },
        "prompt": {
          "type": "string"
        },
        "request_id": {
          "type": "string"
        },
        "session_id": {
          "type": "string"
        },
        "signal": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        }
      },
      "type": "object"
    }
  },
  "required": [
    "action",
    "payload"
  ],
  "type": "object"
}

Responses

202

Accepted

Response schema
{
  "properties": {
    "after_event_id": {
      "type": "integer"
    },
    "event_url": {
      "type": "string"
    },
    "request_id": {
      "type": "string"
    },
    "run_id": {
      "type": "string"
    },
    "session_id": {
      "type": "string"
    }
  },
  "type": "object"
}
PATCH/api/public/v1/webhooks/{hook_id}/memoryUpdate only the owned webhook's Memory settingsapplication/json

Parameters

ParameterLocationTypeDescription
hook_id*pathstringWebhook ID
request*bodyapi.TaskAgentWebhookMemoryConfigDocMemory settings; shared writes require webhook or all reads
Request schema
{
  "properties": {
    "read_scope": {
      "enum": [
        "self",
        "webhook",
        "all"
      ],
      "example": "self",
      "type": "string"
    },
    "write_scope": {
      "enum": [
        "self",
        "shared"
      ],
      "example": "self",
      "type": "string"
    }
  },
  "type": "object"
}

Responses

200

OK

Response schema
{
  "properties": {
    "hook": {
      "properties": {
        "communication_knowledge_base_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "created_at": {
          "type": "string"
        },
        "crm_ids": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "description": {
          "type": "string"
        },
        "dynamic_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "hook_id": {
          "example": "hook_123",
          "type": "string"
        },
        "knowledge_base_list": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "memory": {
          "properties": {
            "read_scope": {
              "enum": [
                "self",
                "webhook",
                "all"
              ],
              "example": "self",
              "type": "string"
            },
            "write_scope": {
              "enum": [
                "self",
                "shared"
              ],
              "example": "self",
              "type": "string"
            }
          },
          "type": "object"
        },
        "model": {
          "type": "string"
        },
        "model_source": {
          "type": "string"
        },
        "policies": {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "reasoning_effort": {
          "type": "string"
        },
        "runtime_tools": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "sandbox_mode": {
          "type": "string"
        },
        "secret_bindings": {
          "items": {
            "additionalProperties": {},
            "type": "object"
          },
          "type": "array"
        },
        "secrets": {
          "items": {
            "properties": {
              "name": {
                "example": "CRM_TOKEN",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "selected_skills": {
          "items": {
            "properties": {
              "enabled": {
                "type": "boolean"
              },
              "skill_id": {
                "example": "usr_123",
                "type": "string"
              },
              "source": {
                "example": "user",
                "type": "string"
              }
            },
            "type": "object"
          },
          "type": "array"
        },
        "status": {
          "type": "string"
        },
        "system_prompt": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "string"
        },
        "url": {
          "type": "string"
        }
      },
      "type": "object"
    },
    "policy_options": {
      "items": {
        "additionalProperties": {},
        "type": "object"
      },
      "type": "array"
    }
  },
  "type": "object"
}
400

Bad Request

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
404

Not Found

Response schema
{
  "properties": {
    "code": {
      "description": "Code is the business status code (0 = success; see pkg/utils/errors.go).",
      "example": 0,
      "type": "integer"
    },
    "message": {
      "description": "Message is a human-readable status or error description.",
      "example": "ok",
      "type": "string"
    }
  },
  "type": "object"
}
GET/api/public/v1/webhooks/{hook_id}/sessions/{session_id}/eventsRead an AIP Agent session's eventsapplication/json

Poll with the returned next_after cursor until run.completed, run.failed or run.interrupted. Match the requested request_id. Reads remain scoped to the key's Profile and selected Agent.

Parameters

ParameterLocationTypeDescription
hook_id*pathstringOwned Agent Hook ID
session_id*pathstringSession ID returned by invoke
afterqueryintegerLast consumed event sequence
limitqueryintegerPage size (max 200)

Responses

200

OK

Response schema
{
  "properties": {
    "events": {
      "items": {
        "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",
        "x-hast-event-variants": {
          "context.compacted": {
            "$ref": "#/definitions/context.compacted"
          },
          "error": {
            "$ref": "#/definitions/error"
          },
          "file.changed": {
            "$ref": "#/definitions/file.changed"
          },
          "input.requested": {
            "$ref": "#/definitions/input.requested"
          },
          "message.completed": {
            "$ref": "#/definitions/message.completed"
          },
          "message.delta": {
            "$ref": "#/definitions/message.delta"
          },
          "message.started": {
            "$ref": "#/definitions/message.started"
          },
          "plan.completed": {
            "$ref": "#/definitions/plan.completed"
          },
          "plan.updated": {
            "$ref": "#/definitions/plan.updated"
          },
          "reasoning.completed": {
            "$ref": "#/definitions/reasoning.completed"
          },
          "reasoning.delta": {
            "$ref": "#/definitions/reasoning.delta"
          },
          "reasoning.started": {
            "$ref": "#/definitions/reasoning.started"
          },
          "run.completed": {
            "$ref": "#/definitions/run.completed"
          },
          "run.failed": {
            "$ref": "#/definitions/run.failed"
          },
          "run.interrupted": {
            "$ref": "#/definitions/run.interrupted"
          },
          "run.queued": {
            "$ref": "#/definitions/run.queued"
          },
          "run.retrying": {
            "$ref": "#/definitions/run.retrying"
          },
          "run.started": {
            "$ref": "#/definitions/run.started"
          },
          "runtime.status": {
            "$ref": "#/definitions/runtime.status"
          },
          "tool.completed": {
            "$ref": "#/definitions/tool.completed"
          },
          "tool.started": {
            "$ref": "#/definitions/tool.started"
          },
          "tool.updated": {
            "$ref": "#/definitions/tool.updated"
          },
          "usage.updated": {
            "$ref": "#/definitions/usage.updated"
          },
          "warning": {
            "$ref": "#/definitions/warning"
          }
        }
      },
      "type": "array"
    },
    "has_more": {
      "example": true,
      "type": "boolean"
    },
    "next_after": {
      "example": 42,
      "format": "int64",
      "type": "integer",
      "x-nullable": true
    }
  },
  "type": "object"
}