AI case study · RAG + tool-calling agent · Healthcare

A support agent that can actually check your appointment

Pamsy Assist answers questions for a healthcare platform’s patients, providers, clinic admins and pharmacy merchants. It knows the help docs, and it can look things up in the live system instead of just pointing people to a page.

Role
Backend Developer
Models
Gemini chat + embeddings
Timeline
July — August 2026

One agent, two kinds of answer

  1. Question + role“Is my lab order ready?” from a patient
  2. LangChain agentGemini decides: search the docs, call a tool, or both.
  3. Knowledge searchHelp docs → header-aware chunks → Gemini embeddings → Chroma
  4. 6 live toolsAppointments, reschedule, pharmacy stock, wallet, lab orders, tickets

The problem

Healthcare support questions are both “how do I…” and “what’s happening with mine?”. A plain FAQ bot can’t answer the second kind, and an AI in healthcare must never diagnose, prescribe or leak personal data.

Decisions worth explaining

Guardrails

Helpful, not a doctor

Medical disclaimer with no diagnosis or dosages, privacy rules aligned with NDPR, GDPR and HIPAA, and hand-off to a human for disputed transactions. Answers adapt to each of the four roles.

Fits a small server

512 MB is enough

The vector store loads only on the first knowledge question, so the API starts fast on a small host.

Tested without the API

Fake embeddings, real checks

RAG tests run against a fake embeddings class, so retrieval is verified without paying for model calls. Every request is validated with Pydantic.

Problems I hit, and how I solved them

  1. Problem

    Paying to re-read the docs

    Turning the help docs into embeddings costs an API call for every chunk, every time the server starts.

    Solution

    Embed once, keep it on disk

    The knowledge base is embedded once and saved to a local vector store. Restarts reuse it, so documents are only embedded again when they change.

  2. Problem

    Abuse and runaway bills

    A public chat endpoint can be spammed, and every request costs model tokens.

    Solution

    Limits at the door

    Chat is limited to 10 requests a minute per visitor. Messages are capped at 4,000 characters and history at 50 turns, so no single request can blow up the cost.

  3. Problem

    Not every question needs live data

    Hitting the platform’s backend for every message would be slow and wasteful.

    Solution

    Look up real data only when asked

    The agent answers “how do I…” questions from the docs, and calls one of its six live tools only for “what’s happening with mine?” questions, like an appointment or a wallet balance.

How it’s built

FastAPI · LangChain agent (LangGraph under the hood) · Gemini chat and embeddings · Chroma · typed tools calling the Laravel backend over httpx · slowapi rate limiting.

Have a project or a role in mind?