How aws-samples/amazon-bedrock-agents-healthcare-lifesciences works
Project Type and Purpose
• This is a full-stack, serverless AWS solution that showcases a library of “Healthcare & Life Sciences” AI agents built on Amazon Bedrock.
• It provides:
• An Agents Catalog (pre-built Lambdas, Docker containers, CloudFormation stacks) for common HCLS workflows.
• Multi-Agent Collaboration examples orchestrating multiple agents for end-to-end scientific workflows.
• Evaluation notebooks to benchmark agent performance.
• Two UI frontends—Streamlit and a Next.js React app—served via AWS infrastructure.
• Infrastructure-as-code via CloudFormation templates (root Infra_cfn.yaml, per-agent CFNs, ECS & pipeline templates).
File Structure
• Top-level infra & CI/CD
• Infra_cfn.yaml – primary infra (VPCs, Redshift, Bedrock Agents, Knowledgebase, UIs)
• agent_build.yaml, streamlit_build.yaml – build pipelines
• .github/workflows – docs update CI
• ActionGroups
• Collections of Python AWS Lambda functions (DICOM→NIfTI, radiomics, PubMed, plotting, database queries).
• Each folder contains code, requirements.txt, and sometimes Dockerfiles for containerized actions.
• agents_catalog
• One folder per specialized “agent” (Clinical-Evidence, Imaging, SEC-10-K, etc.).
• Each agent has its own CloudFormation, Lambda code, Docker containers (when needed), and Jupyter notebooks for setup.
• multi_agent_collaboration
• Example orchestrations with notebooks and CFN.
• evaluations
• Notebooks + scripts to run agent performance evaluations.
• UI
• streamlitapp/ – Streamlit code + CFN + Dockerfile for that UI
• ui/ – Next.js React application, with API routes under ui/app/api/*, CloudFormation for ECS, and pipeline YAML.
• docs/
Main Components
a. Infrastructure Layer (CloudFormation)
– Two VPCs: one for backend infra, one for UI.
– Subnets, Security Groups, IAM Roles.
– CI/CD pipelines (CodeBuild/CodePipeline or GitHub Actions) that build agent containers and the React/Streamlit UIs.
b. Data Layer
– Amazon Redshift for structured data (genomic, clinical trial, biomarker tables).
– Bedrock Knowledge Base (with data source sync) for unstructured domain knowledge.
– S3 buckets (implied) for containers, artifacts, CFN templates, notebook outputs.
c. Compute & AI Layer
– AWS Lambda
• API handlers for React/Streamlit chat endpoints (ui/app/api/chat/…).
• ActionGroup Lambdas for specialized functions (imaging preprocessing, PubMed queries, plotting, analytics).
• Agent-specific Lambdas (as defined in each agents_catalog subfolder).
– Amazon Bedrock (foundation models) invoked by Lambdas for LLM tasks.
– Docker-based containers (when heavy dependencies are needed) deployed to AWS Lambda Container support or ECS.
d. Application Layer (UIs)
– Streamlit App
• Deployed via a Docker container, exposing a browser UI for interactive notebooks/controls.
– React Next.js App
• Hosted on ECS (via CFN ecs.yml).
• Exposes endpoints under /api/agents and /api/chat, which proxy to Lambda.
e. Agent Catalog & Multi-agent Orchestration
– YAML definitions and notebooks orchestrate sequences of Lambdas and Bedrock calls.
– Each agent catalog sub-stack can be deployed independently via its own CFN.
– Multi-agent examples assemble multiple agents to collaborate on a single task.
f. Evaluation Suite
– Jupyter notebooks calling the agents via Lambdas or direct Bedrock API calls.
– Metrics stored back into Redshift or local JSON for reporting.
Relationships & Data Flows
• Frontend → API Gateway (or direct Lambda URL) → Lambda Chat Handlers → Bedrock models
• Chat Handlers may invoke ActionGroup Lambdas or agent-specific Lambdas to fetch data (PubMed API, Redshift queries, imaging preprocess).
• ActionGroup Lambdas read/write to Redshift or S3 or external sources, then return structured data to chat flow.
• Bedrock Knowledge Base is periodically synced via CFN triggers, and Lambdas query it for unstructured context.
• CI/CD pipelines push updated Docker images and Lambda code; CloudFormation updates the stacks.
Architectural Patterns & Principles
• Serverless / Microservices: each function is a single-purpose Lambda or container.
• Infrastructure as Code: reproducible via CloudFormation templates.
• Separation of Concerns: UI layer, API layer, compute layer, data layer are all distinct.
• Modularity: agent catalog folders are self-contained stacks.
• Reusability: ActionGroup Lambdas are generic building blocks used by multiple agents.
Technologies & Frameworks to Annotate
• AWS CloudFormation (root and per-agent CFNs)
• AWS Lambda (Python handlers, container Lambdas)
• Amazon Bedrock (LLM foundation models + Knowledge bases)
• Amazon Redshift
• Amazon S3
• ECS / Fargate for React App (Next.js)
• Docker (container images for heavy dependencies)
• React / Next.js / TypeScript for UI
• Streamlit for Python-based UI
• Astro for docs site
• GitHub Actions + CodeBuild/CodePipeline