Skip to content

aws-samples/sample-genai-underwriting-workbench-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

94 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿค– genai-underwriting-workbench-demo

A demonstration project showcasing the power of Amazon Bedrock and Claude Haiku 4.5 in transforming life and property & casualty underwriting workflows.

This solution leverages intelligent document processing to streamline the underwriting process by automatically extracting, analyzing, and making accessible critical information from insurance applications and related documents.

๐Ÿ‘‰ Interested in learning more about how to build this solution? Check out our workshop: Build an AI-Powered Underwriting Assistant with Amazon Bedrock

Table of Contents

๐Ÿ’ผ Business Purpose

This demo addresses a key challenge in life insurance underwriting: the time-consuming process of reviewing lengthy applications and related documentation. By combining Amazon Bedrock's capabilities with advanced AI models, the solution helps underwriters:

  • ๐Ÿš€ Reduce time spent on manual document review
  • ๐Ÿ“Š Automatically extract and organize relevant information from complex documents
  • ๐Ÿ” Surface key insights and potential risk factors
  • ๐Ÿ’ฌ Enable natural language interaction with document contents
  • โœ… Increase consistency in information extraction
  • ๐ŸŽฏ Allow underwriters to focus on decision-making rather than information gathering

โœจ Key Features

๐Ÿ“„ Data Extraction

  • Converts PDF documents into images and processes each page using AI vision capabilities
  • Automatically classifies each page into sub-document types (e.g., "Applicant Information", "Medical History", "Lab Results", "Prescription History")
  • Extracts all key-value pairs from each page in a structured format
  • Groups related pages together under their document type for easy navigation
  • Maintains context across pages to ensure consistent classification throughout the document

dashboard screenshot

๐Ÿ“Š Underwriter Analysis

  • AI-powered comprehensive document review that summarizes the application and its purpose
  • Identifies key risks with severity ratings (Low/Medium/High) and references to source pages
  • Detects discrepancies and inconsistencies across document sections
  • Generates medical timelines for life insurance or property assessments for P&C applications
  • Formulates recommendations (approve, decline, request more info) based on findings
  • Highlights missing information critical for underwriting decisions

underwriter analysis screenshot

๐Ÿ”ฌ Impairment Detection

  • Intelligent scanning of medical records, prescription history, lab results, and MIB reports
  • Automatically identifies health conditions relevant to underwriting (e.g., hypertension, diabetes)
  • Cross-references findings against the underwriting manual to determine what factors matter for each condition
  • Consolidates evidence from multiple sources and flags discrepancies between self-reported and documented information
  • Provides a narrative summary explaining what was found and why it matters

impairment detection screenshot

๐Ÿ“Š Risk Scoring

  • Calculates a numerical risk score based on detected impairments and underwriting guidelines
  • Looks up rating tables from the underwriting manual to determine point values for each condition
  • Accounts for modifying factors like age, medication compliance, and disease control
  • Provides detailed reasoning explaining how each score was calculated
  • Aggregates individual impairment scores into an overall risk assessment

underwriter analysis screenshot

๐Ÿ’ฌ Chat Interface

  • Natural language chat interface for querying document contents
  • Context-aware responses leveraging the extracted document insights
  • Persistent chat history ensuring coherent conversation flow
  • Quick navigation to relevant document sections using markdown links
  • Contextual understanding of underwriting terminology for detailed inquiries

underwriter analysis screenshot

๐Ÿ“ Sample Documents

We have included sample PDF documents in the sample_documents/ folder. These can be used to test the application's document processing capabilities:

  • life_submission.pdf: A sample life insurance application.
  • p&c_submission.pdf: A sample property & casualty insurance application.

๐Ÿท๏ธ Insurance Types: Life vs P&C

This demo supports both Life and Property & Casualty (P&C) underwriting modes. The selected mode controls prompts, tools, and knowledge usage endโ€‘toโ€‘end.

Life Underwriting Manual

  • A Life Underwriting Manual is included in knowledge-base/manual/ and is indexed into an Amazon Bedrock Knowledge Base during deployment.
  • The manual is consulted by agents only when insuranceType is life.
  • For property_casualty, the manual is not used and the knowledge base tool is not attached to the agents.

How the agents work

  • Analyze (cdk/lambda-functions/analyze/index.py)

    • Life: Runs with a Life Underwriter prompt and includes a kb_search tool to reference the manual when identifying impairments and scoring factors.
    • P&C: Runs with a P&C Underwriter prompt focused on P&C risk drivers; no knowledge base tool is attached.
  • Score (cdk/lambda-functions/score/index.py)

    • Life: Uses the knowledge base (kb_search) plus a calculator tool to compute subโ€‘totals and a final total, explaining reasons with references to manual content.
    • P&C: Uses a P&C scoring prompt with only the calculator tool; no knowledge base tool is available.
  • Classify (cdk/lambda-functions/classify/index.py)

    • Uses an insuranceโ€‘type specific classification prompt for Life vs P&C document types.
  • Chat (cdk/lambda-functions/chat/index.py)

    • Tailors guidance and sample tools by insurance type (e.g., Life: calculate_mortality_risk; P&C: calculate_property_premium).

Flag flow (Life/P&C)

  1. Frontend sends insuranceType with upload.
  2. API stores insuranceType on the job record in DynamoDB.
  3. Downstream lambdas read insuranceType and adapt prompts/tools accordingly (KB only in Life).

