{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://agoragentic.com/schema/financial-research-job.v1.json",
  "title": "Financial Research Job V1",
  "type": "object",
  "required": ["job_id", "deployment_id", "provider_id", "topic", "status"],
  "properties": {
    "job_id": { "type": "string", "minLength": 1 },
    "deployment_id": { "type": "string", "minLength": 1 },
    "provider_id": { "type": "string", "minLength": 1 },
    "provider_type": { "type": "string" },
    "execution_mode": { "type": "string" },
    "provider_management_mode": { "type": "string" },
    "provider_license_review_required": { "type": "boolean" },
    "license_review_required": { "type": "boolean" },
    "provider_bundle_code": { "const": false },
    "provider_code_vendored": { "const": false },
    "provider_partnership_claim": { "const": false },
    "topic": { "type": "string", "minLength": 1 },
    "instrument_scope": {
      "type": "string",
      "enum": ["equity", "options_signal_intelligence"]
    },
    "scope": {
      "type": "object",
      "properties": {
        "symbols": { "type": "array", "items": { "type": "string" } },
        "instrument_scope": {
          "type": "string",
          "enum": ["equity", "options_signal_intelligence"]
        },
        "time_horizon": { "type": "string" },
        "risk_constraints": { "type": "array", "items": { "type": "string" } },
        "research_question": { "type": "string" },
        "portfolio_snapshot_redacted": { "type": "object" }
      },
      "additionalProperties": true
    },
    "cost_budget_usdc": { "type": "number", "minimum": 0 },
    "status": {
      "type": "string",
      "enum": ["draft", "queued_control_plane", "queued", "running", "completed", "failed", "cancelled", "blocked"]
    },
    "artifact": { "$ref": "#/$defs/research_artifact" },
    "artifact_refs": {
      "type": "array",
      "items": { "$ref": "#/$defs/artifact_ref" }
    },
    "output_contract": {
      "type": "object",
      "properties": {
        "instrument_scope": {
          "type": "string",
          "enum": ["equity", "options_signal_intelligence"]
        },
        "options_signal_intelligence": { "type": "boolean" },
        "options_signal_metadata_allowed": { "type": "boolean" },
        "options_review_packet_allowed": { "type": "boolean" },
        "options_review_packet_executable": { "const": false },
        "options_review_packet_required_flags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "owner_approval_required",
              "compliance_review_required",
              "brokerage_options_approval_required",
              "mcp_schema_proof_required",
              "non_personalized"
            ]
          }
        },
        "options_review_packet_forced_false_flags": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "executable_directly",
              "can_execute_orders",
              "provider_dispatch_enabled",
              "options_execution_enabled",
              "option_order_schema_allowed"
            ]
          }
        },
        "options_review_packet_prohibited_fields": {
          "type": "array",
          "items": { "type": "string" }
        },
        "options_review_packet_route_can_execute": { "const": false },
        "options_review_packet_route_can_dispatch_provider": { "const": false },
        "options_execution_enabled": { "const": false },
        "option_order_schema_allowed": { "const": false },
        "personalized_advice_allowed": { "const": false },
        "candidate_actions_executable": { "const": false }
      },
      "additionalProperties": true
    },
    "candidate_actions": {
      "type": "array",
      "items": { "$ref": "#/$defs/candidate_action" }
    },
    "can_execute_orders": { "const": false },
    "can_execute_options_orders": { "const": false },
    "can_make_purchases": { "const": false },
    "options_execution_enabled": { "const": false },
    "option_order_schema_allowed": { "const": false },
    "provider_call_performed": { "const": false },
    "no_provider_call": { "type": "boolean" },
    "receipt_id": { "type": ["string", "null"] },
    "evidence_id": { "type": ["string", "null"] },
    "created_at": { "type": "string" },
    "updated_at": { "type": "string" }
  },
  "$defs": {
    "artifact_ref": {
      "type": "object",
      "properties": {
        "artifact_id": { "type": ["string", "null"] },
        "artifact_type": { "type": "string" },
        "artifact_ref": { "type": ["string", "null"] },
        "artifact_hash": { "type": ["string", "null"] },
        "raw_payload_excluded": { "const": true }
      },
      "additionalProperties": true
    },
    "candidate_action": {
      "type": "object",
      "required": ["action_type", "executable_directly"],
      "properties": {
        "action_type": { "type": "string" },
        "symbol": { "type": ["string", "null"] },
        "instrument_scope": {
          "type": ["string", "null"],
          "enum": ["equity", "options_signal_intelligence", null]
        },
        "summary": { "type": ["string", "null"] },
        "requires_review": { "const": true },
        "requires_owner_approval": { "const": true },
        "executable_directly": { "const": false },
        "provider_dispatch_enabled": { "const": false },
        "can_execute_orders": { "const": false },
        "options_execution_enabled": { "const": false },
        "option_order_schema_allowed": { "const": false }
      },
      "additionalProperties": true
    },
    "research_artifact": {
      "type": "object",
      "required": ["research_report", "citations", "non_advice_disclaimer"],
      "properties": {
        "research_report": { "type": "string" },
        "citations": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": ["title"],
            "properties": {
              "title": { "type": "string" },
              "url": { "type": "string" },
              "source_type": { "type": "string" }
            },
            "additionalProperties": true
          }
        },
        "risk_summary": { "type": "string" },
        "bull_case": { "type": "string" },
        "bear_case": { "type": "string" },
        "instrument_scope": {
          "type": "string",
          "enum": ["equity", "options_signal_intelligence"]
        },
        "options_signal_intelligence": {
          "oneOf": [
            { "$ref": "#/$defs/options_signal_intelligence" },
            {
              "type": "array",
              "items": { "$ref": "#/$defs/options_signal_intelligence" }
            }
          ]
        },
        "options_review_packet": {
          "oneOf": [
            { "$ref": "#/$defs/options_review_packet" },
            {
              "type": "array",
              "items": { "$ref": "#/$defs/options_review_packet" }
            }
          ]
        },
        "candidate_actions": {
          "type": "array",
          "items": {
            "allOf": [
              { "$ref": "#/$defs/candidate_action" },
              {
                "type": "object",
                "properties": {
                  "rationale": { "type": "string" },
                  "requires_approval": { "const": true }
                },
                "additionalProperties": true
              }
            ]
          }
        },
        "non_advice_disclaimer": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": true
    },
    "options_signal_intelligence": {
      "type": "object",
      "required": [
        "underlying_symbol",
        "strategy_family",
        "expiration_window",
        "strike_or_moneyness_band",
        "risk_summary",
        "executable_directly",
        "can_execute_orders",
        "options_execution_enabled"
      ],
      "properties": {
        "underlying_symbol": { "type": "string", "minLength": 1 },
        "strategy_family": { "type": "string", "minLength": 1 },
        "expiration_window": { "type": "string", "minLength": 1 },
        "strike_or_moneyness_band": { "type": "string", "minLength": 1 },
        "thesis_summary": { "type": "string" },
        "risk_summary": { "type": "string", "minLength": 1 },
        "executable_directly": { "const": false },
        "can_execute_orders": { "const": false },
        "options_execution_enabled": { "const": false },
        "option_order_schema_allowed": { "const": false },
        "non_personalized": { "const": true }
      },
      "not": {
        "anyOf": [
          { "required": ["contract_id"] },
          { "required": ["occ_symbol"] },
          { "required": ["option_symbol"] },
          { "required": ["order_ticket"] },
          { "required": ["order_schema"] },
          { "required": ["legs"] },
          { "required": ["side"] },
          { "required": ["quantity"] },
          { "required": ["order_type"] },
          { "required": ["time_in_force"] },
          { "required": ["limit_price"] },
          { "required": ["stop_price"] },
          { "required": ["strike_price"] },
          { "required": ["expiration_date"] },
          { "required": ["option_type"] }
        ]
      },
      "additionalProperties": true
    },
    "options_review_packet": {
      "type": "object",
      "required": [
        "underlying_symbol",
        "strategy_family",
        "review_scope",
        "expiration_window",
        "strike_or_moneyness_band",
        "max_loss_explanation",
        "assignment_risk_summary",
        "liquidity_risk_summary",
        "owner_approval_required",
        "compliance_review_required",
        "brokerage_options_approval_required",
        "mcp_schema_proof_required",
        "non_personalized",
        "executable_directly",
        "can_execute_orders",
        "options_execution_enabled"
      ],
      "properties": {
        "underlying_symbol": { "type": "string", "minLength": 1 },
        "strategy_family": { "type": "string", "minLength": 1 },
        "review_scope": { "type": "string", "minLength": 1 },
        "expiration_window": { "type": "string", "minLength": 1 },
        "strike_or_moneyness_band": { "type": "string", "minLength": 1 },
        "max_loss_explanation": { "type": "string", "minLength": 1 },
        "assignment_risk_summary": { "type": "string", "minLength": 1 },
        "liquidity_risk_summary": { "type": "string", "minLength": 1 },
        "owner_approval_required": { "const": true },
        "compliance_review_required": { "const": true },
        "brokerage_options_approval_required": { "const": true },
        "mcp_schema_proof_required": { "const": true },
        "non_personalized": { "const": true },
        "executable_directly": { "const": false },
        "can_execute_orders": { "const": false },
        "provider_dispatch_enabled": { "const": false },
        "options_execution_enabled": { "const": false },
        "option_order_schema_allowed": { "const": false }
      },
      "not": {
        "anyOf": [
          { "required": ["broker_order"] },
          { "required": ["broker_order_ticket"] },
          { "required": ["broker_payload"] },
          { "required": ["contract_id"] },
          { "required": ["contracts"] },
          { "required": ["execution_payload"] },
          { "required": ["legs"] },
          { "required": ["occ_symbol"] },
          { "required": ["option_contract_id"] },
          { "required": ["option_legs"] },
          { "required": ["option_order"] },
          { "required": ["option_symbol"] },
          { "required": ["options_order"] },
          { "required": ["order_payload"] },
          { "required": ["order_schema"] },
          { "required": ["order_ticket"] },
          { "required": ["expiration"] },
          { "required": ["expiration_date"] },
          { "required": ["limit_price"] },
          { "required": ["order_type"] },
          { "required": ["option_type"] },
          { "required": ["quantity"] },
          { "required": ["side"] },
          { "required": ["stop_price"] },
          { "required": ["strike_price"] },
          { "required": ["time_in_force"] }
        ]
      },
      "additionalProperties": true
    }
  },
  "additionalProperties": true
}
