{
  "version": 1,
  "structures": [
    {
      "name": "ticket_triage_response",
      "description": "Classification of the incoming support ticket",
      "example": {
        "category": "technical",
        "priority": "high",
        "sentiment": "frustrated",
        "needs_human": true
      },
      "schema": {
        "type": "object",
        "properties": {
          "category": {
            "type": "string",
            "enum": [
              "billing",
              "technical",
              "account",
              "feature_request",
              "other"
            ]
          },
          "priority": {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high",
              "urgent"
            ]
          },
          "sentiment": {
            "type": "string"
          },
          "needs_human": {
            "type": "boolean"
          }
        },
        "required": [
          "category",
          "priority",
          "sentiment",
          "needs_human"
        ],
        "additionalProperties": false
      }
    },
    {
      "name": "ticket_reply_response",
      "description": "Drafted first reply and next steps for the customer",
      "example": {
        "reply": "Thanks for reaching out - I've started looking into this for you.",
        "next_steps": [
          "Try clearing your browser cache",
          "Confirm the error message you see"
        ],
        "needs_human": true
      },
      "schema": {
        "type": "object",
        "properties": {
          "reply": {
            "type": "string"
          },
          "next_steps": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "needs_human": {
            "type": "boolean"
          }
        },
        "required": [
          "reply",
          "next_steps",
          "needs_human"
        ],
        "additionalProperties": false
      }
    }
  ],
  "workflows": [
    {
      "name": "ticket_triage_workflow",
      "description": "Classifies the ticket and starts the reply pipeline",
      "provider": "xai",
      "model": "grok-4.5",
      "backups": [
        {
          "provider": "anthropic",
          "model": "claude-haiku-4-5-20251001"
        }
      ],
      "request_type": "chat",
      "system_instructions": "Classify the support ticket: choose a category, set a priority, note the customer sentiment, and flag whether a human agent must review before sending.",
      "structure": "ticket_triage_response",
      "customer_fields": [
        "ticket_id",
        "customer_message"
      ],
      "test_mode": false,
      "cache_window_seconds": 600,
      "backend_pipeline": {
        "enabled": true,
        "events": [
          {
            "name": "ticket_received"
          },
          {
            "name": "draft_reply",
            "target_workflow": "ticket_reply_workflow"
          },
          {
            "name": "reply_ready"
          }
        ]
      }
    },
    {
      "name": "ticket_reply_workflow",
      "description": "Drafts a first reply the support team can send",
      "provider": "anthropic",
      "model": "claude-haiku-4-5-20251001",
      "backups": [
        {
          "provider": "xai",
          "model": "grok-4.5"
        }
      ],
      "request_type": "chat",
      "system_instructions": "Write a friendly first reply for the support ticket. Include clear next steps the customer can take, and keep flagging tickets that need a human agent.",
      "structure": "ticket_reply_response",
      "customer_fields": [
        "ticket_id",
        "customer_message"
      ],
      "test_mode": false
    }
  ]
}
