← Back to Blog
Code·9 min read

Build an automated support ticket triage agent with Claude AI (TypeScript Guide)

ClaudeagentinyTypeScriptticketagent

Look, I'm going to be honest with you. I've seen a lot of small businesses drowning in support tickets. Someone submits a ticket at 2 AM about their production database being down, and it sits in the same queue as "How do I reset my password?" until Sarah from support checks her email at 9 AM. By then, you've lost a customer, or worse – they've already tweeted about how terrible your service is.

This isn't a Sarah problem. This is a systems problem. And it's exactly why I built an AI-powered support ticket triage system using my open-source agentiny framework and Claude AI.

The Real Cost of Manual Ticket Triage

Here's what manual ticket management actually costs your business:

Time is bleeding everywhere. Your support team spends 30-40% of their day just reading tickets and deciding where they should go. That's not solving problems – that's shuffling papers in 2025.

Critical issues get lost. When everything lands in one queue, urgent tickets about system outages sit next to feature requests. By the time someone realizes the severity, you're already dealing with angry customers and potential revenue loss.

Inconsistency drives everyone crazy. One support rep might classify a billing issue as "high priority" while another marks it as "normal." Your engineering team never knows what's actually urgent, so they stop trusting the priority labels entirely.

It doesn't scale. Hire more support staff? Great, now you have more people making inconsistent triage decisions. The problem compounds instead of solving itself.

Why Automated Ticket Triage Changes Everything for SMBs

I know that most small businesses can't afford enterprise helpdesk software with all the bells and whistles. The good news? You don't need it.

Here's what automated AI ticket triage gives you:

80-90% Faster Response Times

The moment a ticket enters your system, AI analyzes it and routes it to the right team. No waiting for business hours. No manual review needed. A production outage gets flagged as urgent and lands on your senior engineer's desk within seconds – not hours.

Consistent Classification Every Single Time

AI applies the same logic to every ticket. No more "it depends who's on shift" inconsistencies. Your engineering team learns to trust priority labels again because they're actually meaningful.

Real Cost Savings

The system costs roughly $0.01-0.05 per ticket to process with Claude Haiku. Compare that to paying a support person $25-40/hour to manually triage. Even a small business processing 1,000 tickets per month saves thousands annually while getting faster, more consistent results.

It Scales Instantly

Got a product launch coming up? Black Friday sale? Your AI triage system handles 10x the normal ticket volume without breaking a sweat or needing overtime approvals.

Real-World Use Cases That Actually Make Sense

SaaS Companies: Your enterprise customers expect immediate attention when something breaks. Automated triage ensures their tickets about SSO integration failures or database connection issues get routed to senior engineers immediately, while basic "how do I export data?" questions go to your support docs team.

E-commerce Businesses: During holiday sales, you're drowning in tickets. AI can instantly separate urgent payment failures (high priority → billing team) from shipping questions (normal priority → fulfillment) from feature requests (low priority → product backlog).

Professional Services: Client work has hard deadlines. When a client reports a bug that's blocking their launch, AI recognizes the urgency and escalates immediately. Meanwhile, general consulting questions get routed appropriately without manual intervention.

Development Agencies: Like my own business here in Sydney, you're juggling multiple client projects. Automated triage means client emergencies get flagged instantly, while routine maintenance requests get properly queued and assigned to the right team members.

How I Built This (And Why You Can Too)

Here's where I get into the technical stuff, but I promise to keep it practical. The entire system is built on my agentiny framework – a lightweight, zero-dependency TypeScript agent framework I created specifically for building reactive automation systems.

Why I Built Agentiny (And Why It Matters)

Most agent frameworks are bloated messes with dozens of dependencies and complex setup processes. I wanted something different: a tiny, focused library (less than 5KB gzipped) that does one thing exceptionally well – reactive trigger-condition-action workflows.

Think of it like this: you define when something should happen (trigger), what conditions must be true (validation), and what to do about it (actions). The framework handles all the monitoring, state management, and execution automatically.

No heavyweight dependencies. No complex configuration. Just clean, type-safe TypeScript that actually works.

The Architecture: Simpler Than You Think

The ticket triage system implements a state machine workflow with four distinct stages:

new → classified → routed → assigned

Each stage is handled by automatic triggers that fire when conditions change. Here's the beautiful part: you don't write any polling logic or event loops. The agentiny framework handles all of that.

Stage 1: AI Classification

