{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/amigo/main/json-schema/amigo-agent-run-detail-schema.json",
  "title": "AgentRunDetail",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/amigo-agent-runs-api-openapi.yml#/components/schemas/AgentRunDetail",
  "properties": {
    "run_id": {
      "type": "string",
      "format": "uuid",
      "title": "Run Id"
    },
    "status": {
      "type": "string",
      "enum": [
        "running",
        "succeeded",
        "failed",
        "timed_out"
      ],
      "title": "Status"
    },
    "framework": {
      "type": "string",
      "enum": [
        "claude-agent-sdk",
        "openai-agents"
      ],
      "title": "Framework"
    },
    "text": {
      "type": "string",
      "title": "Text",
      "description": "Final agent text. Empty while the run is still running or on failure.",
      "default": ""
    },
    "error": {
      "type": "string",
      "title": "Error",
      "description": "Failure detail for failed/timed_out runs. Empty otherwise.",
      "default": ""
    },
    "duration_ms": {
      "type": "number",
      "minimum": 0.0,
      "title": "Duration Ms",
      "default": 0.0
    },
    "usage": {
      "$ref": "#/$defs/Usage"
    },
    "trajectory": {
      "items": {
        "additionalProperties": true,
        "type": "object"
      },
      "type": "array",
      "title": "Trajectory",
      "description": "AgentEffect-shaped step dicts (kind, seq, content, tool_name, ...) — the adapter's normalize() over the framework's NATIVE output. Untyped passthrough in v1: the AgentEffect projection is a server-private shape still converging across frameworks; typing it here now would freeze a premature wire contract. A typed discriminated union lands in a follow-up.",
      "default": []
    }
  },
  "type": "object",
  "required": [
    "run_id",
    "status",
    "framework"
  ],
  "$defs": {
    "Usage": {
      "properties": {
        "input_tokens": {
          "type": "integer",
          "title": "Input Tokens",
          "default": 0
        },
        "output_tokens": {
          "type": "integer",
          "title": "Output Tokens",
          "default": 0
        },
        "cached_tokens": {
          "type": "integer",
          "title": "Cached Tokens",
          "description": "Cache-READ input tokens (billed at the provider's cache-hit rate).",
          "default": 0
        },
        "cache_creation_tokens": {
          "type": "integer",
          "title": "Cache Creation Tokens",
          "description": "Cache-WRITE input tokens (Anthropic cache_creation_input_tokens; 0 on providers without it).",
          "default": 0
        }
      },
      "type": "object",
      "title": "Usage"
    }
  }
}