{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bamf-ai/json-schema/bamf-ai-run-node-event-schema.json",
  "title": "RunNodeEvent",
  "description": "One status transition for a run node (the run itself, a sub-agent, a tool call, a model call, a responder, or a router). The latest event per node_id is that node's current state.",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bamf-ai-openapi.json#/components/schemas/RunNodeEvent",
  "type": "object",
  "properties": {
    "schema_version": {
      "type": "string",
      "enum": [
        "bamf.agent-stream/v1"
      ]
    },
    "type": {
      "type": "string",
      "enum": [
        "run.node"
      ]
    },
    "turn_id": {
      "type": "string"
    },
    "sequence": {
      "type": "integer",
      "minimum": 0
    },
    "run_id": {
      "type": "string"
    },
    "node_id": {
      "type": "string"
    },
    "parent_node_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "node_kind": {
      "type": "string",
      "enum": [
        "run",
        "subagent",
        "tool",
        "model",
        "responder",
        "router"
      ]
    },
    "name": {
      "type": "string",
      "description": "User-facing name, e.g. \"Researcher\", \"Analytics\"."
    },
    "role": {
      "type": [
        "string",
        "null"
      ]
    },
    "task": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "type": "string",
      "enum": [
        "queued",
        "running",
        "waiting_approval",
        "succeeded",
        "failed",
        "cancelled",
        "skipped"
      ]
    },
    "partial": {
      "type": [
        "string",
        "null"
      ]
    },
    "cost": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "input_tokens": {
          "type": "integer",
          "minimum": 0
        },
        "output_tokens": {
          "type": "integer",
          "minimum": 0
        },
        "usd": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "timing": {
      "type": "object",
      "properties": {
        "started_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "ended_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        },
        "ttft_ms": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "route_decision_id": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}