Skip to main content

Building an AI Ticket Classifier with Inngest — Event-driven, Reliable, and Surprisingly Simple

Sometimes, all you want is a backend that just works — no complex queue management, no retry logic nightmares, and no accidental Kafka cluster chaos.

Published 4 min readMarkdown

What is Inngest?

Think of Inngest as a service that helps you run background jobs and event-driven workflows without managing infrastructure.

If you’ve ever tried to handle background tasks in Node or Python — things like “send email after signup” or “retrain model after 1000 new tickets” — you probably did one of the following:

  1. Pushed messages into Kafka or RabbitMQ

  2. Set up cron jobs that ran every few minutes

  3. Hoped your code wouldn’t crash midway

Inngest basically says: let’s make this easier.

  • You write small functions (called Inngest Functions)

  • Each function is triggered by an event — like “ticket.created” or “user.reportedBug”

  • Inngest automatically handles retries, concurrency, fan-out, and durable execution

That means you don’t need to build your own Kafka consumers, schedulers, or retry systems.

Why I Chose Inngest

I was building an AI Ticket Classifier — a system that classifies customer support tickets into categories (billing, technical issue, feedback, etc.) using a fine-tuned model.

Initially, I used a queue-based setup:

  • A REST API pushed new tickets into a Kafka topic

  • A background worker consumed and processed them

  • If something failed, I’d manually check logs and retry

It worked… until it didn’t.
One broken worker could hold up the entire pipeline. I needed observability, automatic retries, and easier scaling.

That’s where Inngest fit perfectly:

  • It’s event-driven (each ticket event triggers processing)

  • It’s resilient (auto-retries, failure handling built-in)

  • It’s visible (dashboard for event logs, retries, metrics)

Basically, I got all the benefits of Kafka + a job orchestrator, but without the devops headache.

System Design — Inngest vs Kafka

Let’s break this down clearly.

1. Architecture

FeatureInngestKafka
TypeFully-managed event orchestrationDistributed streaming platform
Message StorageManaged + durableYou maintain brokers and partitions
Consumer LogicSimple function triggersRequires consumers and offsets
RetriesBuilt-inYou implement them
ScalingAutomaticManual tuning required

Inngest acts like a serverless event system — your code responds to events, and Inngest guarantees delivery. Kafka, on the other hand, is more like a firehose — powerful, but you have to build everything around it.

2. Flow Example: Ticket Classification

Kafka approach:

  1. API → Push message to Kafka

  2. Worker service consumes topic

  3. Worker calls AI model

  4. Worker updates DB

  5. If step 3 fails, manual retry

Inngest approach:

  1. API → inngest.send("ticket.created", data)

  2. Function onTicketCreated() automatically runs

  3. Inngest handles retry on failure

  4. Updates DB → done

No consumer management, no offset tracking, no retry queues.

It’s not meant to replace Kafka for high-throughput systems — but for event-driven apps like AI workflows, it’s ideal.

My AI Ticket Classifier — Overview

Goal

Automatically classify support tickets into categories and route them to the right team, using an event-driven pipeline built on Inngest + OpenAI + Supabase.

Flow

  1. Frontend/API receives a new ticket → sends event ticket.created to Inngest.

  2. Inngest Function listens for ticket.created:

    • Fetches the ticket details

    • Calls the AI model for classification

    • Writes category + confidence score to Supabase

  3. If model call fails → Inngest retries automatically.

  4. If classification is low-confidence → triggers another event ticket.needsReview.

Each step runs independently, meaning failures don’t crash the whole system.

Simple Architecture Diagram (text version)

User submits ticket
        ↓
API → inngest.send("ticket.created", ticket)
        ↓
Inngest Function → AI Model → Supabase
        ↓
Inngest retries if failed

Clean, composable, and no “where did my job go?” debugging.


🧠 Lessons Learned

  1. Event-driven design feels natural when you stop forcing everything into REST endpoints.

  2. Retries + observability save time when debugging ML workflows.

  3. Inngest is not a Kafka replacement — it’s a simpler abstraction when your goal is reliability, not raw throughput.

  4. AI + Events = Magic. The more event-driven your system, the easier it scales across real workflows.


🔮 Next Steps

I’m extending the system to handle auto-prioritization — tickets tagged as “urgent” by the classifier get escalated automatically.

Also experimenting with feedback loops, where agents can reclassify tickets, and those corrections feed back to the model training pipeline — all handled through Inngest events.


🧾 Closing Thought

You don’t need to orchestrate everything yourself.
Sometimes, letting a service like Inngest handle your events lets you focus on what matters — the intelligence inside your system, not the plumbing beneath it.

Github Repo- https://github.com/Gautam-2604/diadem_ticket

No comments yet. Be the first to comment.

More from this blog