GuidesAI automation

Tutorial: triaging support tickets with AI

By the Banzai Labs teamUpdated on 2 min read

Incoming ticketscategoryurgencylanguagesummaryBillingTechnicalUrgentEvery ticket tagged and routed as it arrives
Each ticket gets a category, urgency, language and summary, then goes to the right team.

1. The forced schema

const tool = {
  name: 'classify_ticket',
  description: 'Classifies a support ticket.',
  input_schema: {
    type: 'object',
    properties: {
      category: { type: 'string', enum: ['billing', 'delivery', 'technical', 'account', 'other'] },
      urgency: { type: 'string', enum: ['low', 'normal', 'high'] },
      language: { type: 'string', description: 'ISO 639-1 code, e.g. en' },
      summary: { type: 'string', description: 'one sentence' },
    },
    required: ['category', 'urgency', 'language', 'summary'],
  },
};

2. The call, when the ticket is created

const res = await client.messages.create({
  model: process.env.CLAUDE_MODEL!,
  max_tokens: 300,
  system: 'You triage support tickets. High urgency: customer blocked or payment failing.',
  tools: [tool],
  tool_choice: { type: 'tool', name: 'classify_ticket' },
  messages: [{ role: 'user', content: `${ticket.subject}\n\n${ticket.message}` }],
});
const triage = res.content.find((b) => b.type === 'tool_use')?.input;
await helpdesk.tag(ticket.id, triage);

3. Routing

Result Queue
High urgency Priority queue, immediate notification
Billing Accounting team
Technical Technical support
Foreign language An agent who speaks it

4. Measuring

  1. 1SampleTwo hundred tickets classified by hand.
  2. 2ComparisonAgreement rate by category and urgency.
  3. 3AdjustmentInstructions sharpened on frequent mistakes.

The basics: calling the Claude API from Node.js and tool use explained. The principle: what a webhook is.

Frequently asked questions

Which support tool?
Zendesk, Freshdesk, Crisp, HubSpot or an in-house tool: most send a webhook when a ticket is created and accept tags through their API.
What if it picks the wrong category?
The agent fixes it in one click. Those corrections become the test set for improving the instructions.
Can it answer directly?
That is a further step. Start with triage: it carries no risk for the customer and saves time right away.

Read next

All guides