When a ticket arrives with status="new", a trigger automatically fires that sends it to Claude Haiku (Anthropic's fast, cost-effective AI model). Claude analyzes the ticket content and returns a structured JSON response with:

  • Priority: urgent, high, normal, or low
  • Category: bug, feature, question, billing, or other
  • Reasoning: why it made that decision

The prompt I crafted tells Claude exactly how to think about priorities: "System down, data loss, security issue" = urgent. "Multiple users affected" = high. "Single user issue" = normal. This gives you consistent, intelligent classification every single time.

Stage 2: Automatic Routing

Once classified, the ticket automatically moves to status="classified", which triggers the routing action. This is dead simple – just a lookup table mapping categories to departments:

  • Bugs → Engineering
  • Features → Product
  • Questions → Support
  • Billing → Billing

No manual intervention. No routing rules to maintain. Just clean, predictable logic.

Stage 3: Smart Escalation

Here's where it gets clever. The system has separate triggers for different priority levels:

Urgent tickets get auto-assigned to senior support immediately. Production database down? It's on your best engineer's desk in seconds.

High-priority tickets trigger notifications to team leads so they can monitor progress without micromanaging the queue.

Normal and low-priority tickets just flow to the appropriate department queue without any special handling.

The Code: Actually Readable

One thing I'm proud of in this implementation is how clean the code is. The entire core logic fits in a single TypeScript file with about 400 lines of well-commented code.

Here's what an action looks like:

const classifyTicketAction = createAnthropicAction({
  model: "claude-haiku-4-5",
  apiKey: process.env.ANTHROPIC_API_KEY,
}, {
  prompt: (state) => {
    const ticket = state.tickets.find(t => t.status === "new");
    return Analyze this ticket and classify it...;
  },
  onResponse: (response, state) => {
    const ticket = state.tickets.find(t => t.status === "new");
    const classification = JSON.parse(response);
    ticket.priority = classification.priority;
    ticket.category = classification.category;
    ticket.status = "classified";
  }
});

See how straightforward that is? Find the unprocessed ticket, send it to Claude, parse the response, update the state. The framework handles everything else – error handling, state monitoring, trigger evaluation, and action execution.

Why This Approach Wins

Decoupled Components: Each action is independent. The classification action doesn't know about routing. Routing doesn't know about escalation. This makes testing and debugging trivial.

Type Safety: Full TypeScript support means you catch errors at compile time, not in production at 2 AM.

Extensible: Want to add a new workflow stage? Just add a new trigger. Want to route differently? Change the lookup table. Want to integrate with Slack for notifications? Add one action. The framework makes evolution easy.

Observable: Every state change is logged. You can see exactly what the system is doing at each stage, which makes debugging and optimization straightforward.

Making It Production-Ready

The example repository shows a demo with simulated tickets, but making it production-ready is surprisingly straightforward:

  1. Replace console.log with real notifications – Send urgent tickets to PagerDuty or Slack instead of just logging them.

  2. Connect to your ticket source – Whether it's email, a web form, or an API endpoint, just call createTicket() with the incoming data.

  3. Add persistence – Instead of keeping tickets in memory, write to your database after each state change.

  4. Monitor and optimize – Track Claude API token usage, classification accuracy, and team satisfaction with routing decisions.

The framework handles the hard parts (state management, reactive triggers, async operations, error handling). You just connect your specific business systems.

Why Small Teams Can Beat Enterprise Software

Here's what I love about this approach: a solo developer or small team can build and deploy this in a weekend. No $50,000 enterprise software license. No 6-month implementation project. No dedicated IT staff needed.

You get:

  • Intelligent AI classification from Claude
  • Automatic routing and escalation
  • Real-time notifications
  • Full customization for your business logic
  • Complete ownership and control

And it costs less than one support person's monthly salary to run.

The Bottom Line

Manual ticket triage is solved problem in 2025. You don't need a massive budget or a team of developers to automate it. You just need the right framework and about 400 lines of clean TypeScript.

The support ticket triage example I built shows exactly how to do it with the agentiny framework and Claude AI. The code is well-commented, the architecture is simple, and the results are immediate.

If you're a small or medium-sized business drowning in support tickets, or if you're a developer looking to build intelligent automation systems, I'd love to hear from you. I'm based in Sydney and work with businesses across Australia and globally to implement practical AI solutions that actually solve real problems.

Check out the code on GitHub, give the agentiny framework a try, or reach out to me if you want to discuss how automated ticket triage could work for your business.

Your support team will thank you. Your customers will thank you. And you'll actually be able to sleep at night knowing that urgent issues are being handled immediately – not sitting in a queue waiting for morning.

Thomas Wiegold

AI Solutions Developer & Full-Stack Engineer with 14+ years of experience building custom AI systems, chatbots, and modern web applications. Based in Sydney, Australia.

Ready to Transform Your Business?

Let's discuss how AI solutions and modern web development can help your business grow.

Get in Touch