L1Desk — AI L1-Support RAG

RAG multi-tenant SaaS hybrid retrieval pgvector cross-encoder reranking golden-set evaluation FastAPI Next.js Celery Stripe Tailscale

Goal

A production multi-tenant RAG app that answers customers' technical (L1) support questions strictly from tenant-uploaded documentation, with source citations and human handoff when confidence is low — so companies can offload routine support while enforcing the product policy that no answer is preferable to a wrong one.

The Problem

L1 technical support automatically provides answers to repetitive, documentation-driven queries, which is exactly what makes it a good fit for an LLM agent — and exactly what makes a naive implementation dangerous. The core difficulties:

  1. Confident wrongness. A support customer will act on an answer. A hallucinated, confident answer is worse than no answer at all, so abstention must be a first-class, machine-checkable behavior rather than a prompt tone.
  2. Exact tokens dominate. Support queries are full of error codes, product names, version strings, and function names — tokens where dense vector search is weak and keyword search is strong.
  3. Strict multi-tenant isolation. Every retrieval, citation, and deletion must be scoped per tenant; one tenant's data must never leak into another tenant's answers.

Methodology

L1Desk is an npm-workspaces monorepo of four decoupled services, deployed across two sites over a private Tailscale network. The interesting decisions are mostly at the seams.

1. Architecture and Deployment

2. Hybrid Retrieval in a Single Query

3. Escalation Gates — Avoid Hallucinations in Low-Confidence Answers

4. Evaluation as the Arbiter

5. Customer-Facing Layer

Results

Latency

The fused hybrid retrieval query runs in tens of milliseconds, and the retrieval-plus-rerank stage runs in a few hundred milliseconds at the median — roughly 10x faster than the initial prototype, which refit a TF-IDF vectorizer over the whole tenant corpus on every query (about 3 s per query on a large tenant). Total answer latency is dominated by LLM decode, which is why answers are enforced to be terse and streamed to the user.

Reliability

Abstention is measured, not assumed: no-answer probes are scored as a first-class metric, and their top-k scores are the calibration anchors for the pre-LLM gate. The gates together enforce the product contract — a question either gets a cited answer grounded in the tenant's own docs, or it gets a human.

Production Operations

L1Desk runs in production across web and ML server tiers over a private network, behind Cloudflare. CI runs unit and end-to-end browser tests on every push, and the two-site deployment means the lab never exposes a public inbound port.

Lessons

  • Vectors are derived data — chunk text in Postgres is the source of truth and the worst case is a re-embed. That is why a managed vector database was never stood up.
  • If you can't name the code path that writes a table, the table shouldn't exist. The app-database conversation models were deleted because no writer ever existed — the tables sat silently empty, a second source of truth that was always stale.