
Intelligent Email Processing Pipeline
How Jett uses Trigger.dev and background workers to isolate heavy LLM classification tasks, semantic scoring, and auto-labeling from webhook response cycles.
In this video deep dive, we walk through how Jett uses an asynchronous background queue to analyze, label, and index incoming emails without slowing down the initial delivery webhook.
The Ingress Challenge
When a mail provider (like Gmail or Outlook) sends a push notification of a new message, Jett must acknowledge the payload in less than 500ms to prevent timeout errors and redeliveries. Invoking LLMs (which can take 1.5s to 4s) during this HTTP lifecycle is impossible.
Implementing the Isolation Queue
Jett uses a database-backed job queue for parsing and classification tasks.
- API Webhook Ingress: The webhook validates the token, writes the basic email record, inserts a job row into the classification queue, and immediately returns a
200 OK. - Trigger.dev worker: The background worker polls for pending tasks, checks out a leased row (using
SKIP LOCKEDto prevent concurrent execution), runs the text extraction, calls the LLM classifier, and persists the resulting AI labels.
This ensures that even during high-traffic sync bursts, the ingress pipeline remains completely responsive.