Engineering Team

How the Tickets Copilot AI Pipeline Works

AI Architecture Engineering

At the heart of Tickets Copilot is a 3-stage AI pipeline that transforms raw support tickets into actionable, AI-generated draft responses. This post explains how each stage works and the design decisions that make it reliable, fast, and privacy-first.

Stage 1: Classification

When a ticket arrives — whether from Zoho Desk, IMAP email ingestion, or a webhook — the first thing our pipeline does is classify it. Using your chosen AI provider (any OpenAI-compatible API), we analyze the ticket content to determine:

  • Category: Is this a bug report, billing question, feature request, or general inquiry?
  • Priority: How urgent is this? Does it need immediate attention?
  • Sentiment: Is the customer frustrated, neutral, or satisfied?

Classification runs immediately upon ticket ingestion, triggered by a BullMQ job with deduplication to prevent double-processing. The results are stored as structured metadata on the ticket, making them available for routing, reporting, and the next pipeline stage.

Stage 2: Knowledge Retrieval

Once classified, the pipeline searches your knowledge base for relevant solutions. We use PostgreSQL's pgvector extension for semantic similarity search, comparing the ticket's embedding vector against your organization's stored knowledge entries.

The knowledge base grows organically as your team resolves tickets. Each resolved ticket becomes a searchable entry, building institutional knowledge that the AI can draw from. This means the system gets smarter the more you use it.

We generate embeddings using your configured AI provider, ensuring no data leaks to a third-party embedding service. The embeddings are stored in your own database, and only your organization's knowledge entries are searched — strict data isolation applies at every level.

Stage 3: Response Generation

With the ticket classified and relevant knowledge retrieved, the final stage generates a draft response. The AI receives:

  • The original ticket content (with PII redacted)
  • Classification metadata (category, priority, sentiment)
  • Top matching knowledge base entries
  • Your organization's configured tone and style preferences

The generated draft is saved to the ticket's draft response field. Your team reviews it, makes any necessary edits, and sends it through your existing channels. Every edit the team makes feeds back into the knowledge base, continuously improving response quality.

Idempotency and Reliability

Every stage runs as an idempotent BullMQ job with exponential backoff retry logic (up to 3 retries). Job deduplication keys are based on organization + ticket ID + pipeline stage, ensuring that the same ticket is never processed twice. If a stage fails, downstream stages wait for it to succeed before executing.

Privacy by Design

The pipeline is built from the ground up with privacy in mind. PII redaction runs before any data reaches an AI provider. You bring your own API keys, so your customer data goes directly to your own account. We never store, proxy, or train on your data. Each organization's knowledge base, embeddings, and AI configurations are completely isolated.

The result is a pipeline that's fast, reliable, and respects your customers' privacy — exactly what modern support teams need.