{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://weverlabs.com/schemas/agent-run-contract.schema.json",
  "title": "Agent Run Contract",
  "description": "Scoped contract for a Wever Labs OS paid agent run before credits are debited and work enters the task ledger.",
  "type": "object",
  "required": [
    "object_type",
    "contract_id",
    "requested_tool",
    "requested_capability",
    "scope",
    "evidence_requirements",
    "expected_outputs",
    "metering_policy",
    "callback_policy",
    "status"
  ],
  "properties": {
    "object_type": {
      "const": "agent_run_contract"
    },
    "contract_id": {
      "type": "string"
    },
    "handshake_id": {
      "type": "string"
    },
    "preflight_id": {
      "type": "string"
    },
    "trust_profile_id": {
      "type": "string"
    },
    "quote_id": {
      "type": "string"
    },
    "credit_entitlement_id": {
      "type": "string"
    },
    "requested_tool": {
      "type": "string",
      "enum": [
        "packetops",
        "distributionops",
        "tokenops",
        "wever_labs_os"
      ]
    },
    "requested_capability": {
      "type": "string"
    },
    "scope": {
      "type": "string"
    },
    "out_of_scope": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "evidence_requirements": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "expected_outputs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metering_policy": {
      "type": "string",
      "enum": [
        "estimate_before_debit",
        "meter_delta_only",
        "fixed_credit_debit",
        "manual_review"
      ]
    },
    "callback_policy": {
      "type": "string",
      "enum": [
        "callback_required",
        "callback_optional",
        "status_polling_only"
      ]
    },
    "result_package_schema_url": {
      "type": "string",
      "format": "uri"
    },
    "receipt_schema_url": {
      "type": "string",
      "format": "uri"
    },
    "attestation_schema_url": {
      "type": "string",
      "format": "uri"
    },
    "exception_policy": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "ready_for_agent_acceptance",
        "accepted",
        "active",
        "completed",
        "cancelled"
      ]
    }
  },
  "additionalProperties": true
}
