Skip to content

AI Customer Support SaaSLive product

Aidfolk

Aidfolk is our own AI customer-support product, live at aidfolk.com since October 2026. A business adds its files, website and help pages and gets a chat agent for its site that cites the source of every answer. Its knowledge search runs in one Postgres query under row-level security, and every AI call is priced into an append-only ledger.

  • In production since October 2026
  • Every answer cites its source
  • 1,077 backend tests passing
Python 3.14FastAPIPostgreSQL 18 + pgvectorPydantic AITaskiq + RedisReact 19Next.js 16Cloudflare
Visit aidfolk.com

SaaS & customer support · Updated

The challenge

Every business wants a support agent that answers from its own content and nothing else. Doing that properly is a stack of hard problems: ingestion that copes with real documents, retrieval that finds the right paragraph, customers who can never see each other's data, AI costs metered before they eat the margin, and a widget nobody can lift onto their own site. The first version, DocuChat, answered questions well — but it wasn't yet something we'd trust with paying customers, so before launch we rebuilt it from the foundations as Aidfolk, starting with a security review.

What we built· built by our founder, Haseeb Attaullah

  • Knowledge from uploaded files, crawled websites, notes and APIs — parsed with Docling, split on headings, and content-hashed so unchanged pages are never re-embedded
  • Hybrid retrieval in a single Postgres query: pgvector similarity and full-text search fused with reciprocal rank fusion, follow-up questions rewritten into standalone queries, and citations down to the page
  • Tenant isolation in every query, with the knowledge index also under forced row-level security in the database — an app role that can't bypass it, and a test suite that runs as a role set up the same way
  • Every AI call priced into an append-only ledger the database refuses to edit; plans meter AI credits, and answers fail over between OpenAI, Anthropic and Gemini when a provider goes down
  • A plain-JavaScript chat widget (51 kB) that streams answers over SSE with signed, origin-bound tokens — it answers only on the websites listed for that agent
  • An email help desk, built and held behind a launch switch: AI triages each email and drafts a cited reply, a person approves it, and refunds or complaints always wait for a human
  • Run like a product, not a project: a security review with regression tests that fail on the old code, 1,077 backend tests, browser tests with accessibility checks on desktop and phone, and releases that deploy only after an explicit approval, with a backup taken first

How it fits together

  1. On customers' sites

    • Chat widget

      Plain JavaScript, 51 kB; streams answers over SSE with a signed, origin-bound token

  2. Aidfolk

    • Web app

      Next.js 16 and React 19: an agent set up in the browser, no code

    • API

      Python 3.14, FastAPI and Pydantic AI

    • Knowledge ingestion

      Files, websites, notes and APIs; parsed with Docling, content-hashed so unchanged pages aren't re-embedded

    • Task queue

      Taskiq + Redis

  3. Data

    • PostgreSQL 18 + pgvector

      Hybrid search in one query, under forced row-level security

    • Cost ledger

      Every AI call priced; the database refuses edits

  4. Models

    • OpenAI, Anthropic, Gemini

      Answers fail over between providers

Simplified, and drawn only from this case study: what it shows, not every moving part.

Which engineering decisions shaped it?

  1. Row-level security guards the knowledge index, on top of a tenant filter in every query

    Instead of
    Relying on application-level tenant filters alone
    Why
    A filter is one forgotten WHERE clause away from a leak. The policy is forced, and the app connects as a role that isn't a superuser, because a superuser skips row-level security; the tests run as that role too. Running as it found two code paths that had stepped outside the workspace's scope.
  2. Every AI call is priced into a ledger the database won't let anyone edit

    Instead of
    Reading spend off provider dashboards, or logging usage to an ordinary table
    Why
    Streamed answers, embeddings and query rewrites were dropping the usage their providers reported, and a fallback to the platform's key could cost money without a trace. Each call is now priced when it's made, a trigger refuses UPDATE, DELETE and TRUNCATE, and a model with no known price is charged a deliberately high rate and flagged.
  3. Hybrid search runs in one Postgres query

    Instead of
    Vector search alone, or a separate vector database with keyword search merged in application code
    Why
    Embeddings miss exact terms such as product codes and names; keywords miss paraphrases. The query fuses pgvector and full-text rankings with reciprocal rank fusion under the same tenant scope as everything else, and a deleted document stops answering before its chunks are even swept.
  4. The widget holds no secrets, and every chat needs a signed, origin-bound token

    Instead of
    An embed key in the snippet, or minified code to hide how it works
    Why
    Whatever a browser runs can be read, so prompts, retrieval, models, keys and plan rules stay on the server. Each session gets a short-lived token bound to the chatbot, the session and the page's origin, and both chat endpoints refuse a request without a matching one before doing any work.

Why it matters

This is what we point to when someone asks whether we can build their AI support agent. The hard parts — answers that cite their sources, each customer's data scoped to its own workspace, AI spend metered on every call — are already solved and running on our own infrastructure. Your project starts from there, not from an empty repository.

Our founder's part

Haseeb Attaullah: Founder and sole engineer — product, backend, web app, chat widget, billing, infrastructure and the release pipeline.

Building something like this?

Tell us what you're building. We reply within 0–4 hours with honest feedback on scope, timeline and whether we're the right fit.

contact

Have a product to ship or an AI feature to get right?

Tell us what you're building. Replies within 0–4 hours, with honest feedback on scope, timeline and whether we're the right fit.

Book a 30-min call