AI-powered health insurance underwriting for the Rwandan market
# UnderwriteAI
AI-assisted health insurance underwriting for the Rwandan market. A multi-agent
LangGraph pipeline parses medical PDFs, scores risk against an underwriting
manual, drafts a verdict with cited rules, and runs an adversarial fairness
critic — then hands off to a human underwriter who can approve, modify, or
re-evaluate before an email goes out.
## The problem
Underwriting health insurance for a typical Rwandan applicant is a
document-heavy, judgment-heavy job: read the medical PDFs, weigh comorbidities
against age and BMI, look up the right rules in a binder of underwriting
guidelines, decide what to load on the premium, and draft a customer email
that's empathetic without leaking internal rule IDs. UnderwriteAI does the
mechanical 80% — parsing, scoring, rule retrieval, draft + critic, customer
email — and surfaces every step to a senior underwriter for the final call.
## Quick start
```bash
# 1. clone + env
git clone
github.com && cd underwrite-ai
cp apps/api/.env.example apps/api/.env # fill OPENROUTER_API_KEY + OPENAI_API_KEY
cp apps/web/.env.example apps/web/.env.local
# 2. install
cd apps/api && uv sync && cd ../..
cd apps/web && pnpm install && cd ../..
# 3. seed Chroma with the underwriting manual
make seed
# 4. start both services
make api # terminal 1 →
localhost
make web # terminal 2 →
localhost
```
Open
localhost, pick a seed applicant, and
watch the pipeline run.
## How it works
```mermaid
flowchart LR
Browser["Next.js dashboard"]
API["FastAPI (routes · orchestrator · SSE)"]
Graph["LangGraph pipeline (5 agents)"]
DB[("SQLite")]
Chroma[("Chroma")]
Email["Email provider"]
Browser -- "POST /applications · GET /events (SSE)" --> API
API -- "ainvoke · astream" --> Graph
Graph --> Chroma
API --> DB
API --> Email
```
Inside the graph:
```mermaid
flowchart LR
START((start)) --> doc_parser
doc_parser --> risk_assessor
doc_parser --> guidelines_rag
risk …