{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agentbom.org/schema/agentbom-v1.schema.json",
  "title": "AgentBOM",
  "description": "Agent Bill of Materials (AgentBOM) v1 \u2014 a vendor-neutral, machine-readable declaration of what an AI agent is composed of: models, tools, skills, data access, permissions, and provenance.",
  "type": "object",
  "required": ["bomFormat", "specVersion", "metadata"],
  "additionalProperties": false,
  "patternProperties": {
    "^x-": {
      "description": "Vendor or organization extension field. Extensions MUST be namespaced with an 'x-' prefix and MUST NOT alter the meaning of standard fields."
    }
  },
  "properties": {
    "bomFormat": {
      "description": "Identifies the document as an AgentBOM. MUST be the literal string 'AgentBOM'.",
      "const": "AgentBOM"
    },
    "specVersion": {
      "description": "The AgentBOM specification version this document conforms to.",
      "const": "1.0"
    },
    "serialNumber": {
      "description": "A unique identifier for this specific AgentBOM document, expressed as an RFC 4122 URN UUID.",
      "type": "string",
      "pattern": "^urn:uuid:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    },
    "version": {
      "description": "The revision of this AgentBOM document for a given serialNumber. Starts at 1 and increments on each re-issue.",
      "type": "integer",
      "minimum": 1,
      "default": 1
    },
    "metadata": {
      "$ref": "#/$defs/metadata"
    },
    "models": {
      "description": "The models the agent uses, including primary, embedding, verifier, and guardrail models.",
      "type": "array",
      "items": { "$ref": "#/$defs/model" }
    },
    "tools": {
      "description": "Tools and connectors the agent can invoke, including MCP servers, A2A agents, and external APIs.",
      "type": "array",
      "items": { "$ref": "#/$defs/tool" }
    },
    "skills": {
      "description": "Reusable capabilities or skills installed into the agent.",
      "type": "array",
      "items": { "$ref": "#/$defs/skill" }
    },
    "dataAccess": {
      "description": "Data sources the agent reads from or writes to, with classification and residency.",
      "type": "array",
      "items": { "$ref": "#/$defs/dataAccess" }
    },
    "permissions": {
      "$ref": "#/$defs/permissions"
    },
    "provenance": {
      "$ref": "#/$defs/provenance"
    },
    "signatures": {
      "description": "Detached digital signatures over the canonical form of this document (excluding the signatures array itself).",
      "type": "array",
      "items": { "$ref": "#/$defs/signature" }
    }
  },
  "$defs": {
    "bomRef": {
      "description": "A document-local identifier used to reference this element from elsewhere in the AgentBOM.",
      "type": "string",
      "minLength": 1
    },
    "uri": {
      "type": "string",
      "format": "uri"
    },
    "digest": {
      "description": "A content digest expressed as 'algorithm:hexvalue', e.g. 'sha256:9b74c9...'.",
      "type": "string",
      "pattern": "^(sha256|sha384|sha512|sha3-256):[0-9a-fA-F]+$"
    },
    "region": {
      "description": "A deployment or data-residency region identifier (free-form, e.g. 'in-south-1', 'eu-west-1', 'on-prem').",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "required": ["agent"],
      "additionalProperties": false,
      "properties": {
        "timestamp": {
          "description": "When this AgentBOM document was generated (RFC 3339 / ISO 8601).",
          "type": "string",
          "format": "date-time"
        },
        "authors": {
          "description": "People or systems responsible for the contents of this AgentBOM.",
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": { "type": "string" },
              "email": { "type": "string", "format": "email" },
              "organization": { "type": "string" }
            }
          }
        },
        "producer": {
          "description": "The tool that produced this AgentBOM document.",
          "type": "object",
          "required": ["name"],
          "additionalProperties": false,
          "properties": {
            "name": { "type": "string" },
            "version": { "type": "string" },
            "url": { "$ref": "#/$defs/uri" }
          }
        },
        "agent": { "$ref": "#/$defs/agent" }
      }
    },
    "agent": {
      "description": "The subject of this AgentBOM: the agent being described.",
      "type": "object",
      "required": ["name", "version"],
      "additionalProperties": false,
      "properties": {
        "bomRef": { "$ref": "#/$defs/bomRef" },
        "name": {
          "description": "Human-readable name of the agent.",
          "type": "string",
          "minLength": 1
        },
        "version": {
          "description": "Version of the agent (semantic versioning recommended).",
          "type": "string",
          "minLength": 1
        },
        "description": { "type": "string" },
        "type": {
          "description": "The interaction pattern of the agent.",
          "type": "string",
          "enum": ["assistant", "copilot", "workflow", "autonomous", "multi-agent", "other"]
        },
        "autonomyLevel": {
          "description": "The degree of independent action the agent is permitted. 'suggest' = proposes only; 'act-with-approval' = acts after human sign-off; 'act' = acts within bounded scope; 'autonomous' = acts without per-action approval.",
          "type": "string",
          "enum": ["suggest", "act-with-approval", "act", "autonomous"]
        },
        "maintainer": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "name": { "type": "string" },
            "url": { "$ref": "#/$defs/uri" }
          }
        },
        "identifiers": {
          "description": "Stable external identifiers for the agent (e.g. a package URL or catalog URI).",
          "type": "array",
          "items": { "type": "string" }
        }
      }
    },
    "model": {
      "type": "object",
      "required": ["name", "provider"],
      "additionalProperties": false,
      "properties": {
        "bomRef": { "$ref": "#/$defs/bomRef" },
        "role": {
          "description": "How this model is used by the agent.",
          "type": "string",
          "enum": ["primary", "embedding", "verifier", "guardrail", "reranker", "vision", "speech", "other"]
        },
        "provider": {
          "description": "The model provider (e.g. 'openai', 'anthropic', 'sarvam', 'self-hosted').",
          "type": "string",
          "minLength": 1
        },
        "name": {
          "description": "Provider model identifier (e.g. 'claude-opus-4', 'qwen2.5-32b-awq').",
          "type": "string",
          "minLength": 1
        },
        "version": { "type": "string" },
        "hosting": {
          "description": "Where the model is hosted.",
          "type": "string",
          "enum": ["saas", "vpc", "self-hosted", "on-prem"]
        },
        "region": { "$ref": "#/$defs/region" },
        "endpoint": { "$ref": "#/$defs/uri" },
        "digest": {
          "description": "Digest of the model weights, where applicable (typically for self-hosted models).",
          "$ref": "#/$defs/digest"
        }
      }
    },
    "tool": {
      "type": "object",
      "required": ["name", "type"],
      "additionalProperties": false,
      "properties": {
        "bomRef": { "$ref": "#/$defs/bomRef" },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "type": {
          "description": "The kind of tool or connector.",
          "type": "string",
          "enum": ["mcp-server", "a2a-agent", "rest-api", "function", "plugin", "database", "other"]
        },
        "protocol": {
          "description": "The protocol used to communicate with the tool.",
          "type": "string",
          "enum": ["mcp", "a2a", "http", "grpc", "local", "other"]
        },
        "endpoint": { "$ref": "#/$defs/uri" },
        "scopes": {
          "description": "Permission scopes granted to the agent for this tool.",
          "type": "array",
          "items": { "type": "string" }
        },
        "authMode": {
          "description": "Authentication mode used to access the tool.",
          "type": "string",
          "enum": ["none", "api-key", "oauth", "mtls", "other"]
        }
      }
    },
    "skill": {
      "type": "object",
      "required": ["name"],
      "additionalProperties": false,
      "properties": {
        "bomRef": { "$ref": "#/$defs/bomRef" },
        "name": {
          "type": "string",
          "minLength": 1
        },
        "version": { "type": "string" },
        "source": {
          "description": "Where the skill was obtained (registry reference or URI).",
          "$ref": "#/$defs/uri"
        },
        "digest": { "$ref": "#/$defs/digest" }
      }
    },
    "dataAccess": {
      "type": "object",
      "required": ["name", "classification", "access"],
      "additionalProperties": false,
      "properties": {
        "bomRef": { "$ref": "#/$defs/bomRef" },
        "name": {
          "description": "Human-readable name of the data source.",
          "type": "string",
          "minLength": 1
        },
        "source": {
          "description": "Identifier or URI of the data source (e.g. 'crm-postgres', 's3://bucket/path').",
          "type": "string"
        },
        "classification": {
          "description": "Sensitivity classification of the data.",
          "type": "string",
          "enum": ["public", "internal", "confidential", "restricted", "pii", "phi", "pci"]
        },
        "access": {
          "description": "The level of access the agent has to this data source.",
          "type": "string",
          "enum": ["read", "write", "read-write"]
        },
        "retention": {
          "description": "Retention duration as an ISO 8601 duration (e.g. 'P30D') or 'none'.",
          "type": "string"
        },
        "residency": { "$ref": "#/$defs/region" }
      }
    },
    "permissions": {
      "description": "Coarse-grained operational permissions and guardrails for the agent.",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "networkEgress": {
          "description": "Whether the agent may make outbound network calls, and to which destinations.",
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "allowed": { "type": "boolean" },
            "allowlist": {
              "type": "array",
              "items": { "type": "string" }
            }
          }
        },
        "canExecuteCode": { "type": "boolean" },
        "canSpendFunds": { "type": "boolean" },
        "humanInLoop": {
          "description": "Whether a human approval step is required before consequential actions.",
          "type": "boolean"
        }
      }
    },
    "provenance": {
      "description": "How and from what sources this agent and its AgentBOM were produced (SLSA / in-toto aligned).",
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "buildType": {
          "description": "URI identifying the build process type.",
          "$ref": "#/$defs/uri"
        },
        "builder": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "id": { "type": "string" }
          }
        },
        "sourceRepo": { "$ref": "#/$defs/uri" },
        "commit": { "type": "string" },
        "producedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "signature": {
      "type": "object",
      "required": ["algorithm", "value"],
      "additionalProperties": false,
      "properties": {
        "algorithm": {
          "description": "Signature algorithm.",
          "type": "string",
          "enum": ["ed25519", "ecdsa-p256", "ecdsa-p384", "rsa-pss-sha256"]
        },
        "keyId": {
          "description": "Identifier of the signing key (e.g. a key fingerprint).",
          "type": "string"
        },
        "value": {
          "description": "Base64-encoded signature over the canonical document (excluding the signatures array).",
          "type": "string"
        },
        "certificate": {
          "description": "Base64-encoded certificate or certificate chain for the signing key, if applicable.",
          "type": "string"
        }
      }
    }
  }
}
