{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/subagent-task.v1.json",
  "title": "Agoragentic Subagent Task",
  "description": "Governed task envelope for one subagent unit of work. This schema is a planning/control artifact and does not authorize provider execution, spend, settlement, publication, x402 activation, trust mutation, or private ECF exposure.",
  "type": "object",
  "additionalProperties": true,
  "required": [
    "schema",
    "task_id",
    "parent_agent_id",
    "deployment_id",
    "workspace_id",
    "mode",
    "task",
    "budget_policy",
    "tool_policy",
    "approval_policy",
    "ecf_scope",
    "memory_scope",
    "receipt_policy",
    "marketplace_policy",
    "x402_policy",
    "public_boundary"
  ],
  "properties": {
    "schema": { "const": "agoragentic.subagent-task.v1" },
    "task_id": { "type": "string" },
    "parent_agent_id": { "type": ["string", "null"] },
    "agent_id": { "type": ["string", "null"] },
    "deployment_id": { "type": ["string", "null"] },
    "workspace_id": { "type": ["string", "null"] },
    "mode": {
      "type": "string",
      "enum": ["inline_agent", "fanout_agents", "agent_pool", "agent_team"]
    },
    "task": { "type": "string" },
    "task_class": { "type": ["string", "null"] },
    "budget_policy": { "type": "object" },
    "tool_policy": { "type": "object" },
    "approval_policy": { "type": "object" },
    "ecf_scope": { "type": "object" },
    "memory_scope": { "type": "object" },
    "receipt_policy": {
      "type": "object",
      "required": ["required"],
      "properties": {
        "required": { "type": "boolean" },
        "parent_receipt_id": { "type": ["string", "null"] }
      },
      "additionalProperties": true
    },
    "marketplace_policy": {
      "type": "object",
      "properties": {
        "can_buy": { "type": "boolean" },
        "can_sell": { "type": "boolean" }
      },
      "additionalProperties": true
    },
    "x402_policy": {
      "type": "object",
      "properties": {
        "enabled": { "type": "boolean" }
      },
      "additionalProperties": true
    },
    "public_boundary": {
      "type": "object",
      "required": [
        "spend_triggered",
        "settlement_triggered",
        "marketplace_publication_triggered",
        "x402_route_created",
        "provider_execution_triggered",
        "private_ecf_context_exposed",
        "trust_mutation_triggered"
      ],
      "properties": {
        "spend_triggered": { "const": false },
        "settlement_triggered": { "const": false },
        "marketplace_publication_triggered": { "const": false },
        "x402_route_created": { "const": false },
        "provider_execution_triggered": { "const": false },
        "private_ecf_context_exposed": { "const": false },
        "trust_mutation_triggered": { "const": false }
      }
    },
    "created_at": { "type": "string", "format": "date-time" }
  }
}
