Skip to main content

Design an Insurance Claims Agent

Premium

Srujay, a recent UW–Madison grad working as a forward deployed engineer at Strada, designs an AI system for an insurance carrier. The system takes in claims and their supporting documents, finds the relevant policy language, and decides whether to approve, deny, or escalate each claim. Dani, a software engineer at Snowflake (previously Amazon and Microsoft), runs the interview.

This is a junior-level interview, so watch how Srujay scopes the problem and explains the reasoning behind each choice. Not every edge case gets covered, and at this level it doesn't have to.

The interesting tension is cost versus explainability. A large model on every claim is expensive. A cheap model that can't defend a denial is a liability in insurance. Most of the design follows from balancing those two.

The question

Design a system for an insurance carrier that ingests claims and their supporting documents, retrieves the relevant policy and guideline documents, and outputs an approval decision. LLM inference is expensive, so keep the cost per claim under control.

Clarify the requirements

Srujay asks four questions before drawing anything, and each one changes the design:

  • Volume: About 2,000–3,000 claims a day, with bursts. That's small enough that throughput isn't the hard part.
  • Real-time or async: Async. Only the "we received your claim" confirmation needs to be fast, which opens the door to a queue-based pipeline.
  • Full automation or human review: The interviewer leaves this open, as long as the answer is justified. Srujay comes back to it at the end.
  • Policy versioning: Should a claim be judged against the policy version active on the incident date? Policies don't change often, but asking shows you're thinking about correctness.

Functional requirements: Accept a claim and its supporting documents. Extract and normalize the claim data. Retrieve the right policy and guideline context. Output approve, deny, or escalate, with a rationale that cites the policy language it relied on. Route ambiguous, high-value, or low-confidence claims to a human adjuster.

Non-functional requirements:

  • Consistency: The same claim and documents should produce the same decision.
  • Cost: Don't spend expensive inference where cheap logic will do.
  • Availability: Users can still submit claims when OCR or decisioning downstream is degraded. Processing can lag during bursts.
  • Explainability and auditability: Srujay keeps this separate from consistency, which is a good distinction. A repeatable output still needs to show which clauses were retrieved, which model version ran, and whether a human overrode it.

High-level architecture

Components
  1. Claims API. Validates the submission, saves the raw files, and returns right away.
  2. Claim queue. Absorbs bursts so intake never waits on processing.
  3. Normalization worker. Turns PDFs and forms into a canonical claim record.
  4. Claim store and document store. Structured fields in SQL, raw files in blob storage.
  5. Decision queue. Tells the orchestrator a claim is ready.
  6. Decision orchestrator. Moves each claim through triage, retrieval, decision, and the gate.
  7. Policy retrieval. Finds the few clauses that apply to this claim.
  8. Versioned policy index. Chunked policy and guideline documents, built by a separate pipeline.
  9. LLM decision. Returns a decision in a fixed schema, with citations.
  10. Confidence gate. Finalizes the decision or sends the claim to an adjuster.
Intake stays fast and separate from document processing. A decision orchestrator moves each claim through fixed stages, and only claims that need it reach an expensive model or a human.

Intake and normalization

The claims API does as little work as possible because a user is waiting on it. It validates, saves the raw submission, and puts the claim on a queue.

A separate worker turns PDFs and forms into a canonical claim record (claim ID, policy ID, incident date, and so on). Structured fields go in a SQL claim store, and raw documents go in blob storage. Srujay keeps this apart from intake because the workload is different: parsing documents is slow and bursty, and intake isn't.

Policy and guideline documents go through their own upstream pipeline. It chunks them into a versioned knowledge base with a vector index and metadata such as policy type and version. This pipeline isn't part of the claim flow at all.

Getting claims to the decision step

The interviewer pushes on how the orchestrator finds out a claim is ready, since updating a row doesn't notify anyone. Srujay gives two answers:

  • The normalization worker publishes the claim ID to a decision queue after writing the record.
  • The claim's state change and an event record are written together in one transaction (the outbox pattern), and a publisher forwards the event to the queue.

The first is simpler. The second guarantees you never update a claim without also emitting its event.

The decision orchestrator

Srujay calls this "the brain of the workflow, but not the place where everything happens." It moves each claim through fixed steps instead of making one big model call.

1. Triage with deterministic rules. The rules look at claim amount, claim type, whether the documents are complete, whether the claim clearly maps to one policy, and fraud or anomaly flags. A $300 windshield repair with a valid policy and complete photos should never hit an expensive model. A $50,000 water damage claim with an unclear cause shouldn't go to a cheap one.

2. Retrieval. Filter by the claim's policy ID and version first, then run semantic search within that policy. The model sees a short claim summary and the top 3–5 policy clauses, not 200 pages.

3. LLM decision. The model returns its decision in a fixed output schema, with citations to the clauses it used.

4. Confidence and policy gate. This step either finalizes the decision or sends the claim to a human adjuster.

For low-risk claims with complete inputs and clear evidence, the AI makes the call. For high-risk claims, the AI prepares the case and an adjuster decides. Human review still saves the adjuster most of the work, so escalation isn't wasted spend.

Where the interviewer pushed

The strongest follow-up is about retrieval. What if the claim needs clause 3.3 as well as 3.1.1, and retrieval only finds 3.1.1? Srujay explains why the model shouldn't get the whole guideline (cost, and more room to drift), but doesn't say how to catch a missed clause. That's the part of this design to think through before your own interview.

What a strong junior answer looks like

Srujay does what a junior candidate should: asks questions that change the design, names the main tradeoff early, splits the system into stages with different workloads, and keeps the model's inputs small and structured. To move this toward a mid-level answer, you could add:

  • Retrieval recall. Use cross-references between clauses, let the model request more clauses up to a cap, or escalate when the retrieved evidence doesn't cover the claim.
  • Defining "confidence." Say what actually triggers escalation: schema validation, missing citations, disagreement between two runs, or thresholds on claim amount.
  • Making determinism concrete. Pin model versions, set temperature to 0, and log the exact prompt and retrieved clauses so any decision can be replayed.
  • A rough cost per claim. Estimate what share of claims each tier handles and what each tier costs, so "keep cost under control" has a number behind it.
Design an AI-Powered Customer Support SystemMedium

Answer customer questions from company data and take actions on their accounts.

Design Claude Code

Design a coding agent that reads, edits, and tests code in a large repository.