An auditable, rules-first AI platform for insurance underwriting and claims.
Built for regulated environments where every decision needs to be explainable.
Many "AI for insurance" demos wrap a single LLM call. That is hard to defend in a regulated market where decisions must be explainable, reproducible, and auditable years after the fact. Aegis takes a different approach:
- A deterministic rule engine computes a risk or fraud score from structured inputs, producing an ordered list of factors with their weights.
- That structured assessment is passed to an LLM as grounded context. The model picks an outcome and summarises the rationale; it does not invent facts.
- Every decision (inputs, factors, model, confidence, rationale) is written
to an append-only audit log exposed at
GET /decisions.
The LLM is swappable, and the rule engine works on its own if no provider is configured.
┌──────────────────────────────────────────────────────────────────┐
│ FastAPI (app/) │
│ │
│ POST /policy /claim ◀── CRUD │
│ POST /decide/underwrite ◀── score + decide │
│ POST /decide/claim/{id} ◀── triage + fraud │
│ GET /decisions ◀── append-only audit log │
│ POST /chat ◀── SSE copilot │
└────────────────┬────────────────────────────────┬────────────────┘
│ │
▼ ▼
┌───────────────────┐ ┌───────────────────────┐
│ Rule engine │─grounded─▶│ LLM abstraction │
│ risk.py │ context │ OpenAI / Anthropic │
│ fraud.py │ │ Ollama / Heuristic │
└─────────┬─────────┘ └───────────┬───────────┘
│ │
└──────────────┬──────────────────┘
▼
┌─────────────────────┐
│ SQLModel · Decision│
│ append-only · JSON │
└─────────────────────┘
curl -X POST https://insurance.deciwa.com/api/decide/underwrite \
-H 'content-type: application/json' \
-d '{
"customer_name": "Alice",
"policy_type": "auto",
"start_date": "2024-01-01T00:00:00",
"end_date": "2025-01-01T00:00:00",
"age": 19,
"risk_profile": "high"
}'{
"decision": "REJECT",
"confidence": 0.72,
"risk_score": 77.0,
"suggested_premium": 124.1,
"reasoning": [
"Base rate for 'auto': 0.060",
"Policy type 'auto' classified as elevated risk (+10)",
"Young applicant (age 19) increases risk (+12)",
"Declared risk profile: HIGH (+20)"
],
"model": "gpt-4o-mini"
}Every field is traceable back to either the rule engine or the LLM response.
| Layer | Tech |
|---|---|
| Backend | Python 3.11 · FastAPI · SQLModel · SSE |
| LLM | OpenAI · Anthropic · Ollama · deterministic fallback |
| Frontend | Next.js 15 · React 18 · Tailwind · Radix · Framer Motion |
| Infra | Docker · GitHub Actions · Vercel · Render |
git clone https://github.com/aida-solat/Insurance-API-Marketplace.git
cd Insurance-API-Marketplace
# Backend (port 8005)
cd back
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/uvicorn app.main:app --reload --port 8005
# Frontend (port 3005)
cd ../front
npm install && npm run devOpen localhost:3005. No API key required: the
heuristic provider makes the full surface usable offline. Add an
OPENAI_API_KEY to back/.env to enable a real LLM.
back/ FastAPI service
app/
main.py app wiring · CORS · lifespan
config.py env-driven settings + LLM resolver
models.py Policy · Claim · Decision (SQLModel)
schemas.py request & response DTOs
routers/ policies · claims · decisions · chat
agents/ LLM abstraction · underwriter · claim_triage
rules/ deterministic risk & fraud engine
tests/ 11 tests · heuristic-backed · zero network
Dockerfile
front/ Next.js 15 dashboard + landing
app/
page.tsx marketing landing
app/ authenticated dashboard (underwrite · claims · decisions · chat)
components/ ui · sidebar · decision card · logo
lib/ api client · types · tiny swr-like hook
.github/workflows/ CI: pytest matrix · next build · docker buildx
render.yaml one-click backend deploy
cd back
PYTHONPATH=. .venv/bin/pytest -q
# 11 passed in 0.4sCI runs the suite on Python 3.10, 3.11, and 3.12, plus a production Next.js build and a Docker build for the backend.
| Target | How |
|---|---|
| Frontend · Vercel | Import repo, root = front, set NEXT_PUBLIC_API_URL |
| Backend · Render | Blueprint from render.yaml, set LLM + CORS secrets |
| Self-host | docker build back/ && docker run -p 8005:8005 … |
If this project is useful to you, consider sponsoring. It helps keep the project maintained and open-source.
MIT. See LICENSE.
Built with Deciwa.