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

> Architecture diagram of the GitHub repository aws-samples/sample-genai-underwriting-workbench-demo, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/sample-genai-underwriting-workbench-demo
- Repository: https://github.com/aws-samples/sample-genai-underwriting-workbench-demo

## Overview

This is an AWS-backed underwriting workbench: users upload life or property-and-casualty submissions, then review extracted information, underwriting findings and scores, and ask questions about the job. The graph captures the documented processing stages and the sampled API, upload, classification, extraction, impairment, scoring, action, and chat responsibilities. The CDK excerpt shows S3-event and state-machine setup, but omits state-machine transitions, so uncertain step-to-step wiring is not inferred; several documented capabilities are represented at their known module paths.

Main entry points: [`cdk/lib/cdk-stack.ts`](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts) (Processing workflow), [`frontend/src/App.tsx`](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/App.tsx) (Workbench UI), [`cdk/lambda-functions/api-handler/index.py`](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/api-handler/index.py) (API handler), [`cdk/lambda-functions/chat/index.py`](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/chat/index.py) (Document chat)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Underwriter interface"]
  node_app["Workbench UI<br/>[App.tsx]"]
  node_landing["Upload and landing<br/>[LandingPage.tsx]"]
  node_jobs["Job list<br/>[JobsPage.tsx]"]
  node_jobview["Job review<br/>[JobPage.tsx]"]
  node_manual["Manual viewer<br/>[ManualPage.tsx]"]
end

subgraph group_api["API and job access"]
  node_client["API client<br/>[apiClient.ts]"]
  node_api_handler["API handler<br/>[index.py]"]
  node_chat["Document chat<br/>[index.py]"]
end

subgraph group_processing["Document processing"]
  node_upload["Upload event<br/>[cdk-stack.ts]"]
  node_workflow["Processing workflow<br/>[cdk-stack.ts]"]
  node_batch["Page batching<br/>[index.py]"]
  node_classify["Page classification<br/>[index.py]"]
  node_extract["Page extraction<br/>[index.py]"]
end

subgraph group_assessment["Underwriting assessment"]
  node_detect["Impairment detection<br/>[index.py]"]
  node_analyze["Underwriter analysis<br/>[index.py]"]
  node_score["Risk scoring<br/>[index.py]"]
  node_act["Underwriting actions<br/>[index.py]"]
end

subgraph group_aws["AWS state and AI"]
  node_documents[("Document storage<br/>[cdk-stack.ts]")]
  node_jobsdb[("Job records<br/>[cdk-stack.ts]")]
  node_bedrock{{"Amazon Bedrock"}}
  node_knowledge[("Manual knowledge base<br/>[cdk-stack.ts]")]
end

node_underwriter(("Underwriter"))

node_underwriter -->|"uses"| node_app
node_app -->|"routes to"| node_landing
node_app -->|"routes to"| node_jobs
node_app -->|"routes to"| node_jobview
node_app -->|"routes to"| node_manual
node_landing -->|"requests upload"| node_client
node_jobs -->|"fetches jobs"| node_client
node_jobview -->|"fetches job"| node_client
node_jobview -->|"chats with"| node_chat
node_client -->|"HTTP requests"| node_api_handler
node_api_handler -->|"presigns upload"| node_documents
node_api_handler -->|"reads and writes"| node_jobsdb
node_api_handler -->|"uploads trigger"| node_upload
node_upload -->|"starts workflow"| node_workflow
node_workflow -->|"dispatches"| node_batch
node_workflow -->|"dispatches"| node_classify
node_workflow -->|"dispatches"| node_extract
node_workflow -->|"dispatches"| node_detect
node_workflow -->|"dispatches"| node_analyze
node_workflow -->|"dispatches"| node_score
node_workflow -->|"dispatches"| node_act
node_batch -->|"reads document"| node_documents
node_classify -->|"reads document"| node_documents
node_classify -->|"classifies with"| node_bedrock
node_classify -->|"reads and updates"| node_jobsdb
node_extract -->|"reads pages"| node_documents
node_extract -->|"extracts with"| node_bedrock
node_extract -->|"updates status"| node_jobsdb
node_detect -->|"reads chunks"| node_documents
node_detect -->|"detects with"| node_bedrock
node_detect -.->|"searches manual"| node_knowledge
node_analyze -->|"analyzes with"| node_bedrock
node_score -->|"scores with"| node_bedrock
node_score -.->|"searches manual"| node_knowledge
node_score -->|"reads job data"| node_jobsdb
node_act -->|"assesses with"| node_bedrock
node_act -->|"writes outputs"| node_documents
node_act -->|"reads and updates"| node_jobsdb
node_chat -->|"loads context and saves history"| node_jobsdb
node_chat -->|"answers with"| node_bedrock
node_chat -.->|"uses manual"| node_knowledge
node_api_handler -->|"presigns document access"| node_documents

