How the agent works
When a model is configured, a language model plans each step through OpenAI function calling and the tools do the work. Without a model, a deterministic fallback planner calls the same tools in a fixed order, and the screen says so. Policy rules always run as fixed code, so the same claim gives the same result. No planner can deny a claim.
Tools the agent can call
| Gather | read_claim_file Reads the bill, room, pre-auth and the documents attached. |
| Gather | extract_clinical_facts Extracts diagnosis, procedures, ICU days and symptoms from the discharge summary and reports: by the LLM when a model is configured, otherwise by a rule-based reader (the trace says which). |
| Check policy | check_policy Deterministic rules engine: room-rent cap and proportionate deduction, ICU cap, waiting periods, co-pay, non-payables, package billing, required documents. Every result cites a clause. |
| Link evidence | link_evidence Ties each bill line to the record that justifies it; lists what is missing. |
| Fix | map_charge_code / apply_code_mapping Maps a hospital code to the insurer package, chosen only from the insurer’s closed package list. |
| Fix | search_hospital_records Fetches a missing itemised pharmacy bill, ICU note or report from hospital systems. |
| Ask desk | propose_bill_change Any change to money pauses the run until the desk executive approves or rejects. |
| Check | check_duplicate_documents Compares report fingerprints with earlier claims to catch reused documents. |
| Tell desk | notify_desk Tells the desk what the patient will pay, and why, before discharge. |
| Flag | flag_for_review Escalates what cannot be fixed to the insurer’s adjudicator. Never a denial. |
| Submit | submit_claim Sends the packet; the insurer re-verifies everything and auto-approves clean claims (rule FL-1). |
Who decides what
| Action | Decides | Why |
|---|---|---|
| Read, extract, check, link, search records | Agent | Low risk, logged, reversible |
| Map a code from the insurer’s closed list | Agent | Amount unchanged; insurer re-checks |
| Remove or change a billed amount | Desk executive | Money changes need a human |
| Approve a clean claim up to the fast-lane limit | Insurer rules (FL-1) | Insurer owns the limits |
| Approve a flagged or larger claim | Insurer adjudicator | Human judgement on the evidence map |
| Deny a claim | Claims review committee only | IRDAI rule; the agent never denies |
Stack
- Next.js on Vercel; agent runs server-side and streams each step to the screen
- OpenAI model with function calling for planning when a key is configured; otherwise a deterministic fallback planner, labelled as such on every run
- Hospital records system and insurer are simulated; all data is synthetic
- Supabase (Postgres) stores every submitted packet and decision for the insurer inbox and audit trail
- Policy: Arogya Shield Plus, Sahyog General Insurance (fictional); 9 clauses as code
Policy clauses used
C3.1 Room rent limit. Room rent is payable up to 1% of the Sum Insured per day (Rs 5,000). If a higher room category is chosen, associated medical expenses are payable in the same proportion, except pharmacy, consumables, implants and diagnostics.
C3.2 ICU limit. ICU charges are payable up to 2% of the Sum Insured per day (Rs 10,000).
C4.1 Pre-existing disease waiting period. Pre-existing diseases are covered after 36 months of continuous coverage.
C4.2 Specific waiting period. Hernia, cataract, gallstones and joint replacement are covered after 24 months of continuous coverage.
C5.4 Co-payment. Insured persons aged 61 or above at admission bear 10% of every admissible claim.
C6.3 Non-payable items. Items in the IRDAI list of non-medical expenses (for example gloves, admission kits, toiletries, attendant charges) are not payable.
C7.1 Package billing. For network packages, the agreed package rate applies. Items included in the package (surgeon, OT, anaesthesia, routine surgical consumables, ward stay) may not be billed separately.
C8.2 Documents for cashless claims. Discharge summary, itemised final bill, itemised pharmacy bill, reports supporting every billed investigation, ICU notes for each ICU day, and the pre-authorisation approval.
FL-1 Fast-lane auto-approval (insurer rule). Claims up to Rs 75,000 with all checks passed, every bill line linked to evidence and no flags are approved automatically. Others go to an adjudicator.
Where the 64% comes from
A simulation, not a measurement from this demoWe simulated 20,000 cashless claims per scenario (Monte Carlo). The baseline is calibrated to IRDAI turnaround data (96.69% of discharges decided within 3 hours of a complete file, Lok Sabha reply, Dec 2025) and to Star Health's roughly 20% no-touch rate. With ClaimReady, 64% of claims are decided in under 10 minutes, against about 20% today.