{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://xn--82czbx2bczd4fl8a.online/agent-observability/traces-schema.json",
  "title": "Agent Trace (OTLP-compatible)",
  "type": "object",
  "required": [
    "traceId",
    "spanId",
    "name",
    "startTimeUnixNano",
    "endTimeUnixNano"
  ],
  "properties": {
    "traceId": {
      "type": "string",
      "pattern": "^[0-9a-f]{32}$"
    },
    "spanId": {
      "type": "string",
      "pattern": "^[0-9a-f]{16}$"
    },
    "parentSpanId": {
      "type": "string"
    },
    "name": {
      "type": "string",
      "description": "operation name e.g. agent.invoke / agent.dsr.create"
    },
    "kind": {
      "enum": [
        "INTERNAL",
        "SERVER",
        "CLIENT",
        "PRODUCER",
        "CONSUMER"
      ]
    },
    "startTimeUnixNano": {
      "type": "string"
    },
    "endTimeUnixNano": {
      "type": "string"
    },
    "attributes": {
      "type": "object",
      "properties": {
        "agent.id": {
          "type": "string"
        },
        "agent.capability": {
          "type": "string"
        },
        "agent.version": {
          "type": "string"
        },
        "http.status_code": {
          "type": "integer"
        },
        "rpc.system": {
          "const": "lovable-agent"
        }
      }
    },
    "status": {
      "type": "object",
      "properties": {
        "code": {
          "enum": [
            "OK",
            "ERROR",
            "UNSET"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    },
    "events": {
      "type": "array"
    }
  }
}