AI Insurance Agent

Overview

*Development is ongoing for this project.

This application is a multi-agent system built to assist users in navigating health insurance-related topics. It routes tasks and questions to specialized agents to ensure accurate, specific, and professional responses. The system follows a supervisor framework, where a central Supervisor Agent coordinates the workflow by assigning tasks to the appropriate specialized agents based on context.

System Configuration

  • Primary LLM: gpt-4o
  • Architecture: state-based graph
  • Search Tool: Tavily Search Tool
  • Memory Checkpointer: SQLiteCheckpointer (for development only)
  • Vector DB: Pinecone
  • Output Validation: Pydantic schemas & structured output parsing
  • The main purpose of this application is to help users make informed decisions when selecting a health insurance plan and to maximize the benefits of their current policy. It ensures that consumers understand the products they are considering, are aware of their rights, and receive clear, personalized guidance throughout the decision-making process.

    GitHub Repository: github.com/daniellee6925/Insurance_Agent

    Specialized Agents

    • Supervsior Agent: Orchestrates the workflow by routing tasks to the appropriate specialized agents.
    • Enhancer Agent: Rephrases vague or unclear questions.
    • Validator Agent: Checks the quality and correctness of Researcher agent responses.
    • Policy Expert (RAG) Agent: Retrieves insurance policy information using a retrieval-augmented approach.
    • Research Agent: Finds up-to-date data from reliable web sources.
    • Actuary Agent: Calculates actuarial values for health insurance plans.
    • Consultant Agent: Recommends the best insurance plan based on user preferences and risk profile.
    • Underwriting Agent: Assesses user risk by asking key health-related questions.
    • Verifier Agent: Ensures risk assesment from the Underwriting Agent is reasonable.

    Framework Diagram

    framework diagram

    Agent input and outputs

    AgentRoleInputOutputTools
    SupervisorRoutes queriesUser queryAgent routeRouter logic (LLM-based)
    EnhancerRephrases ambiguous questionsUser queryClarified queryPrompt template + LLM
    Policy Expert (RAG) AgentProvides policy infoClarified queryRetrieved infoVectorDB + RAG chain
    Research AgentFetches real-time infoSearch QueryLatest info with citationWeb search (Tavily)
    ValidatorReflects and improves responsesResearch Agent outputRefined output/agent routeSelf-reflection prompt
    Actuary AgentComputes actuarial valuePlan detailsActuarial valuePython formula
    Consultant AgentRecommends plansUser preferencesSuggested planRanking + prompt
    Underwriting AgentAssesses riskUser profileRisk scoreLLM-based
    Verifier AgentSelf-reflects risk assesmentRisk score and reasonRisk score/agent routeSelf-reflection prompt

    Supervsior Agent Framework

    The Supervisor Agent acts as the central coordinator. It routes user questions to the most appropriate specialized agent based on the context and content of the query. This ensures efficient and accurate handling of insurance-related topics by leveraging the strengths of specialized agents.

    Example User Input: I want to understand which health plan fits my family.

    Supervisor Agent Output: Routing query to the Consultant Agent for personalized plan recommendations.

    supervisor diagram

    State-based Architecture

    This multi-agent system is designed around a state-based architecture, where a shared state object is passed between agents throughout the workflow. The state captures the evolving context of the user's interaction — including their inputs, intermediary results, decisions made by agents, and messages exchanged.

    Each agent reads from and writes to this state, enabling them to:

    • Access relevant background information or previous outputs
    • Perform their specialized task based on up-to-date context
    • Append their response or decision back into the workflow
    • Enable coordination across agents without redundancy

    Sample Flow Chart

    The following example demonstrates the system assisting the user select their preferred plan:

    flowchart diagram

    Policy Expert RAG Agent (Retrieval-Augmented Generation)

    The RAG Agent is responsible for providing accurate and detailed answers based on real-world health insurance policy documents. It retrieves relevant context from a custom-built vector database containing documents from major health insurers such as UnitedHealthcare, Blue Shield of California, and Kaiser Permanente.

    To ensure the quality and precision of its responses, the RAG Agent employs a self-reflection mechanism that:

    • Rephrases unclear or overly broad user queries to improve retrieval effectiveness
    • Grades the relevance of retrieved documents before forming a response
    • Filters out weak or unrelated context to ensure concise, accurate answers

    Sample Flow Chart

    rag diagram

    Example User Input: I want to understand my drug benefits for the following Kaiser health plan.

    RAG Agent Output: For Kaiser plan XYZ, the copay of the generic drugs is $25. This means that you will pay $25 out of pocket for each prescription of a covered generic drug, regardless of the actual cost of the medication, and the insurance will cover the rest...

    Underwriting Agent (+Verifier Agent)

    The Underwriting Agent evaluates the user's risk profile to assign an appropriate risk classification. This classification is used to determine coverage eligibility, premium pricing, and the most suitable health insurance options for the user.

    Risk Classifications

    • Low Risk – Excellent health, no chronic conditions, healthy lifestyle
    • Moderate Risk – Minor conditions (e.g., mild asthma) with good control, no major risk factors
    • High Risk – Serious conditions (e.g., diabetes, heart disease), or risky lifestyle behaviors
    • Major Risk – Conditions that are very costly (e.g., terminal illness or recent hospitalization)

    Factors Considered

    The following info regarding the user will be asked by the LLM and stored in the state for risk assesment.

    • Age
    • Gender
    • Height & Weight
    • Tobacco Use
    • Alcohol Consumption
    • Pre-existing Conditions
    • Current Medications
    • Occupation
    • Risky Activities (e.g., skydiving, scuba diving)
    • Recent Hospitalizations
    • Family Medical History

    Sample Flow Chart

    underwriter diagram

    After generating the risk classification, the output is passed to the Validator Agent, which verifies whether the classification and reasoning align logically with the provided health profile. If the validation passes, the system proceeds to the Consultant Agent for plan recommendation. If validation fails, the Underwriting Agent re-assesses the profile.

    Researcher Agent (+Validator Agent)

    The Researcher Agent is responsible for conducting live-search on the web regarding user queries. It uses the Tavily Search API to retrieve real-time, up-to-date information.

    Role and Functionality

    • Breaks down multi-part or vague questions into researchable tasks
    • Compiles findings into a concise, accurate, and readable explanation
    • Acts as a fallback when the initial agent response is insufficient

    Input and Output

    • Input: User’s question that requires up-to-date information
    • Output: Structured insight and citation derived from multiple sources

    Validation

    The output of the Researcher Agent is passed to the Validator Agent, which reviews the relevance, completeness, and clarity of the answer. If the Validator approves, the result is returned to the user. If not, the task may be reassigned or refined for better accuracy.

    Sample Flow Chart

    researcher diagram

    Acturay Agent

    The Actuary Agent is responsible for calculating the actuarial value of a health insurance plan. Actuarial value (AV) represents the percentage of total average costs for covered benefits that a plan will cover. This helps users compare the generosity of different insurance plans and understand the financial implications of their choices.

    What It Calculates

    • Estimated out-of-pocket costs based on plan details
    • Coverage percentage of medical expenses
    • Comparison across metal tiers (Bronze, Silver, Gold, Platinum)

    Input Parameters

    • Deductibles
    • Out-of-pocket maximums
    • Coinsurance rates
    • Copayment amounts
    • Service utilization assumptions

    The Actuary Agent uses a deterministic formula or simulation-based approach to derive the actuarial value. This value is presented to the user in an easy-to-understand format, aiding in financial planning and plan comparison. The agent ensures transparency in how much the insurance company pays versus how much the consumer is expected to pay.

    *The actuarial value calculator is currently undergoing updates.

    Consultant Agent

    The Consultant Agent specializes in helping users choose the most suitable health insurance plan based on their unique needs, preferences, and eligibility. It combines decision logic with prompt-driven reasoning to deliver tailored recommendations.

    Role and Functionality

    • Analyzes user-provided preferences such as budget, coverage needs, providers, and prescription requirements
    • Compares available plan options (e.g., HMO, PPO, EPO, HDHP) and ranks them by suitability
    • Generates a concise explanation of the recommended plan, including trade-offs and fit rationale
    • Guides users in understanding key policy components (deductibles, copays, out-of-pocket limits, etc.)
    • Ensures the recommendation aligns with any constraints identified by the underwriting or actuarial agents

    Input and Output

    • Input: User preferences (budget, provider network, expected care needs, location, etc.)
    • Output: Recommended insurance plan with explanation and rationale

    This Agent is currently being developed

    Deployment

    Insurance Agent is being developed as a full-stack application. It will use FastAPI for backend and a React/Next.js for frontend.

    • Backend: Powered by FastAPI, hosted on an AWS EC2 instance.
    • Frontend: Built with React and Next.js, deployed via Vercel

    @ 2025 Daniel Lee. All Rights Reserved.