click node_app "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/App.tsx"
click node_landing "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/LandingPage.tsx"
click node_jobs "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/JobsPage.tsx"
click node_jobview "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/JobPage.tsx"
click node_manual "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/ManualPage.tsx"
click node_client "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/utils/apiClient.ts"
click node_api_handler "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/api-handler/index.py"
click node_chat "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/chat/index.py"
click node_upload "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts"
click node_workflow "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts"
click node_batch "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/batch-generator/index.py"
click node_classify "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/classify/index.py"
click node_extract "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/bedrock-extract/index.py"
click node_detect "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/detect-impairments/index.py"
click node_analyze "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/analyze/index.py"
click node_score "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/score/index.py"
click node_act "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/act/index.py"
click node_documents "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts"
click node_jobsdb "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts"
click node_knowledge "https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_landing,node_jobs,node_jobview,node_manual toneBlue
class node_client,node_api_handler,node_chat toneAmber
class node_upload,node_workflow,node_batch,node_classify,node_extract toneMint
class node_detect,node_analyze,node_score,node_act toneRose
class node_documents,node_jobsdb,node_bedrock,node_knowledge,node_underwriter toneIndigo
```

## Components

### Underwriter interface

- [Workbench UI](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Upload and landing](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/LandingPage.tsx): `frontend/src/components/LandingPage.tsx`
- [Job list](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/JobsPage.tsx): `frontend/src/components/JobsPage.tsx`
- [Job review](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/JobPage.tsx): `frontend/src/components/JobPage.tsx`
- [Manual viewer](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/components/ManualPage.tsx): `frontend/src/components/ManualPage.tsx`

### API and job access

- [API client](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/frontend/src/utils/apiClient.ts): `frontend/src/utils/apiClient.ts`
- [API handler](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/api-handler/index.py): `cdk/lambda-functions/api-handler/index.py`
- [Document chat](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/chat/index.py): `cdk/lambda-functions/chat/index.py`

### Document processing

- [Upload event](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts): `cdk/lib/cdk-stack.ts`
- [Processing workflow](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts): `cdk/lib/cdk-stack.ts`
- [Page batching](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/batch-generator/index.py): `cdk/lambda-functions/batch-generator/index.py`
- [Page classification](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/classify/index.py): `cdk/lambda-functions/classify/index.py`
- [Page extraction](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/bedrock-extract/index.py): `cdk/lambda-functions/bedrock-extract/index.py`

### Underwriting assessment

- [Impairment detection](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/detect-impairments/index.py): `cdk/lambda-functions/detect-impairments/index.py`
- [Underwriter analysis](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/analyze/index.py): `cdk/lambda-functions/analyze/index.py`
- [Risk scoring](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/score/index.py): `cdk/lambda-functions/score/index.py`
- [Underwriting actions](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lambda-functions/act/index.py): `cdk/lambda-functions/act/index.py`

### AWS state and AI

- [Document storage](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts): `cdk/lib/cdk-stack.ts`
- [Job records](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts): `cdk/lib/cdk-stack.ts`
- **Amazon Bedrock**
- [Manual knowledge base](https://github.com/aws-samples/sample-genai-underwriting-workbench-demo/blob/main/cdk/lib/cdk-stack.ts): `cdk/lib/cdk-stack.ts`

### Other components

- **Underwriter**

## Connections

- Underwriter → Workbench UI: uses
- Workbench UI → Upload and landing: routes to
- Workbench UI → Job list: routes to
- Workbench UI → Job review: routes to
- Workbench UI → Manual viewer: routes to
- Upload and landing → API client: requests upload
- Job list → API client: fetches jobs
- Job review → API client: fetches job
- Job review → Document chat: chats with
- API client → API handler: HTTP requests
- API handler → Document storage: presigns upload
- API handler → Job records: reads and writes
- API handler → Upload event: uploads trigger
- Upload event → Processing workflow: starts workflow
- Processing workflow → Page batching: dispatches
- Processing workflow → Page classification: dispatches
- Processing workflow → Page extraction: dispatches
- Processing workflow → Impairment detection: dispatches
- Processing workflow → Underwriter analysis: dispatches
- Processing workflow → Risk scoring: dispatches
- Processing workflow → Underwriting actions: dispatches
- Page batching → Document storage: reads document
- Page classification → Document storage: reads document
- Page classification → Amazon Bedrock: classifies with
- Page classification → Job records: reads and updates
- Page extraction → Document storage: reads pages
- Page extraction → Amazon Bedrock: extracts with
- Page extraction → Job records: updates status
- Impairment detection → Document storage: reads chunks
- Impairment detection → Amazon Bedrock: detects with
- Impairment detection → Manual knowledge base: searches manual
- Underwriter analysis → Amazon Bedrock: analyzes with
- Risk scoring → Amazon Bedrock: scores with
- Risk scoring → Manual knowledge base: searches manual
- Risk scoring → Job records: reads job data
- Underwriting actions → Amazon Bedrock: assesses with
- Underwriting actions → Document storage: writes outputs
- Underwriting actions → Job records: reads and updates
- Document chat → Job records: loads context and saves history
- Document chat → Amazon Bedrock: answers with
- Document chat → Manual knowledge base: uses manual
- API handler → Document storage: presigns document access
