Skip to main content
Verity uses Inngest for background jobs. Four functions handle long-running operations that exceed Vercel’s function timeout limits.

parse-examination

Event: exam/parse.requested Parses uploaded examination request letters into structured request items.
1

validate-upload

Check upload exists, mark as “processing”
2

extract-content

Download file from Supabase Storage (PDF, CSV, PNG, JPG)
3

parse-with-llm

Claude Sonnet via Vercel AI SDK with regulation-specific system prompt from REGULATION_CONFIG
4

record-total-items

Save count for UI progress polling
5

save-item-{i} (per item)

For each parsed item: generate embedding → search KB for FFIEC match → search for deficiency patterns → insert request item
6

mark-completed

Update upload status to “completed”
Each item is a separate Inngest step so Vercel’s 60-second function timeout is never exceeded. Steps use onConflictDoNothing for idempotency — at-least-once semantics means steps can retry after successful writes.

Rate limiting

Voyage AI free tier is 3 requests per minute. step.sleep("rate-limit-N", "22s") is inserted between per-item steps.
Adding a payment method to Voyage AI unlocks standard rate limits and the sleep can be removed — parsing 28 items would drop from ~10 minutes to under 2 minutes.

auto-match-evidence

Event: scoring/auto-match.requested Matches examination evidence against scoring criteria using two signals:
  1. Regulatory source alignment — if a request item and a criterion both reference the same FFIEC section or regulatory source
  2. Domain/category alignment — if a request item’s assigned category corresponds to the current domain
Evidence is automatically linked to matching criteria (opt-out model). Users can remove auto-linked entries that don’t belong. Accepts examinationIds array for batch matching across multiple examinations in a single run (backward compatible with single examinationId).

propagate-evidence

Event: evidence/uploaded Forward propagation — when evidence is uploaded to a request item, this function searches for semantically similar request items on other active obligations in the same org using pgvector cosine similarity (0.82 threshold). Creates up to 5 evidence links per upload with auto_applied status for human review. Event: obligation/parsed Backfill — when a new obligation is parsed, this function searches all existing evidence from other obligations for matches against the new items. Uses the same 0.82 cosine similarity threshold and creates auto_applied evidence links.

Configuration

Inngest functions live in backend/src/inngest/. The Inngest dev server runs alongside Next.js during development. Functions are triggered via events sent from API routes. The webhook endpoint is at /api/inngest/route.ts and must be listed in proxy.ts publicPaths to bypass auth.
// Triggering from an API route
import { inngest } from "@verity/backend/inngest"

await inngest.send({
  name: "exam/parse.requested",
  data: { uploadId, examinationId, orgId }
})