Omkar Kulkarni / projects
Multi-agent systems · Insurance claims

Casefile

Multi-agent claims triage for a regional auto insurer. It's bounded, observable and replayable, and it can't pay a claim without a human.

LangGraphPostgresPydanticGemini Flash-LiteGroqLangfuseHypothesisFastAPI
adjuster deskawaiting your approval
The adjuster desk: node-by-node timeline with a reviewer send-back, budget meter and approval gate
100%

claims decided correctly on the final 45-claim development run (95.6% without the reviewer agent)

2 → 0

unsafe payment recommendations, without vs with the reviewer

3,000

random agent sequences in the termination property test. Every one reaches a terminal state

0

cost-ceiling overruns. The most expensive claim used 56% of the per-claim ceiling

The problem

Agents that pass work in a circle, with no stop condition

A regional auto insurer gets about 900 claims a day. Each needs its documents extracted, the policy and prior claims checked, the repair estimate sanity-checked, and a recommendation written. One prompt can't hold all of that. Four coordinated agents can.

The failure this project is built to avoid is agents handing work to each other with nothing to stop them. The demo works once and the bill arrives later. So everything that must be exact lives in code: routing, termination, money and the approval lock. The LLMs only read and judge.

Guarantees, each covered by tests

  • Bounded. A pure-function router checks budget, step, revision and no-progress guards on every hop
  • Cost-capped. A call that would cross the ceiling is never sent
  • Replayable. Every step is a Postgres checkpoint, and every LLM call is recorded
  • Human-approved. Nothing is paid without an adjuster's APPROVE
Architecture

A pure-code supervisor, four specialists, two locks on money

The supervisor is a Python function, not an LLM. Specialists exchange typed Pydantic objects. A reviewer send-back goes to exactly one specialist and invalidates only the work downstream of it.

Across every stepSupervisorpure-code routerguards first: budget,steps ≤ 14, revisions ≤ 2Extractor · LLMPDFs → typed claimInvestigatortools by code, judgment by LLMRecommendrationale by LLM, payout by codeReviewerrule checks, then LLMHuman gateLangGraph interrupt()adjuster approvesWrite-backPostgres trigger:no APPROVE, no rowEscalate to adjustera guard trippedBudget ledgercost checked before each callover $0.016 → never sentCheckpoints + tracesPostgres · Langfusereplay refuses on driftREVISE: typed issueACCEPTAPPROVE
Every arrow to and from the supervisor carries a typed Pydantic object. Two independent locks sit between a recommendation and a payout: the graph pauses at interrupt(), and a Postgres trigger rejects any decision row without an APPROVE for that exact recommendation.
Results

The reviewer agent earns its extra calls

Decisions, payouts and SIU flags are graded by code against computed truth. Cost is measured tokens × a pinned list price, so the ceiling holds on any paid endpoint.

Decision accuracy, with and without the reviewer

Same runs. The no-reviewer answer comes from each run's checkpoints.

Full graphWithout reviewer
Dev, final (45)Dev, final (45), Full graph: 100%100%Dev, final (45), Without reviewer: 95.6%95.6%Dev, first run (40)Dev, first run (40), Full graph: 95%95%Dev, first run (40), Without reviewer: 80%80%Held-out test (22)Held-out test (22), Full graph: 100%100%Held-out test (22), Without reviewer: 100%100%

Unsafe payment recommendations

Recommending payment on a claim that should be denied, referred or held.

Full graphWithout reviewer
Dev, final (45)Dev, final (45), Full graph: 00Dev, final (45), Without reviewer: 22Dev, first run (40)Dev, first run (40), Full graph: 00Dev, first run (40), Without reviewer: 11Held-out test (22)Held-out test (22), Full graph: 00Held-out test (22), Without reviewer: 00
Main finding

Both unsafe approvals were claims missing a required document.

Without the reviewer, the makers recommended paying two claims that should have asked for more information. The reviewer's deterministic checks caught both and sent them back. Every send-back still terminated.

The price: about 1.2 extra LLM calls and $0.0007 per claim on the final run.

Final dev run (45 claims)AccuracyMacro-F1Unsafe approvalsLLM callsCost / claim
Full graph100%1.00004.2$0.0055
Without reviewer95.6%0.94923.0$0.0048

Exact payout and SIU-flag recall were 100% in both. Cost ceiling $0.016 per claim; zero overruns.