๐Ÿš€ Deployment

The project is designed to be deployed on AWS using the AWS Cloud Development Kit (CDK) for a seamless deployment of both backend and frontend services along with all necessary AWS infrastructure.

โœ… Prerequisites for Deployment

  • ๐Ÿณ Docker: Required for containerization

    • Install Docker Desktop for your OS
    • Verify the installation by running docker run hello-world
  • โ˜๏ธ AWS CLI: Install and configure with your credentials:

    aws configure  # You'll need access key, secret key, default region (us-east-1 recommended)
  • ๐Ÿ“ฆ Node.js and npm: Ensure you have Node.js (version 14 or later) and npm installed

    node --version  # Should be >= 14
    npm --version
  • ๐Ÿ—๏ธ AWS CDK: Install globally:

    npm install -g aws-cdk
    cdk --version  # Verify installation
  • ๐Ÿ“‹ CDK Dependencies: From the cdk directory, install necessary packages:

    cd cdk
    npm install

๐Ÿ“ฅ Clone the repository and navigate to the project directory

git clone https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/
cd sample-genai-underwriting-workbench-demo

โš™๏ธ Bootstrap and Deploy the CDK Stack

  1. If necessary, bootstrap your AWS environment (required once per account/region):
cd cdk
cdk bootstrap aws://ACCOUNT-NUMBER/REGION  # Replace with your AWS account number and region
  1. Deploy the stack:
cdk deploy

This process will:

  • Create all necessary AWS resources (Lambda functions, Load Balancers, DynamoDB tables, S3 buckets, etc.)
  • Deploy backend services and the frontend application
  • Output API endpoints and frontend URLs once complete

Note: Ensure your AWS account has appropriate permissions to create and manage these resources, including:

  • Lambda function creation and management
  • DynamoDB table creation
  • S3 bucket management
  • IAM role and policy management
  • CloudFormation full access

๐Ÿ—๏ธ Technical Overview

underwriter analysis screenshot

๐Ÿ”„ Demo Workflow

This demo streamlines the underwriting process through a powerful AI-driven workflow, which can be broken down into four key stages:

  1. Ingest: Incoming documents are uploaded to S3.
  2. Classify: Documents are then classified to determine their type (e.g., application, medical report, financial statement). This ensures the correct processing path and relevant extraction models are applied.
  3. Extract: Key information and data points are extracted from the classified documents. This includes details like applicant information, medical history, financial data, and other relevant underwriting criteria.
  4. Analyze: The extracted data is then analyzed by advanced AI models to identify potential risks, discrepancies, and generate comprehensive underwriting insights. This stage highlights critical information and suggests recommendations.
  5. Act: Underwriters can then interact with the analyzed data through a chat interface, review insights, and make informed decisions, leveraging the AI-generated analysis to accelerate their workflow.

๐Ÿงฉ Project Components

underwriter analysis screenshot

The project consists of three main components:

  • Backend: A serverless backend built with AWS Lambda functions and orchestrated by AWS Step Functions. It leverages Amazon Bedrock and Anthropic's Claude models for intelligent document processing.

    • API Gateway (api-handler Lambda): Handles all API requests, including document uploads (via presigned S3 URLs), retrieving job statuses, and fetching analysis results.
    • Document Extraction (bedrock-extract Lambda): Triggered by new document uploads to S3. It converts PDF documents to images, extracts key-value information from each page using Amazon Bedrock's Claude 3 model, classifies pages, and stores the raw extracted data.
    • Document Analysis (analyze Lambda): Processes the extracted data from the bedrock-extract function. It uses Amazon Bedrock's Claude 3.5 Sonnet model to perform comprehensive underwriting analysis, identifying risks, discrepancies, and generating final recommendations.
    • Agentic Actions (act Lambda): Uses the Strands Agents SDK to perform agentic actions, such as auto declining or requesting additional documentation.
    • Orchestration: AWS Step Functions coordinate the flow between the document upload, extraction, and analysis steps, ensuring a robust and scalable workflow.
    • Data Storage: DynamoDB is used to store job metadata, extracted data, and the final analysis results, while S3 is used for raw document storage.
  • Frontend: A React application (powered by Vite) that provides:

    • Document upload interface with progress tracking
    • Visual representation of extracted information
    • Interactive chat interface for querying document contents
    • Organized display of underwriting insights
    • Seamless document reprocessing capabilities
  • Infrastructure: Deployed via AWS CDK, which automates the provisioning and management of all cloud resources.

๐Ÿ’ป Development Setup

The frontend can be run locally for development and testing. Follow these steps:

Frontend

  1. Navigate to the frontend directory and install dependencies:
    cd frontend
    npm install
  2. Create an .env.local file in the frontend directory with the following content:
    VITE_API_URL=http://{CloudFront URL of deployed application}
  3. Start the development server:
    npm run dev

๐Ÿ™ Contributors

Thanks to all the contributors for building, reviewing and testing.

  • Tony Howell
  • Charles Meruwoma
  • Dhaval Shah
  • Nikolas Lecce
  • Mark Oates

Contributors

About

A demonstration project showcasing the power of Amazon Bedrock and Claude Haiku 4.5 in transforming life insurance underwriting workflows

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors