# msft-innovation-hub-india/agentic-ai-service-sample architecture

> Architecture diagram of the GitHub repository msft-innovation-hub-india/agentic-ai-service-sample, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/msft-innovation-hub-india/agentic-ai-service-sample
- Repository: https://github.com/msft-innovation-hub-india/agentic-ai-service-sample

## Overview

##### Main Components

a) Client Layer:
- Bot Framework Emulator (development)
- Azure Bot Service (production)

b) Application Layer:
- Bot Application (Python-based)
- State Management System
- User Profile Management
- Conversation Handler

c) Integration Layer:
- Azure AI Agent Service
- GPT-4 Model Integration
- REST API Integration
- Azure Logic Apps Integration

d) External Services:
- Contoso Retail Fashion REST APIs
- Azure SQL Database (for shipment orders)

**┌─ Client Tier ─────┐    ┌─ Application Tier ──┐    ┌─ Integration Tier ─┐    ┌─ External Services ─┐**

- Bot Framework     │━━━>│ Bot Application     │━━━>│ Azure AI Agent     │━━━>│ Contoso Retail      │
- Emulator/         │    │ (app.py)            │    │ Service            │    │ Fashion REST APIs    │
- Azure Bot Service │    │                     │    │                    │    │                      │
- State Management    │    │ GPT-4 Model        │    │ Azure Logic Apps    │
- (state_management_  │    │                    │    │ (Shipment           │
- bot.py)            │    │                    │    │  Processing)         │

- User Profile        │    │                    │    │ Azure SQL Database  │
- Management          │    │                    │    │ (Consignments)      │
- ┘    └──────────────────────┘    └────────────────────┘    └──────────────────────┘

##### Data Flow Representation

Following key flows:

##### Important Details

a) Configuration Components:
- Environment variables
- Swagger definition integration
- Logic App triggers and actions

b) Data Models:
- Conversation data structure
- User profile schema
- Consignment table schema

##### Technical Stack Callouts

- Python as primary language
- Microsoft Bot Framework
- Azure AI Agent Service
- GPT-4o-mini model
- Azure Logic Apps
- Azure SQL Database

##### Deployment View

- Local development setup
- Azure deployment options (App Service, Container Apps, Function Apps)

Remember to:
- Use consistent naming conventions
- Version information where relevant
- Provide zoom-in views for complex components

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles and classes
    classDef azure fill:#0072C6,color:white
    classDef app fill:#4CAF50,color:white
    classDef external fill:#FF9800,color:white
    classDef ai fill:#9C27B0,color:white
    classDef data fill:#607D8B,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        BFE["Bot Framework Emulator"]
        ABS["Azure Bot Service"]:::azure
    end

    %% Application Layer
    subgraph AppLayer["Application Layer"]
        BA["Bot Application"]:::app
        click BA "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/app.py"
        
        SMS["State Management System"]:::app
        click SMS "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/bots/state_management_bot.py"
        
        UPM["User Profile Management"]:::app
        click UPM "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/data_models/user_profile.py"
        
        CH["Conversation Handler"]:::app
        click CH "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/data_models/conversation_data.py"
        
        UF["User Functions"]:::app
        click UF "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/user_functions.py"
        
        CM["Configuration Management"]:::app
        click CM "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/config.py"
    end

    %% Integration Layer
    subgraph IntegrationLayer["Integration Layer"]
        AAIS["Azure AI Agent Service"]:::azure
        click AAIS "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/agent.py"
        
        GPT["GPT-4 Model"]:::ai
        
        REST["REST API Integration"]:::app
        click REST "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/data-files/swagger.json"
        
        LA["Logic Apps Integration"]:::azure
        click LA "https://github.com/MSFT-Innovation-Hub-India/agentic-ai-service-sample/blob/main/data-files/logic-app-definition.json"
    end

    %% External Services
    subgraph ExternalLayer["External Services"]
        CAPI["Contoso Retail Fashion REST APIs"]:::external
        ASQL["Azure SQL Database"]:::azure
        LAP["Azure Logic Apps Processing"]:::azure
    end

    %% Connections
    BFE --> BA
    ABS --> BA
    BA --> SMS
    BA --> UPM
    BA --> CH
    BA --> UF
    BA --> CM
    BA --> AAIS
    AAIS --> GPT
    AAIS --> REST
    REST --> CAPI
    BA --> LA
    LA --> LAP
    LAP --> ASQL

    %% Legend
    subgraph Legend
        L1["Azure Services"]:::azure
        L2["Application Components"]:::app
        L3["External Services"]:::external
        L4["AI/ML Components"]:::ai
        L5["Data Storage"]:::data
    end
```
