How jaiminrakeshshah/insurance-underwritting-agent works
A broker submits a medical-insurance application as prose; the pipeline screens it, structures it, supplements it with underwriting context, selects rules, estimates charge, and applies a deterministic gate before any conditional second-opinion route. LLM, scorer, and decision-model adapters are swappable. The graph preserves the documented stages and model providers; unsampled implementation details are represented only where the README or source index supports them.
Main entry points: pipeline.py Case orchestrator · registry.py Adapter registry · supplement.py Context supplement · call.py LLM call and metrics
Components 22
Case workflow
- Case orchestrator
underwriting/pipeline.py - PII screen
underwriting/stages/PII_Detector.py - Injection screen
underwriting/stages/Prompt_Injected.py - Application structuring
underwriting/stages/structure.py - Rule retrieval prompt
underwriting/stages/retrieval.py - Rule selection
underwriting/stages/rules.py - Charge scoring
underwriting/stages/risk.py - Risk explanation
underwriting/stages/explain.py - Route proposal
underwriting/stages/conclusion.py - Deterministic gate
underwriting/stages/gate.py - Second-opinion route
underwriting/stages/route.py - Case recommendation
underwriting/pipeline.py
Model stages
- LLM call and metrics
underwriting/blocks/call.py - Decision-model call
underwriting/adapters/decision/client.py
Model adapters
- Adapter registry
underwriting/adapters/registry.py - LLM providers
underwriting/adapters/llm - XGBoost scorer
underwriting/adapters/scorer/xgb.py - Jev, Laya, Kev
underwriting/adapters/decision
Underwriting context
- Context supplement
underwriting/blocks/supplement.py - Guidelines and rules
underwriting/data/guidelines.json - Claims history
underwriting/data/bureau.json
Other components
- Broker
Connections 25
- Broker → Case orchestrator: submits application
README.md - Case orchestrator → PII screen: runs screen
underwriting/pipeline.py - Case orchestrator → Injection screen: runs screen
underwriting/pipeline.py - Case orchestrator → Application structuring: structures text
underwriting/pipeline.py - Case orchestrator → Context supplement: adds context
underwriting/pipeline.py - Context supplement → Guidelines and rules: uses guidelines
README.md - Context supplement → Claims history: uses history
README.md - Case orchestrator → Rule retrieval prompt: writes retrieval prompt
underwriting/pipeline.py - Case orchestrator → Rule selection: selects clauses
underwriting/pipeline.py - Case orchestrator → Charge scoring: scores risk
underwriting/pipeline.py - Case orchestrator → Risk explanation: explains charge
underwriting/pipeline.py - Case orchestrator → Route proposal: proposes route
underwriting/pipeline.py - Case orchestrator → Deterministic gate: applies gate
underwriting/pipeline.py - Case orchestrator → Second-opinion route: requests conditional opinion
underwriting/pipeline.py - Case orchestrator → Case recommendation: returns case
underwriting/pipeline.py - Application structuring → LLM call and metrics: calls model
underwriting/stages/structure.py - Rule retrieval prompt → LLM call and metrics: calls model
underwriting/stages/retrieval.py - LLM call and metrics → LLM providers: completes prompt
underwriting/blocks/call.py - Rule selection → Decision-model call: asks rule opinion
underwriting/stages/rules.py - Second-opinion route → Decision-model call: asks route opinion
underwriting/stages/route.py - Decision-model call → Jev, Laya, Kev: posts request
underwriting/adapters/decision/client.py - Charge scoring → XGBoost scorer: scores intake
underwriting/stages/risk.py - Adapter registry → LLM providers: resolves provider
underwriting/adapters/registry.py - Adapter registry → XGBoost scorer: resolves provider
underwriting/adapters/registry.py - Adapter registry → Jev, Laya, Kev: resolves provider
underwriting/adapters/registry.py