# aws-samples/bedrock-tooluse-reporter architecture

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

- Interactive diagram: https://gitdiagram.com/aws-samples/bedrock-tooluse-reporter
- Repository: https://github.com/aws-samples/bedrock-tooluse-reporter

## Overview

##### And Label Major Components
- Entry Point: Mark the “main.py” as the application’s starting point.
- Core Functional Modules:
- PerspectiveExplorer – found in research/perspective_explorer.py; it represents the interaction between two different AI models to get diverse viewpoints.
- DataSurveyor – though not directly visible as a file, infer from the README that the system uses modules in “utils” (e.g., tools) and possibly functions in “research/reporter.py” for gathering information.
- ReportWriter – implemented in research/reporter.py, responsible for synthesizing the information into structured report formats.
- Support/Utility Modules:
- “utils” directory – includes modules for configuration (config.py), communication (conversation.py), logging (logger.py), and other helper functions.
- External Services:
- AWS Bedrock API (with specific models: claude-3.7-sonnet-v1 and claude-3.5-sonnet-v2)
- Brave Search API for web search capabilities.
- Data Output: The generated report directories (./report) holding markdown, HTML, PDF, and images.
- Configuration & Environment: Represent the configuration settings in utils/config.py and environmental prerequisites (AWS, API keys, Python version).

##### Interactions and Relationships
- Start from the “main.py” which parses command line arguments (prompt, mode, log level, etc.).
- ContextChecker: capturing user input and gathering base context.
- PerspectiveExplorer: orchestrating multi-model dialogue to inject diverse perspectives.
- DataSurveyor: coordinating data collection from external APIs (AWS Bedrock, Brave Search).
- Demonstrate that utility modules (config, logger, tools, etc.) provide shared support by linking them to core components.

##### Architectural Patterns or Design Principles
- Clear modularity: Separating core application logic (research for report generation) from utility functions.
- Command-line Driven: The program’s structure is driven by main.py and CLI arguments.
- Explicit configuration management: The use of utils/config.py indicates configuration-driven behavior.
- Extensibility: The project appears designed to easily incorporate additional AI modalities or external services as needed.
- Clean Dependency Management: With requirements.in and pip-compile used, highlight that external dependencies are clearly managed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Application Entry and Orchestration
    subgraph "Application Entry and Orchestration"
        MP["Entry: main.py"]:::entry
        CTR["Controller/Orchestrator"]:::core
        MP --> CTR
    end

    %% Core Modules
    subgraph "Core Modules"
        CC["ContextChecker"]:::core
        PE["PerspectiveExplorer"]:::core
        DS["DataSurveyor"]:::core
        RW["ReportWriter"]:::core
        CTR --> CC
        CC --> PE
        PE --> DS
        DS --> RW
    end

    %% Output Generation
    subgraph "Output"
        GR["Generated Reports (Markdown,HTML,PDF,Images)"]:::output
        RW --> GR
    end

    %% External Services
    subgraph "External Services"
        AWS["AWS Bedrock API (claude-3.7/claude-3.5)"]:::external
        BS["Brave Search API"]:::external
        DS --> AWS
        DS --> BS
    end

    %% Utility Modules
    subgraph "Utility Modules"
        CONF["Config"]:::utility
        CONV["Conversation"]:::utility
        LOG["Logger"]:::utility
        TOLS["Tools"]:::utility
        UTLS["Utils"]:::utility
        DOC["Design Documentation"]:::doc
        CTR --- CONF
        CTR --- CONV
        CTR --- LOG
        CC --- TOLS
        RW --- UTLS
        RW --- DOC
    end

    %% Click Events
    click MP "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/main.py"
    click PE "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/research/perspective_explorer.py"
    click RW "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/research/reporter.py"
    click AWS "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/bedrock.py"
    click CONF "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/config.py"
    click CONV "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/conversation.py"
    click LOG "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/logger.py"
    click TOLS "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/tools.py"
    click UTLS "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/utils/utils.py"
    click DOC "https://github.com/aws-samples/bedrock-tooluse-reporter/blob/main/research/mermaid.md"

    %% Styles
    classDef entry fill:#f9c,stroke:#333,stroke-width:2px;
    classDef core fill:#bbf,stroke:#333,stroke-width:2px;
    classDef external fill:#afa,stroke:#333,stroke-width:2px;
    classDef utility fill:#fed,stroke:#333,stroke-width:2px;
    classDef output fill:#cfc,stroke:#333,stroke-width:2px;
    classDef doc fill:#fcc,stroke:#333,stroke-width:2px;
```
