# aws-samples/amazon-bedrock-workshop architecture

> Architecture diagram of the GitHub repository aws-samples/amazon-bedrock-workshop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/aws-samples/amazon-bedrock-workshop
- Repository: https://github.com/aws-samples/amazon-bedrock-workshop

## Overview

- Environment Setup & Prerequisites: Represent the “00_Prerequisites” module that ensures the user has the correct environment (notebook environment – either SageMaker Studio, Notebook Instance, or a local setup) and proper AWS IAM permissions for accessing Bedrock.
- Text Generation (01_Text_generation) – focused on generating text and code using Bedrock’s models.
- Knowledge Bases & RAG (02_KnowledgeBases_and_RAG) – demonstrating retrieval augmented generation with external tools (like LangChain).
- Model Customization (03_Model_customization) – showcasing fine-tuning steps on different models.
- Image and Multimodal (04_Image_and_Multimodal) – including submodules such as NovaCanvas and NovaReel, with examples like text-to-image, image inpainting, outpainting, and video generation.
- Agents (05_Agents) – constructing agents that interact with KBs and APIs.
- Open Source Examples (06_OpenSource_examples) – optional examples integrating tools like LangChain and NVIDIA NeMo Guardrails.
- Cross-Region Inference (07_Cross_Region_Inference) – a specialized lab showcasing inference across regions.
- Amazon Bedrock & External Services: Since the workshop is built around Amazon Bedrock, include a central “Amazon Bedrock API” component. Also include connectors/notes for external packages like LangChain, FAISS, and other SDKs mentioned.
- AWS Infrastructure and IAM: Illustrate how the notebooks interact with AWS services. Show that the execution environment (SageMaker or other notebooks) uses AWS IAM roles/credentials to securely call Bedrock APIs.
- Auxiliary Components: Indicate supporting elements where necessary such as the utility scripts (e.g., utility.py and utils.py in various modules), configuration files, and data assets (images, documents, PDFs) that flow into certain lab demos.

##### Relationships and Interactions
- Link each lab module to the “Amazon Bedrock API” component to show that they leverage API calls to generate text, images, or perform other tasks.
- Integration with external libraries (e.g., LangChain for RAG or text generation) by drawing interfaces or connectors between the lab modules (especially 02 and 06) and these external services.
- Data flow: for instance, user inputs (e.g., emails, text prompts) entering a Text Generation lab, flowing through API calls to Bedrock, and returning generated outputs.

##### Architectural Patterns and Design Principles
- Integration via API: The central role of Amazon Bedrock as the API provider is the connecting thread across all labs.
- External Dependency and Extendability: Illustrate how open-source tools (LangChain, FAISS, etc.) plug into the architecture for extended functionalities.

##### Final Steps for the Principal Software Engineer
- Gradually add the central Amazon Bedrock API as the connecting hub.
- External integrations (like LangChain in the RAG and open-source examples labs) are depicted with proper connectors.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Execution Environment"
        EnvSetup["Prerequisites & Environment Setup"]:::env
        AWSInfra["AWS Infrastructure (IAM, SageMaker)"]:::aws
    end

    subgraph "Lab Modules"
        TextGen["Text Generation Lab"]:::lab
        KB_RAG["Knowledge Bases & RAG Lab"]:::lab
        ModelCust["Model Customization Lab"]:::lab
        ImgMult["Image & Multimodal Lab"]:::lab
        Agents["Agents Lab"]:::lab
        OpenSource["Open Source Examples Lab"]:::lab
        CrossRegion["Cross-Region Inference Lab"]:::lab
    end

    subgraph "Image & Multimodal Details"
        NovaCanvas["NovaCanvas"]:::lab
        NovaReel["NovaReel"]:::lab
    end

    Bedrock["Amazon Bedrock API"]:::aws
    External["External Libraries/Services (LangChain,FAISS)"]:::external

    subgraph "Auxiliary Utilities"
        KBUtil["Utility Script (utility.py - KB_RAG)"]:::utility
        NovaCanvasUtil["NovaCanvas Utils (utils.py)"]:::utility
        AgentUtil["Agent Utilities (agent.py,knowledge_base.py)"]:::utility
        OSSUtil["Open Source Utils (utils.py)"]:::utility
    end

    %% Connections from Execution Environment to Lab Modules
    EnvSetup --> TextGen
    EnvSetup --> KB_RAG
    EnvSetup --> ModelCust
    EnvSetup --> ImgMult
    EnvSetup --> Agents
    EnvSetup --> OpenSource
    EnvSetup --> CrossRegion

    %% Connections from Lab Modules to Amazon Bedrock API
    TextGen -->|"calls"| Bedrock
    KB_RAG -->|"calls"| Bedrock
    ModelCust -->|"calls"| Bedrock
    ImgMult -->|"calls"| Bedrock
    Agents -->|"calls"| Bedrock
    OpenSource -->|"calls"| Bedrock
    CrossRegion -->|"calls"| Bedrock

    %% Connections from specific labs to external libraries
    KB_RAG -->|"integrates"| External
    OpenSource -->|"integrates"| External

    %% Integrate Utility Scripts with their Labs
    KB_RAG --- KBUtil
    NovaCanvas --- NovaCanvasUtil
    Agents --- AgentUtil
    OpenSource --- OSSUtil

    %% Link Image & Multimodal Lab with its submodules
    ImgMult --> NovaCanvas
    ImgMult --> NovaReel

    %% Click Events for Component Mapping
    click EnvSetup "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/00_Prerequisites/bedrock_basics.ipynb"
    click TextGen "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/01_Text_generation/01_text_and_code_generation_w_bedrock.ipynb"
    click KB_RAG "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/02_KnowledgeBases_and_RAG/README.md"
    click ModelCust "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/03_Model_customization/README.md"
    click ImgMult "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/04_Image_and_Multimodal/bedrock-titan-multimodal-embeddings.ipynb"
    click NovaCanvas "https://github.com/aws-samples/amazon-bedrock-workshop/tree/main/04_Image_and_Multimodal/AmazonNova/NovaCanvas/"
    click NovaReel "https://github.com/aws-samples/amazon-bedrock-workshop/tree/main/04_Image_and_Multimodal/AmazonNova/NovaReel/"
    click Agents "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/05_Agents/README.md"
    click OpenSource "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/06_OpenSource_examples/README.md"
    click CrossRegion "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/07_Cross_Region_Inference/README.md"
    click KBUtil "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/02_KnowledgeBases_and_RAG/utility.py"
    click NovaCanvasUtil "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/04_Image_and_Multimodal/AmazonNova/NovaCanvas/utils.py"
    click AgentUtil "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/05_Agents/agent.py"
    click OSSUtil "https://github.com/aws-samples/amazon-bedrock-workshop/blob/main/06_OpenSource_examples/utils.py"

    %% Styling Classes
    classDef env fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef aws fill:#b3e6ff,stroke:#0056b3,stroke-width:2px;
    classDef lab fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef external fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef utility fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
    
    %% Additional Data Flow: Bedrock API returns responses to labs
    Bedrock -->|"returns"| TextGen
    Bedrock -->|"returns"| KB_RAG
    Bedrock -->|"returns"| ModelCust
    Bedrock -->|"returns"| ImgMult
    Bedrock -->|"returns"| Agents
    Bedrock -->|"returns"| OpenSource
    Bedrock -->|"returns"| CrossRegion
```
