arazzo: 1.0.1
info:
  title: Philadelphia Restoration Workflows
  version: 1.0.0
  summary: Multi-step tool workflows for water and fire damage restoration assessment in Philadelphia
  description: |
    Three workflow patterns for AI agents to follow when helping Philadelphia
    homeowners with water or fire damage. Each workflow chains tools in an
    optimized sequence with data flowing between steps.

sourceDescriptions:
  - name: phillyrestore
    url: ./openapi.yaml
    type: openapi

workflows:
  - workflowId: primary-damage-assessment
    summary: Complete damage assessment through professional callback
    description: |
      The full assessment path: classify damage, check insurance coverage,
      estimate costs, search expert knowledge, and connect with a professional.
      This is the primary revenue workflow.
    inputs:
      type: object
      required:
        - damage_type
      properties:
        damage_type:
          type: string
          description: Type of water or fire damage
        severity_indicators:
          type: object
          description: Optional severity indicators
        neighborhood:
          type: string
          description: Philadelphia neighborhood slug
        phone:
          type: string
          description: Homeowner phone number for callback
    steps:
      - stepId: assess
        operationId: assessDamage
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
            severity_indicators: $inputs.severity_indicators
            neighborhood: $inputs.neighborhood
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          damage_type: $response.body.result.damage_type.id
          severity: $response.body.result.severity

      - stepId: insurance
        operationId: checkInsuranceCoverage
        requestBody:
          contentType: application/json
          payload:
            damage_type: $steps.assess.outputs.damage_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          coverage_patterns: $response.body.result.coverage_patterns

      - stepId: costs
        operationId: estimateCost
        requestBody:
          contentType: application/json
          payload:
            damage_type: $steps.assess.outputs.damage_type
            severity: $steps.assess.outputs.severity
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          cost_range: $response.body.result.total_range

      - stepId: knowledge
        operationId: searchRestorationKnowledge
        requestBody:
          contentType: application/json
          payload:
            query: $steps.assess.outputs.damage_type
            limit: 5
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          relevant_excerpts: $response.body.result.chunks

      - stepId: callback
        operationId: requestCallback
        requestBody:
          contentType: application/json
          payload:
            phone: $inputs.phone
            damage_type: $steps.assess.outputs.damage_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          reference_number: $response.body.result.reference_number

  - workflowId: emergency-triage
    summary: Emergency triage — safety first, then assessment and callback
    description: |
      When a homeowner has an active emergency (water flowing, fire, gas leak).
      Prioritizes immediate safety actions, then classifies the damage and
      connects with a professional as quickly as possible.
    inputs:
      type: object
      required:
        - damage_type
      properties:
        damage_type:
          type: string
          description: Type of active emergency damage
        phone:
          type: string
          description: Homeowner phone number for callback
    steps:
      - stepId: emergency
        operationId: getEmergencySteps
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          immediate_actions: $response.body.result.immediate_actions

      - stepId: assess
        operationId: assessDamage
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          severity: $response.body.result.severity

      - stepId: callback
        operationId: requestCallback
        requestBody:
          contentType: application/json
          payload:
            phone: $inputs.phone
            damage_type: $inputs.damage_type
            notes: Emergency triage — immediate professional response needed
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          reference_number: $response.body.result.reference_number

  - workflowId: insurance-first
    summary: Insurance-focused flow — coverage analysis before detailed assessment
    description: |
      When a homeowner's primary concern is "Is this covered?" or "Should I file
      a claim?" Start with insurance coverage analysis, then get a detailed damage
      assessment and cost estimates for the claim.
    inputs:
      type: object
      required:
        - damage_type
      properties:
        damage_type:
          type: string
          description: Type of water or fire damage
        policy_type:
          type: string
          description: Insurance policy type (default HO-3)
    steps:
      - stepId: insurance
        operationId: checkInsuranceCoverage
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
            policy_type: $inputs.policy_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          coverage_patterns: $response.body.result.coverage_patterns

      - stepId: assess
        operationId: assessDamage
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          severity: $response.body.result.severity

      - stepId: costs
        operationId: estimateCost
        requestBody:
          contentType: application/json
          payload:
            damage_type: $inputs.damage_type
            severity: $steps.assess.outputs.severity
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          cost_range: $response.body.result.total_range
