{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://agoragentic.com/schema/parallel-work-graph.v1.json",
  "title": "Parallel Work Graph",
  "description": "Fan-out/fan-in graph contract for independent Agent OS proof branches. Graph declaration does not execute workers by itself.",
  "type": "object",
  "required": [
    "schema",
    "graph_id",
    "mode",
    "branches",
    "merge_strategy",
    "public_boundary"
  ],
  "properties": {
    "schema": {
      "const": "agoragentic.parallel-work-graph.v1"
    },
    "graph_id": {
      "type": "string"
    },
    "run_id": {
      "type": [
        "string",
        "null"
      ]
    },
    "mode": {
      "const": "fanout_agents"
    },
    "branches": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "branch_id",
          "agent_role",
          "task",
          "dependencies",
          "budget_cap",
          "timeout",
          "receipt_required",
          "status"
        ],
        "properties": {
          "branch_id": {
            "type": "string"
          },
          "agent_role": {
            "type": "string"
          },
          "task": {
            "type": "string"
          },
          "dependencies": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "budget_cap": {
            "type": [
              "number",
              "null"
            ]
          },
          "timeout": {
            "type": [
              "integer",
              "null"
            ]
          },
          "receipt_required": {
            "type": "boolean"
          },
          "status": {
            "enum": [
              "pending",
              "running",
              "waiting",
              "succeeded",
              "failed",
              "blocked"
            ]
          }
        },
        "additionalProperties": true
      }
    },
    "merge_strategy": {
      "enum": [
        "all_success_required",
        "best_effort_with_warnings",
        "owner_review_required",
        "arbiter_review_required"
      ]
    },
    "controls": {
      "type": "object",
      "properties": {
        "budget_policy_required": {
          "const": true
        },
        "receipt_policy_required": {
          "const": true
        },
        "owner_approval_required_for_public_or_paid": {
          "const": true
        },
        "agent_pool_enabled": {
          "const": false
        },
        "agent_team_enabled": {
          "const": false
        }
      },
      "additionalProperties": true
    },
    "public_boundary": {
      "type": "object",
      "properties": {
        "runtime_executed": {
          "const": false
        },
        "subagents_spawned": {
          "const": false
        },
        "provider_execution_triggered": {
          "const": false
        },
        "settlement_triggered": {
          "const": false
        },
        "marketplace_publication_triggered": {
          "const": false
        },
        "x402_route_created": {
          "const": false
        },
        "trust_mutation_triggered": {
          "const": false
        },
        "private_ecf_context_exposed": {
          "const": false
        }
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
