How debnsuma/genai-insurance-automation works
Project Type and Purpose
• This repository is an end-to-end generative-AI solution for two insurance use cases:
• Part 1: A Jupyter/Python ML pipeline that uses Amazon Bedrock’s Claude model to generate data-processing and model-training code for insurance renewal prediction.
• Part 2: A serverless, agent-driven insurance-claim automation system that leverages Amazon Bedrock Agents, AWS Lambda, S3-backed knowledge bases, and RAG to orchestrate multi-step tasks (create claim, gather evidence, send reminders).
File Structure
• Part1-Code Generation/
• data_ml.csv, ML notebooks, model_code.py, src/claude_llm_invocation.py – a standalone ML pipeline and code-generation client for Bedrock.
• Part2-Insurance Claim Lifecycle/
• agent/ – OpenAPI schema JSON, Lambda functions (action-groups), Streamlit UI, lambda layers.
• cfn/ – CloudFormation YAML to provision Bedrock agents, knowledge bases, roles.
• documentation/ – deployment guide, testing, cleanup.
• shell/ – Bash scripts to create/delete AWS resources.
README for Architectural Insights
• It describes a six-step Bedrock-Agents workflow: user input → pre-processing → action-groups (API) → knowledge-base queries → orchestration (ReAct loops) → post-processing.
• Key AWS services: Amazon Bedrock, S3 (schemas, data, docs), AWS Lambda, Lambda Layers, CloudFormation, Python (Streamlit, Boto3).
Main Components
a. Frontend Interfaces
• Jupyter notebooks & ML scripts (Part 1)
• Streamlit application (Part 2)
b. Core Bedrock Agent Orchestrator
• Amazon Bedrock runtime with foundation models (Claude, embedding models)
• Agent logic (pre-/post-processing, ReAct prompt engine)
c. Action Groups Layer
• JSON OpenAPI schemas in S3
• AWS Lambda functions implementing create_claim, gather_evidence, send_reminder
• Lambda Layers (common code, Bedrock SDK)
d. Knowledge Base Layer
• S3 data source (policy docs, claims evidence)
• Vector store embeddings managed by Bedrock KB
• RAG retrieval APIs
e. Infrastructure Provisioning
• CloudFormation stack for Agents, KB, Roles
• Shell scripts to bootstrap or tear down resources
Relationships and Data Flow
1. User interacts via Streamlit or notebooks → sends natural-language prompt or ML code request.
2. Frontend invokes Bedrock Agent API (via Boto3).
3. Agent preprocesses the task, consults chat history and instructions.
4. Agent queries S3-hosted OpenAPI schemas to discover which Lambda to call.
5. Agent invokes the appropriate AWS Lambda (action group) to run business logic or load data.
6. For knowledge queries, Agent calls Bedrock KB retrieval endpoints (RAG) against S3 data.
7. Agent orchestrates ReAct loops: alternating FM calls and action-group/KB calls until the task is complete.
8. Final response is returned to the user interface.
9. Part 1 ML pipeline: Notebook calls claude_llm_invocation.py → requests code templates from Claude → trains scikit-learn model locally.
Architectural Patterns and Principles
• Serverless Micro-services: each action group is a Lambda function with its own OpenAPI schema.
• ReAct Orchestration: separates reasoning (LLM) from action execution (Lambda/APIs).
• RAG (Retrieval-Augmented Generation): embeds and retrieves domain documents via Bedrock KB.
• Infrastructure as Code: CloudFormation + shell scripts manage provisioning and cleanup.
• Separation of Concerns: distinct layers for UI, orchestration, action execution, and data management.