Nirnaya v1
← cookbooks
supportready today

Support ticket triage

Route, prioritise and decide whether a human is needed, in one call.

Every inbound conversation gets five decisions at once: what it is about, what to do next, how urgent it is, how likely the customer is to leave, and whether automation should keep going.

The state is the raw thread plus whatever account facts you already have. Do not summarise it first; the model reads the whole thing.

The questions

categorychoice

What is this customer conversation primarily about?

accountLogin, plan changes, profile or access management.
billingA charge, invoice, subscription or payment problem.
deliveryShipping, fulfilment or delivery of a physical item.
refundThe customer is explicitly asking for money back.
technicalThe product or service is not working as expected.
actionchoice

What should the assistant do next with this conversation?

answer_directlyThe assistant can resolve this itself with information it already has.
close_no_actionNo further action is warranted; the matter is settled.
escalate_to_humanHand off to a human agent with the appropriate authority.
execute_refundIssue the refund or credit the customer is owed.
request_informationMore detail is needed from the customer before anything can be done.
churn_riskscore

How likely is this customer to stop doing business with us because of this interaction?

0No sign of dissatisfaction.
1Mild frustration, but the relationship is intact.
2Clearly unhappy; repeat problems or explicit complaints.
3Imminent: threatening to cancel, dispute or leave.
needs_humannoul

This conversation requires a human agent rather than automated handling.

falseAutomation can carry this to resolution.
trueA human must take over: judgement, authority or empathy is required.
urgencyscore

How time-sensitive is this conversation?

0No time pressure; can wait indefinitely.
1Routine; handle within the normal queue.
2Elevated; should be handled within the same week.
3Critical; requires action within the same day.

Acting on the answers

  • needs_human true with confidence above 0.6: hand to a person, attach the five answers as context.
  • urgency level 3: page the on-call queue instead of the normal one.
  • churn_risk level 3: notify the account owner regardless of the action taken.

request

{
  "state": {
    "account": {
      "tier": "pro",
      "tenure_months": 31,
      "seats": 12,
      "prior_tickets_90d": 3,
      "lifetime_value_usd": 8400
    },
    "thread": [
      {
        "role": "customer",
        "text": "This is the third time this month our invoices have been generated with the wrong VAT rate. Finance is refusing to pay them and I am getting blamed. What is going on?"
      },
      {
        "role": "agent",
        "text": "I'm sorry about that. Could you confirm which invoices are affected?"
      },
      {
        "role": "customer",
        "text": "INV-2291, INV-2304 and INV-2318. I've sent these already last week. If this isn't fixed by Friday we're moving to another vendor."
      }
    ]
  },
  "questions": {
    "category": {
      "type": "choice",
      "instructions": "What is this customer conversation primarily about?",
      "criteria": {
        "account": "Login, plan changes, profile or access management.",
        "billing": "A charge, invoice, subscription or payment problem.",
        "delivery": "Shipping, fulfilment or delivery of a physical item.",
        "refund": "The customer is explicitly asking for money back.",
        "technical": "The product or service is not working as expected."
      }
    },
    "action": {
      "type": "choice",
      "instructions": "What should the assistant do next with this conversation?",
      "criteria": {
        "answer_directly": "The assistant can resolve this itself with information it already has.",
        "close_no_action": "No further action is warranted; the matter is settled.",
        "escalate_to_human": "Hand off to a human agent with the appropriate authority.",
        "execute_refund": "Issue the refund or credit the customer is owed.",
        "request_information": "More detail is needed from the customer before anything can be done."
      }
    },
    "churn_risk": {
      "type": "score",
      "instructions": "How likely is this customer to stop doing business with us because of this interaction?",
      "criteria": [
        "No sign of dissatisfaction.",
        "Mild frustration, but the relationship is intact.",
        "Clearly unhappy; repeat problems or explicit complaints.",
        "Imminent: threatening to cancel, dispute or leave."
      ]
    },
    "needs_human": {
      "type": "noul",
      "instructions": "This conversation requires a human agent rather than automated handling.",
      "criteria": {
        "false": "Automation can carry this to resolution.",
        "true": "A human must take over: judgement, authority or empathy is required."
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How time-sensitive is this conversation?",
      "criteria": [
        "No time pressure; can wait indefinitely.",
        "Routine; handle within the normal queue.",
        "Elevated; should be handled within the same week.",
        "Critical; requires action within the same day."
      ]
    }
  }
}

call it

import { loadEngine } from "nirnaya";     // the same call this site makes

const engine = await loadEngine();          // loads once, then cached by the browser
const answers = await engine.decide(
  "{\"account\":{\"tier\":\"pro\",\"tenure_months\":31,\"seats\":12,\"prior_tickets_90d\":3,\"lifetime_value_usd\":8400},\"thread\":[{\"role\":\"customer\",\"text\":\"This is the third time this month our invoices have been generated with the wrong VAT rate. Finance is refusing to pay them and I am getting blamed. What is going on?\"},{\"role\":\"agent\",\"text\":\"I'm sorry about that. Could you confirm which invoices are affected?\"},{\"role\":\"customer\",\"text\":\"INV-2291, INV-2304 and INV-2318. I've sent these already last week. If this isn't fixed by Friday we're moving to another vendor.\"}]}",
  {
    "category": {
      "type": "choice",
      "instructions": "What is this customer conversation primarily about?",
      "criteria": {
        "account": "Login, plan changes, profile or access management.",
        "billing": "A charge, invoice, subscription or payment problem.",
        "delivery": "Shipping, fulfilment or delivery of a physical item.",
        "refund": "The customer is explicitly asking for money back.",
        "technical": "The product or service is not working as expected."
      }
    },
    "action": {
      "type": "choice",
      "instructions": "What should the assistant do next with this conversation?",
      "criteria": {
        "answer_directly": "The assistant can resolve this itself with information it already has.",
        "close_no_action": "No further action is warranted; the matter is settled.",
        "escalate_to_human": "Hand off to a human agent with the appropriate authority.",
        "execute_refund": "Issue the refund or credit the customer is owed.",
        "request_information": "More detail is needed from the customer before anything can be done."
      }
    },
    "churn_risk": {
      "type": "score",
      "instructions": "How likely is this customer to stop doing business with us because of this interaction?",
      "criteria": [
        "No sign of dissatisfaction.",
        "Mild frustration, but the relationship is intact.",
        "Clearly unhappy; repeat problems or explicit complaints.",
        "Imminent: threatening to cancel, dispute or leave."
      ]
    },
    "needs_human": {
      "type": "noul",
      "instructions": "This conversation requires a human agent rather than automated handling.",
      "criteria": {
        "false": "Automation can carry this to resolution.",
        "true": "A human must take over: judgement, authority or empathy is required."
      }
    },
    "urgency": {
      "type": "score",
      "instructions": "How time-sensitive is this conversation?",
      "criteria": [
        "No time pressure; can wait indefinitely.",
        "Routine; handle within the normal queue.",
        "Elevated; should be handled within the same week.",
        "Critical; requires action within the same day."
      ]
    }
  }
);
for (const a of answers) console.log(a.qid, a.answer, a.p);

curl and Python target nirnaya_serve, the Jev-compatible server in the release; the browser snippet is exactly what this site does.