{
  "schema": "agentflows.config/1",
  "id": "support-ticket-triage",
  "version": "1",
  "title": "Support ticket triage",
  "short": "Categorize and prioritize incoming tickets, route them to the right team and draft a first reply for an agent to send.",
  "owner": "Customer support",
  "items": [
    "T-5101",
    "T-5102",
    "T-5103",
    "T-5104",
    "T-5105",
    "T-5106",
    "T-5107",
    "T-5108",
    "T-5109",
    "T-5110"
  ],
  "steps": [
    {
      "kind": "tool",
      "id": "mask",
      "title": "Mask card data",
      "tool": "mask_card_data"
    },
    {
      "kind": "tool",
      "id": "lookup_account",
      "title": "Look up the account",
      "tool": "lookup_account"
    },
    {
      "kind": "model",
      "id": "triage",
      "title": "Triage and draft a reply",
      "system": "You triage support tickets for Quillby, an appointment-scheduling app, and draft a first reply for a human support agent. You can't send anything, change any account or issue refunds. Follow the triage policy exactly. Answer with one JSON object and nothing else.",
      "user": "Triage policy:\n\"\"\"\n{{policy}}\n\"\"\"\n\nReply macros (pick the one that fits best):\n{{macros}}\n\nOpen incidents:\n{{incidents}}\n\nCustomer account:\n{{account}}\n\nTicket {{ticket_id}}, received {{received}}\nFrom: {{from}}\nSubject: {{subject}}\n\"\"\"\n{{body}}\n\"\"\"\n\nReturn JSON:\n{\"category\": one of {{categories}}, \"priority\": one of {{priorities}}, \"team\": one of {{teams}}, \"macro\": one of the macro ids, \"reply_draft\": \"a short reply in plain US English for the agent to edit\"}",
      "maxTokens": 16384,
      "optional": false
    },
    {
      "kind": "tool",
      "id": "guardrail",
      "title": "Force sensitive routes, screen the draft",
      "tool": "guardrail"
    },
    {
      "kind": "checkpoint",
      "id": "agent_review",
      "title": "Agent review",
      "checkpoint": "agent_review"
    }
  ],
  "tools": [
    {
      "name": "mask_card_data",
      "does": "Replaces card numbers and CVV codes in the ticket with a placeholder before the model sees it.",
      "access": "compute",
      "data": "Ticket text",
      "production": "Runs in your helpdesk integration before any text leaves it."
    },
    {
      "name": "lookup_account",
      "does": "Returns the customer's plan, seat count and SSO setting.",
      "access": "read",
      "data": "7 sample accounts",
      "production": "Read-only CRM field access: plan, seats, SSO. No contacts, no billing history."
    },
    {
      "name": "guardrail",
      "does": "Sends security, privacy, billing, cancellation and outage tickets to their required team; blocks drafts that promise refunds, ask for secrets or repeat a card number.",
      "access": "compute",
      "data": "The model's triage",
      "production": "Runs inside the workflow."
    },
    {
      "name": "queue_reply",
      "does": "After an agent approves, records the reply and the routing in a local list.",
      "access": "sandbox-write",
      "data": "In-memory list",
      "production": "Sets fields and saves a draft in the helpdesk. The agent clicks send."
    }
  ],
  "permissions": [
    {
      "resource": "Ticket text",
      "grant": "read (masked)",
      "why": "Card numbers and CVV codes are removed before the model call."
    },
    {
      "resource": "CRM account record",
      "grant": "read",
      "why": "Plan and seat count decide priority."
    },
    {
      "resource": "Billing system (refunds, credits)",
      "grant": "none",
      "why": "Refund decisions stay with billing; the draft may not promise one."
    },
    {
      "resource": "Helpdesk fields (category, priority, team)",
      "grant": "write after approval",
      "why": "Set when the agent accepts the triage."
    },
    {
      "resource": "Sending email to customers",
      "grant": "draft only",
      "why": "Every reply is sent by a person."
    }
  ],
  "checkpoints": [
    {
      "id": "agent_review",
      "reviewer": "Support agent on the ticket's team",
      "sees": [
        "The original ticket",
        "Category, priority and team",
        "Whether the guardrail changed the team",
        "The draft, or why it was blocked"
      ],
      "onApprove": "Ticket fields are set and the edited draft is sent by the agent.",
      "onReject": "The agent re-triages by hand; the draft is discarded."
    }
  ],
  "runner": {
    "temperature": 0.2
  },
  "fixtures": {
    "policy": "Quillby support triage policy (rev. 2026-11)\n\nCategories\n- how_to: a question about how to do something the product already does.\n- bug: something is broken for some users or one feature, with the rest working.\n- outage: a core function (log in, booking, calendar) is down for all users of the account.\n- billing: charges, invoices, payment methods.\n- cancellation: the customer asks to cancel or not renew.\n- privacy: a request to access, correct or delete personal data.\n- security: suspected account compromise, phishing that uses our name, or a vulnerability report.\n- feature_request: asks for something the product doesn't do.\n\nPriority\n- P1: any security ticket; an outage on an Enterprise account.\n- P2: an outage on a Starter or Team account; a bug that blocks a core function with no workaround; a customer affected by an open incident; a duplicate charge.\n- P3: other billing tickets, cancellations, privacy requests, bugs with a workaround.\n- P4: how-to questions and feature requests.\n\nTeam\n- security -> security; privacy -> privacy; cancellation -> retention; billing -> billing; outage -> engineering.\n- bug -> tier1 when it matches an open incident (use that incident's macro), otherwise engineering.\n- how_to and feature_request -> tier1.\n\nReplies\n- Every reply is a draft for a support agent to edit and send. You send nothing.\n- Never promise or confirm a refund, credit or exception; billing decides.\n- Never ask for a password, a one-time code or a full card number.\n- Card numbers in tickets are masked before you see them. Don't try to restore them.",
    "accounts": [
      {
        "id": "A-1187",
        "name": "Juniper Lane Hair Studio",
        "plan": "Starter",
        "seats": 2,
        "sso": false
      },
      {
        "id": "A-1552",
        "name": "Hollis Street Yoga",
        "plan": "Starter",
        "seats": 1,
        "sso": false
      },
      {
        "id": "A-2041",
        "name": "Maple Row Dental",
        "plan": "Team",
        "seats": 12,
        "sso": false
      },
      {
        "id": "A-2290",
        "name": "Bayside Learning Tutors",
        "plan": "Team",
        "seats": 6,
        "sso": false
      },
      {
        "id": "A-2675",
        "name": "Clearbrook Vet Clinic",
        "plan": "Team",
        "seats": 9,
        "sso": false
      },
      {
        "id": "A-3310",
        "name": "Northgate Physio Group",
        "plan": "Enterprise",
        "seats": 140,
        "sso": true
      },
      {
        "id": "A-3402",
        "name": "Riverbend Family Practice",
        "plan": "Enterprise",
        "seats": 85,
        "sso": true
      }
    ],
    "incidents": [
      {
        "id": "INC-311",
        "title": "SMS appointment reminders delayed for US phone numbers",
        "started": "2026-11-30 14:10 UTC",
        "status": "investigating",
        "affects": "All plans; email reminders are not affected"
      }
    ],
    "macros": [
      {
        "id": "M-PASSWORD-RESET",
        "use": "Password reset steps"
      },
      {
        "id": "M-HOWTO-SETTINGS",
        "use": "Where to find calendar, color and display settings"
      },
      {
        "id": "M-SMS-INCIDENT",
        "use": "Known issue INC-311: SMS reminders delayed; link to the status page"
      },
      {
        "id": "M-OUTAGE-ACK",
        "use": "Escalated to on-call engineering; we'll update every 30 minutes"
      },
      {
        "id": "M-REFUND-REVIEW",
        "use": "Billing is reviewing the charge; no promise of an outcome"
      },
      {
        "id": "M-CANCEL-ACK",
        "use": "Cancellation request received; what happens at the end of the term"
      },
      {
        "id": "M-PRIVACY-REQUEST",
        "use": "Privacy request received; how identity is verified; the clinic is the data controller"
      },
      {
        "id": "M-SECURITY-ACK",
        "use": "Security report received; steps to secure the account; we never ask for passwords"
      },
      {
        "id": "M-CARD-DATA-WARNING",
        "use": "Please don't send card numbers by email; how to update the card in Billing settings"
      },
      {
        "id": "M-FEATURE-REQUEST",
        "use": "Thanks for the suggestion; how feature requests are tracked"
      }
    ],
    "tickets": [
      {
        "id": "T-5101",
        "accountId": "A-2041",
        "from": "carla.front-desk@maplerow-dental.example.com",
        "subject": "Can't remember my password",
        "body": "Hi, I got a new phone over the weekend and now I can't remember my password for the front desk login. How do I reset it? Thanks, Carla",
        "received": "2026-12-01 08:02"
      },
      {
        "id": "T-5102",
        "accountId": "A-2290",
        "from": "office@bayside-tutors.example.com",
        "subject": "Reminders not going out",
        "body": "Since yesterday afternoon none of our students are getting text reminders. Email reminders still arrive. We had 3 no-shows this morning. Please fix this ASAP!!",
        "received": "2026-12-01 08:15"
      },
      {
        "id": "T-5103",
        "accountId": "A-3310",
        "from": "it-help@northgate-physio.example.com",
        "subject": "URGENT: nobody can log in",
        "body": "Since 7:40 am every one of our staff gets \"SSO error 502\" at login, at all 9 locations. Front desks are booking on paper. Is something down on your side?",
        "received": "2026-12-01 08:21"
      },
      {
        "id": "T-5104",
        "accountId": "A-2675",
        "from": "manager@clearbrook-vet.example.com",
        "subject": "Charged twice this month",
        "body": "Our card was charged $149.00 twice on Nov 28 for the Team plan. Please refund the extra charge.",
        "received": "2026-12-01 08:34"
      },
      {
        "id": "T-5105",
        "accountId": "A-1552",
        "from": "hello@hollis-yoga.example.com",
        "subject": "Cancel at end of term",
        "body": "Please cancel my subscription when the current term ends. The studio is closing in January. Thanks for everything.",
        "received": "2026-12-01 08:40"
      },
      {
        "id": "T-5106",
        "accountId": "A-3402",
        "from": "j.mercer.home@example.net",
        "subject": "Delete my information",
        "body": "I was a patient at Riverbend Family Practice and keep getting appointment texts from your system. I want all of my data deleted from your system under California law.",
        "received": "2026-12-01 08:52"
      },
      {
        "id": "T-5107",
        "accountId": "A-2041",
        "from": "owner@maplerow-dental.example.com",
        "subject": "Strange email and a login from overseas",
        "body": "I got an email from \"Quillby Support\" asking me to confirm my login at quillby-account-verify.example.net, and our audit log shows a sign-in from a country we've never been to at 3:12 am. Did someone get into our account?",
        "received": "2026-12-01 09:05"
      },
      {
        "id": "T-5108",
        "accountId": "A-1187",
        "from": "bookings@juniperlane-hair.example.com",
        "subject": "Idea: Google Calendar sync",
        "body": "Would love two-way sync with Google Calendar for recurring appointments. Right now I copy them over by hand every Monday.",
        "received": "2026-12-01 09:11"
      },
      {
        "id": "T-5109",
        "accountId": "A-2290",
        "from": "dev.accounts@bayside-tutors.example.com",
        "subject": "New card",
        "body": "Our old card expired. The new one is 4111 1111 1111 1111, exp 09/29, CVV 123. Please put it on file. Thanks, Dev",
        "received": "2026-12-01 09:26"
      },
      {
        "id": "T-5110",
        "accountId": "A-1187",
        "from": "bookings@juniperlane-hair.example.com",
        "subject": "WORST UPDATE EVER",
        "body": "You changed the calendar colors and now everything is gray!!! I can't tell my stylists apart. Where is the setting to change it back??? Fix this or I'm leaving.",
        "received": "2026-12-01 09:40"
      }
    ]
  },
  "files": [],
  "configHash": "60ed51d91b2869390d1620588b9a167406a858ceaf8edb2c71d567f5c8075a5a"
}
